示例#1
0
 /**
  * @test
  */
 public function initialize()
 {
     $this->collection->drop();
     $authorList = [];
     foreach (['kirk', 'spock', 'mccoy'] as $nick) {
         $authorList[] = new Author($nick);
     }
     $target = $authorList[0];
     foreach ($authorList as $author) {
         $user = new Netizen($author);
         $user->setProfile(new Profile());
         $this->repository->persist($user);
         if ($target === $author) {
             $targetUser = $user;
         }
     }
     $source = new SmallTalk($target);
     $commentary = new Commentary($target);
     $source->attachCommentary($commentary);
     foreach ($authorList as $other) {
         if ($other === $target) {
             continue;
         }
         $source->addFan($other);
         $commentary->addFan($other);
     }
     $this->repository->batchPersist([$source, $source, $source]);
     $this->assertCount(6, $this->collection->find());
     return (string) $targetUser->getId();
 }
示例#2
0
 /**
  * @test
  */
 public function initialize()
 {
     $this->collection->drop();
     $author = new Author('kirk');
     $user = new Netizen($author);
     $user->setProfile(new \Trismegiste\SocialBundle\Security\Profile());
     $this->repository->persist($user);
     $source = new SmallTalk($author);
     $this->repository->batchPersist([$source, $source, $source]);
     $this->assertCount(4, $this->collection->find());
     return (string) $user->getId();
 }
示例#3
0
 /**
  * @test
  */
 public function initialize()
 {
     $this->collection->drop();
     $author = [];
     foreach (['kirk', 'spock', 'mccoy'] as $nick) {
         $author[] = new Author($nick);
     }
     $source = new SmallTalk($author[0]);
     $this->repository->persist($source);
     $rep[0] = new Repeat($author[1]);
     $rep[0]->setEmbedded($source);
     $this->repository->persist($rep[0]);
     $rep[1] = new Repeat($author[2]);
     $rep[1]->setEmbedded($rep[0]);
     $this->repository->persist($rep[1]);
     $this->assertCount(3, $this->collection->find());
 }