Exemplo n.º 1
1
 /**
  * @test
  */
 public function findByidentifierReturnsResultOfGetObjectByIdentifierCallFromBackend()
 {
     $identifier = '42';
     $object = new \stdClass();
     $expectedResult = $this->getMock(\TYPO3\CMS\Extbase\Persistence\QueryResultInterface::class);
     $expectedResult->expects($this->once())->method('getFirst')->will($this->returnValue($object));
     $this->mockQuery->expects($this->any())->method('getQuerySettings')->will($this->returnValue($this->mockQuerySettings));
     $this->mockQuery->expects($this->once())->method('matching')->will($this->returnValue($this->mockQuery));
     $this->mockQuery->expects($this->once())->method('execute')->will($this->returnValue($expectedResult));
     // skip backend, as we want to test the backend
     $this->mockSession->expects($this->any())->method('hasIdentifier')->will($this->returnValue(FALSE));
     $this->assertSame($object, $this->repository->findByIdentifier($identifier));
 }