Пример #1
0
 public function testChildAttribValue()
 {
     $em = $this->getEntityManager();
     $movie = new Entity\Movie();
     $movie->setTitle('Army of Darkness');
     $cinema = new Entity\Cinema();
     $cinema->setName('Nuovo Cinema paradiso');
     $cinema->addPresentedMovie($movie);
     $multiplex = new Entity\Multiplex();
     $multiplex->setName('Multisala Portanova');
     $multiplex->addPresentedMovie($movie);
     $multiplex->setRooms(5);
     $em->persist($multiplex);
     $em->flush();
     $id = $multiplex->getId();
     $mp = $em->getRepository('HireVoice\\Neo4j\\Tests\\Entity\\Multiplex')->findOneBy(array('id' => $id));
     $this->assertEquals(5, $mp->getRooms());
 }
Пример #2
0
 /**
  * @dataProvider eventNameProvider
  * @param $eventName
  */
 public function testGetSet($eventName)
 {
     $className = 'HireVoice\\Neo4j\\Event\\' . ucfirst($eventName);
     $movie = new Movie();
     $movie->setTitle('Terminator');
     $cinema = new Cinema();
     $cinema->setName('Cinedome');
     $cinema->addPresentedMovie($movie);
     $client = $this->getMockBuilder('Everyman\\Neo4j\\Client')->disableAutoload()->disableOriginalConstructor()->getMock();
     $relationship = new Relationship($client);
     $event = new $className($cinema, $movie, 'presents', $relationship);
     $this->assertSame($event->getFrom(), $cinema);
     $this->assertSame($event->getTo(), $movie);
     $this->assertSame($event->getName(), 'presents');
     $this->assertSame($event->getRelationship(), $relationship);
     $event->setFrom($movie);
     $event->setTo($cinema);
     $event->setName('presented-by');
     $this->assertSame($event->getFrom(), $movie);
     $this->assertSame($event->getTo(), $cinema);
     $this->assertSame($event->getName(), 'presented-by');
     $this->assertSame($event->getRelationship(), $relationship);
     $this->assertSame($event->getEventName(), $eventName);
 }
Пример #3
0
 function testWriteOnlyProperty()
 {
     $movie = new Entity\Movie();
     $movie->setTitle('Return of the king');
     $cinema = new Entity\Cinema();
     $cinema->setName('Paramount');
     $cinema->getRejectedMovies()->add($movie);
     $em = $this->getEntityManager();
     $em->persist($cinema);
     $em->flush();
     $em = $this->getEntityManager();
     $cinema = $em->find(get_class($cinema), $cinema->getId());
     $this->assertCount(0, $cinema->getRejectedMovies());
 }