Exemplo n.º 1
0
 public function testGetFeeds()
 {
     $provider1 = $this->getMock('\\Magento\\Framework\\App\\Rss\\DataProviderInterface');
     $provider2 = $this->getMock('\\Magento\\Framework\\App\\Rss\\DataProviderInterface');
     $feed1 = ['group' => 'Some Group', 'feeds' => [['link' => 'feed 1 link', 'label' => 'Feed 1 Label']]];
     $feed2 = ['link' => 'feed 2 link', 'label' => 'Feed 2 Label'];
     $provider1->expects($this->once())->method('getFeeds')->will($this->returnValue($feed1));
     $provider2->expects($this->once())->method('getFeeds')->will($this->returnValue($feed2));
     $this->rssManagerInterface->expects($this->once())->method('getProviders')->will($this->returnValue([$provider1, $provider2]));
     $this->assertEquals([$feed2, $feed1], $this->block->getFeeds());
 }
Exemplo n.º 2
0
 /**
  * @return array
  */
 public function getFeeds()
 {
     $providers = $this->rssManager->getProviders();
     $feeds = [];
     $groups = [];
     foreach ($providers as $provider) {
         $item = $provider->getFeeds();
         if (empty($item)) {
             continue;
         }
         if (isset($item['group'])) {
             $groups[] = $item;
         } else {
             $feeds[] = $item;
         }
     }
     $feeds = array_merge($feeds, $groups);
     return $feeds;
 }