コード例 #1
0
 function testRemoveDoesNotLeaveIndexBehind()
 {
     $em = $this->getEntityManager();
     $repo = $em->getRepository('HireVoice\\Neo4j\\Tests\\Entity\\User');
     $user = new Entity\User();
     $user->setFirstName('Alex');
     $em->persist($user);
     $em->flush();
     $lookupValue = $user->getUniqueId();
     $this->assertCount(1, $repo->findByUniqueId($lookupValue));
     $em->remove($user);
     $em->flush();
     $this->assertCount(0, $repo->findByUniqueId($lookupValue));
 }
コード例 #2
0
ファイル: PathFinderTest.php プロジェクト: esynaps/neo4j-ogm
 public function testPathObtainedFromCypher()
 {
     $user1 = new Entity\User();
     $user2 = new Entity\User();
     $user3 = new Entity\User();
     $user1->setFirstName('Alex');
     $user2->setFirstName('Sergey');
     $user3->setFirstName('Anatoly');
     $user1->addFriend($user2);
     $user3->addFriend($user2);
     $em = $this->getEntityManager();
     $em->persist($user1);
     $em->persist($user2);
     $em->persist($user3);
     $em->flush();
     $paths = $em->createCypherQuery()->startWithNode('a', $user1)->startWithNode('b', $user3)->match('path = a -[*0..3]- b')->end('path')->getList();
     $entities = $paths[0]->getEntities();
     $this->assertEquals($user1->getFirstName(), $entities[0]->getFirstName());
     $this->assertEquals($user2->getFirstName(), $entities[1]->getFirstName());
     $this->assertEquals($user3->getFirstName(), $entities[2]->getFirstName());
 }