Пример #1
0
 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));
 }