Skip to content
This repository has been archived by the owner on Apr 29, 2019. It is now read-only.

Commit

Permalink
ENGCOM-891: Replace ZF1 Zend_Feed with ZF2/3 Zend\Feed #89
Browse files Browse the repository at this point in the history
 - Merge Pull Request magento-engcom/php-7.2-support#89 from magento-engcom/php-7.2-support:update-zend-feed
 - Merged commits:
   1. b73d1c8
  • Loading branch information
magento-engcom-team committed Mar 14, 2018
2 parents 2028ccd + b73d1c8 commit 84af1fb
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 8 deletions.
5 changes: 3 additions & 2 deletions app/code/Magento/Rss/Model/Rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Magento\Framework\App\ObjectManager;
use Magento\Framework\App\Rss\DataProviderInterface;
use Magento\Framework\Serialize\SerializerInterface;
use Zend\Feed\Writer\FeedFactory;

/**
* Provides functionality to work with RSS feeds
Expand Down Expand Up @@ -92,7 +93,7 @@ public function setDataProvider(DataProviderInterface $dataProvider)
*/
public function createRssXml()
{
$rssFeedFromArray = \Zend_Feed::importArray($this->getFeeds(), 'rss');
return $rssFeedFromArray->saveXML();
$feed = FeedFactory::factory($this->getFeeds());
return $feed->export('rss');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Magento\Rss\Test\Unit\Controller\Adminhtml\Feed;

use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
use Zend\Feed\Writer\Exception\InvalidArgumentException;

/**
* Class IndexTest
Expand Down Expand Up @@ -110,7 +111,7 @@ public function testExecuteWithException()
$this->rssFactory->expects($this->once())->method('create')->will($this->returnValue($rssModel));
$this->rssManager->expects($this->once())->method('getProvider')->will($this->returnValue($dataProvider));

$this->expectException('\Zend_Feed_Builder_Exception');
$this->expectException(InvalidArgumentException::class);
$this->controller->execute();
}
}
3 changes: 2 additions & 1 deletion app/code/Magento/Rss/Test/Unit/Controller/Feed/IndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Magento\Rss\Test\Unit\Controller\Feed;

use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
use Zend\Feed\Writer\Exception\InvalidArgumentException;

/**
* Class IndexTest
Expand Down Expand Up @@ -97,7 +98,7 @@ public function testExecuteWithException()
$this->rssFactory->expects($this->once())->method('create')->will($this->returnValue($rssModel));
$this->rssManager->expects($this->once())->method('getProvider')->will($this->returnValue($dataProvider));

$this->expectException('\Zend_Feed_Builder_Exception');
$this->expectException(InvalidArgumentException::class);
$this->controller->execute();
}
}
6 changes: 3 additions & 3 deletions app/code/Magento/Rss/Test/Unit/Model/RssTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ public function testCreateRssXml()
$this->rss->setDataProvider($dataProvider);
$result = $this->rss->createRssXml();
$this->assertContains('<?xml version="1.0" encoding="UTF-8"?>', $result);
$this->assertContains('<title><![CDATA[Feed Title]]></title>', $result);
$this->assertContains('<title><![CDATA[Feed 1 Title]]></title>', $result);
$this->assertContains('<title>Feed Title</title>', $result);
$this->assertContains('<title>Feed 1 Title</title>', $result);
$this->assertContains('<link>http://magento.com/rss/link</link>', $result);
$this->assertContains('<link>http://magento.com/rss/link/id/1</link>', $result);
$this->assertContains('<description><![CDATA[Feed Description]]></description>', $result);
$this->assertContains('<description>Feed Description</description>', $result);
$this->assertContains('<description><![CDATA[Feed 1 Description]]></description>', $result);
}
}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"zendframework/zend-db": "^2.8.2",
"zendframework/zend-di": "^2.6.1",
"zendframework/zend-eventmanager": "^2.6.3",
"zendframework/zend-feed": "^2.9.0",
"zendframework/zend-form": "^2.10.0",
"zendframework/zend-http": "^2.6.0",
"zendframework/zend-i18n": "^2.7.3",
Expand Down
63 changes: 62 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4220,4 +4220,5 @@
['Magento\Framework\MessageQueue\Config\Reader', 'Magento\Framework\MessageQueue\Config\Reader\Xml'],
['Magento\Framework\MessageQueue\PublisherFactory'],
['Magento\Framework\MessageQueue\PublisherProxy'],
['Zend_Feed', 'Zend\Feed'],
];

0 comments on commit 84af1fb

Please sign in to comment.