Example #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();
 }
Example #2
0
 /**
  * @test
  */
 public function initialize()
 {
     $this->collection->drop();
     $this->addUserFixture('kirk');
     $this->collection->ensureIndex(['message' => 'text', 'commentary.message' => 'text'], ['sparse' => true, 'weights' => ['message' => 3]]);
     $doc = new SmallTalk($this->createAuthor('kirk'));
     $doc->setMessage('and now something completely different');
     $this->contentRepo->persist($doc);
 }
 /**
  * @test
  */
 public function initialize()
 {
     parent::initialize();
     $author = [];
     foreach (['kirk', 'spock', 'mccoy'] as $nick) {
         $author[] = new Author($nick);
     }
     $doc0 = new SmallTalk($author[0]);
     $doc1 = clone $doc0;
     $doc0->report($author[1]);
     $doc2 = clone $doc0;
     $comm = new Commentary($author[1]);
     $comm->report($author[2]);
     $doc1->attachCommentary($comm);
     $doc3 = clone $doc1;
     $this->getService('dokudoki.repository')->batchPersist([$doc0, $doc1, $doc2, $doc3]);
 }
Example #4
0
 protected function initDbWithOnePublishingWithReportedComment()
 {
     $author = [];
     foreach (['kirk', 'spock', 'mccoy'] as $nick) {
         $author[] = new Author($nick);
     }
     $doc = new SmallTalk($author[0]);
     $comm = new Commentary($author[1]);
     $comm->report($author[2]);
     $comm->report($author[0]);
     $doc->attachCommentary($comm);
     $this->coll->drop();
     $this->repo->persist($doc);
 }