This repository was archived by the owner on Apr 29, 2019. It is now read-only.
File tree 6 files changed +164
-101
lines changed
6 files changed +164
-101
lines changed Original file line number Diff line number Diff line change 8
8
use Magento \Framework \App \ObjectManager ;
9
9
use Magento \Framework \App \Rss \DataProviderInterface ;
10
10
use Magento \Framework \Serialize \SerializerInterface ;
11
+ use Zend \Feed \Writer \FeedFactory ;
11
12
12
13
/**
13
14
* Provides functionality to work with RSS feeds
@@ -92,7 +93,7 @@ public function setDataProvider(DataProviderInterface $dataProvider)
92
93
*/
93
94
public function createRssXml ()
94
95
{
95
- $ rssFeedFromArray = \Zend_Feed:: importArray ($ this ->getFeeds (), ' rss ' );
96
- return $ rssFeedFromArray -> saveXML ( );
96
+ $ feed = FeedFactory:: factory ($ this ->getFeeds ());
97
+ return $ feed -> export ( ' rss ' );
97
98
}
98
99
}
Original file line number Diff line number Diff line change 6
6
namespace Magento \Rss \Test \Unit \Controller \Adminhtml \Feed ;
7
7
8
8
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager as ObjectManagerHelper ;
9
+ use Zend \Feed \Writer \Exception \InvalidArgumentException ;
9
10
10
11
/**
11
12
* Class IndexTest
@@ -110,7 +111,7 @@ public function testExecuteWithException()
110
111
$ this ->rssFactory ->expects ($ this ->once ())->method ('create ' )->will ($ this ->returnValue ($ rssModel ));
111
112
$ this ->rssManager ->expects ($ this ->once ())->method ('getProvider ' )->will ($ this ->returnValue ($ dataProvider ));
112
113
113
- $ this ->expectException (' \Zend_Feed_Builder_Exception ' );
114
+ $ this ->expectException (InvalidArgumentException::class );
114
115
$ this ->controller ->execute ();
115
116
}
116
117
}
Original file line number Diff line number Diff line change 6
6
namespace Magento \Rss \Test \Unit \Controller \Feed ;
7
7
8
8
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager as ObjectManagerHelper ;
9
+ use Zend \Feed \Writer \Exception \InvalidArgumentException ;
9
10
10
11
/**
11
12
* Class IndexTest
@@ -97,7 +98,7 @@ public function testExecuteWithException()
97
98
$ this ->rssFactory ->expects ($ this ->once ())->method ('create ' )->will ($ this ->returnValue ($ rssModel ));
98
99
$ this ->rssManager ->expects ($ this ->once ())->method ('getProvider ' )->will ($ this ->returnValue ($ dataProvider ));
99
100
100
- $ this ->expectException (' \Zend_Feed_Builder_Exception ' );
101
+ $ this ->expectException (InvalidArgumentException::class );
101
102
$ this ->controller ->execute ();
102
103
}
103
104
}
Original file line number Diff line number Diff line change @@ -119,11 +119,11 @@ public function testCreateRssXml()
119
119
$ this ->rss ->setDataProvider ($ dataProvider );
120
120
$ result = $ this ->rss ->createRssXml ();
121
121
$ this ->assertContains ('<?xml version="1.0" encoding="UTF-8"?> ' , $ result );
122
- $ this ->assertContains ('<title><![CDATA[ Feed Title]]> </title> ' , $ result );
123
- $ this ->assertContains ('<title><![CDATA[ Feed 1 Title]]> </title> ' , $ result );
122
+ $ this ->assertContains ('<title>Feed Title</title> ' , $ result );
123
+ $ this ->assertContains ('<title>Feed 1 Title</title> ' , $ result );
124
124
$ this ->assertContains ('<link>http://magento.com/rss/link</link> ' , $ result );
125
125
$ this ->assertContains ('<link>http://magento.com/rss/link/id/1</link> ' , $ result );
126
- $ this ->assertContains ('<description><![CDATA[ Feed Description]]> </description> ' , $ result );
126
+ $ this ->assertContains ('<description>Feed Description</description> ' , $ result );
127
127
$ this ->assertContains ('<description><![CDATA[Feed 1 Description]]></description> ' , $ result );
128
128
}
129
129
}
Original file line number Diff line number Diff line change 58
58
"zendframework/zend-db" : " ^2.8.2" ,
59
59
"zendframework/zend-di" : " ^2.6.1" ,
60
60
"zendframework/zend-eventmanager" : " ^2.6.3" ,
61
+ "zendframework/zend-feed" : " ^2.9.0" ,
61
62
"zendframework/zend-form" : " ^2.10.0" ,
62
63
"zendframework/zend-http" : " ^2.6.0" ,
63
64
"zendframework/zend-i18n" : " ^2.7.3" ,
You can’t perform that action at this time.
0 commit comments