Beispiel #1
0
 public function testValidatorCanListenToEvents()
 {
     $dispatcher = new EventDispatcher();
     $dispatcher->addListener(Events::CONTENT_PARSED, array($this->validator, 'onContentItemParsed'));
     $contentItem = new ContentItem();
     $contentItem->setBody('body');
     $contentItem->setCreated(new \DateTime());
     $contentItem->setFormat('format');
     $contentItem->setSlug('slug');
     $contentItem->setTitle('title');
     $event = Phake::mock('Fabricius\\Event\\ContentParsedEvent');
     Phake::when($event)->getContentItem()->thenReturn($contentItem);
     $dispatcher->dispatch(Events::CONTENT_PARSED, $event);
     Phake::verify($event, Phake::times(1))->getContentItem();
 }