コード例 #1
0
 /**
  * @dataProvider getContentTypes
  *
  * @param string $contentType
  */
 public function testOnIndexesAddsDocumentsToAuthors($contentType)
 {
     $author = new Author('seiffert');
     $authors = new AuthorRegistry();
     $authors->addAuthor($author);
     $subscriber = new IndexesEventSubscriber($authors);
     $document = new Document();
     $document->setMetadatas(array('author' => 'seiffert'));
     $index = new Document();
     $index->setVars(array($contentType => array($document)));
     $subscriber->onIndexes($this->createEvent(array($index)));
     $document->setMetadatas(array('author' => $author), true);
     $this->assertSame(array($document), $author->getDocuments());
 }