getIdentifierByObject() public method

Note: this returns an identifier even if the object has not been persisted in case of AOP-managed entities. Use isNewObject() if you need to distinguish those cases.
public getIdentifierByObject ( object $object ) : mixed
$object object
return mixed The identifier for the object if it is known, or NULL
 /**
  * @test
  */
 public function getIdentifierByObjectReturnsIdentifierFromSession()
 {
     $fakeUuid = 'fakeUuid';
     $object = new \stdClass();
     $mockSession = $this->createMock(Generic\Session::class);
     $mockSession->expects($this->once())->method('getIdentifierByObject')->with($object)->will($this->returnValue($fakeUuid));
     $manager = new Generic\PersistenceManager();
     $manager->injectPersistenceSession($mockSession);
     $this->assertEquals($manager->getIdentifierByObject($object), $fakeUuid);
 }