public function test_tryGetById() { $cs = new Changeset(); $this->assertNull($cs->tryGetById(1000, 'Pasinter\\Mocks\\Entity\\Blog\\Post')); $post = new Post(1000); $cs->identityMap['Pasinter\\Mocks\\Entity\\Blog\\Post'][$post->getId()] = $post; $this->assertInstanceOf('Pasinter\\Mocks\\Entity\\Blog\\Post', $cs->tryGetById($post->getId(), 'Pasinter\\Mocks\\Entity\\Blog\\Post')); }
public function test_getIdentifierValues() { $cm = $this->getClassMetadata(); $post = new Post(1001); $this->assertEquals(['id' => $post->getId()], $cm->getIdentifierValues($post)); }
public function test_getEntityState() { $post2 = new Post(1002); $cs = new Changeset(); $cs->identityMap = ['Pasinter\\Mocks\\Entity\\Blog\\Post' => [$post2->getId() => $post2]]; $uow = $this->getUow($cs); $this->assertEquals(UnitOfWork::STATE_NEW, $uow->getEntityState(new Post())); $this->assertEquals(UnitOfWork::STATE_NEW, $uow->getEntityState(new Post(1000))); $this->assertEquals(UnitOfWork::STATE_DETACHED, $uow->getEntityState($post2)); }