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'));
 }
示例#2
0
 public function test_getIdentifierValues()
 {
     $cm = $this->getClassMetadata();
     $post = new Post(1001);
     $this->assertEquals(['id' => $post->getId()], $cm->getIdentifierValues($post));
 }
示例#3
0
 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));
 }