/** * @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(); }
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); }