16 use Doctrine\DBAL\Driver\Statement;
17 use Prophecy\Argument;
24 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
38 $connectionProphet = $this->prophesize(Connection::class);
39 $connectionProphet->quoteIdentifier(Argument::cetera())->willReturnArgument(0);
41 $queryBuilderProphet = $this->prophesize(QueryBuilder::class);
42 $queryBuilderProphet->expr()->willReturn(
43 GeneralUtility::makeInstance(ExpressionBuilder::class, $connectionProphet->reveal())
46 $connectionPoolProphet = $this->prophesize(ConnectionPool::class);
47 $connectionPoolProphet->getQueryBuilderForTable(Argument::cetera())->willReturn($queryBuilderProphet->reveal());
48 GeneralUtility::addInstance(ConnectionPool::class, $connectionPoolProphet->reveal());
50 return $queryBuilderProphet;
53 protected function setUp()
55 $this->subject = $this->getMockForAbstractClass(AbstractRepository::class, [],
'',
false);
63 $this->expectException(\InvalidArgumentException::class);
64 $this->expectExceptionCode(1316779798);
65 $this->subject->findByUid(
'asdf');
73 $statementProphet = $this->prophesize(Statement::class);
74 $statementProphet->fetch()->shouldBeCalled()->willReturn([
'uid' => 123]);
77 $queryBuilderProphet->select(
'*')->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
78 $queryBuilderProphet->from(
'')->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
79 $queryBuilderProphet->where(Argument::cetera())->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
80 $queryBuilderProphet->createNamedParameter(Argument::cetera())->willReturnArgument(0);
81 $queryBuilderProphet->execute()->shouldBeCalled()->willReturn($statementProphet->reveal());
83 $this->subject->findByUid(
'123');