Пример #1
0
 /**
  * @return \Zend\Feed\Writer\Feed
  */
 public function getFeed()
 {
     if ($this->feed instanceof Feed) {
         return $this->feed;
     }
     if (!$this->type) {
         $options = $this->getOptions();
         if (isset($options['feed_type'])) {
             $this->type = $options['feed_type'];
         }
     }
     $variables = $this->getVariables();
     $feed = FeedFactory::factory($variables);
     $this->setFeed($feed);
     return $this->feed;
 }
Пример #2
0
 public function testResponseContentTypeIsBasedOnFeedType()
 {
     $this->renderer->setFeedType('rss');
     $expected = FeedFactory::factory($this->getFeedData('rss'));
     $this->event->setResponse($this->response);
     $this->event->setRenderer($this->renderer);
     $this->event->setResult($expected);
     $this->strategy->injectResponse($this->event);
     $content = $this->response->getContent();
     $headers = $this->response->headers();
     $this->assertEquals($expected->export('rss'), $content);
     $this->assertTrue($headers->has('content-type'));
     $this->assertEquals('application/rss+xml', $headers->get('content-type')->getFieldValue());
 }