injectReflectionService() public method

Injects a Reflection Service instance
public injectReflectionService ( ReflectionService $reflectionService ) : void
$reflectionService Neos\Flow\Reflection\ReflectionService
return void
コード例 #1
0
 /**
  * @test
  */
 public function getIdentifierByObjectReturnsValueOfPropertyTaggedWithId()
 {
     $object = $this->createMock(ProxyInterface::class);
     $object->Persistence_Object_Identifier = 'randomlyGeneratedUuid';
     $object->customId = 'customId';
     $mockReflectionService = $this->createMock(ReflectionService::class);
     $mockReflectionService->expects($this->any())->method('getPropertyNamesByTag')->will($this->returnValue(['customId']));
     $session = new Persistence\Generic\Session();
     $session->injectReflectionService($mockReflectionService);
     $this->assertEquals('customId', $session->getIdentifierByObject($object));
 }