public function testOnDocuments() { $tags = new Tags(); $documents = array(); for ($i = 1; $i <= 20; ++$i) { $document = new Document(); $document->setTitle('Post #' . $i); $document->setTags('Tag #' . $i % 5); $documents[] = $document; } $processor = new Processor(); $globals = $processor->processGlobals($documents); $event = new CarewEvent($documents, array('globals' => $globals)); $tags->onDocuments($event); $documents = $event->getSubject(); // 20 post, 1 page for all tags, 5 tags $this->assertCount(26, $documents); $this->assertSame('tags/tag-1.html', $documents['tags/Tag #1']->getPath()); }