RssHelperTest.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784
  1. <?php
  2. /**
  3. * RssHelperTest file
  4. *
  5. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  6. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  7. *
  8. * Licensed under The MIT License
  9. * For full copyright and license information, please see the LICENSE.txt
  10. * Redistributions of files must retain the above copyright notice
  11. *
  12. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  13. * @link https://cakephp.org CakePHP(tm) Project
  14. * @since 1.2.0
  15. * @license https://opensource.org/licenses/mit-license.php MIT License
  16. */
  17. namespace Cake\Test\TestCase\View\Helper;
  18. use Cake\Filesystem\File;
  19. use Cake\Filesystem\Folder;
  20. use Cake\TestSuite\TestCase;
  21. use Cake\View\Helper\RssHelper;
  22. use Cake\View\View;
  23. /**
  24. * RssHelperTest class
  25. */
  26. class RssHelperTest extends TestCase
  27. {
  28. /**
  29. * @var \Cake\View\Helper\RssHelper
  30. */
  31. public $Rss;
  32. /**
  33. * setUp method
  34. *
  35. * @return void
  36. */
  37. public function setUp()
  38. {
  39. parent::setUp();
  40. $errorLevel = error_reporting();
  41. error_reporting(E_ALL ^ E_USER_DEPRECATED);
  42. $this->View = new View();
  43. $this->Rss = new RssHelper($this->View);
  44. error_reporting($errorLevel);
  45. }
  46. /**
  47. * tearDown method
  48. *
  49. * @return void
  50. */
  51. public function tearDown()
  52. {
  53. parent::tearDown();
  54. unset($this->Rss);
  55. }
  56. /**
  57. * testDocument method
  58. *
  59. * @return void
  60. */
  61. public function testDocument()
  62. {
  63. $result = $this->Rss->document();
  64. $expected = [
  65. 'rss' => [
  66. 'version' => '2.0'
  67. ]
  68. ];
  69. $this->assertHtml($expected, $result);
  70. $result = $this->Rss->document(null, 'content');
  71. $expected = [
  72. 'rss' => [
  73. 'version' => '2.0'
  74. ],
  75. 'content'
  76. ];
  77. $this->assertHtml($expected, $result);
  78. $result = $this->Rss->document(['contrived' => 'parameter'], 'content');
  79. $expected = [
  80. 'rss' => [
  81. 'contrived' => 'parameter',
  82. 'version' => '2.0'
  83. ],
  84. 'content'
  85. ];
  86. $this->assertHtml($expected, $result);
  87. }
  88. /**
  89. * testChannel method
  90. *
  91. * @return void
  92. */
  93. public function testChannel()
  94. {
  95. $attrib = ['a' => '1', 'b' => '2'];
  96. $elements = ['title' => 'Title'];
  97. $content = 'content';
  98. $result = $this->Rss->channel($attrib, $elements, $content);
  99. $expected = [
  100. 'channel' => [
  101. 'a' => '1',
  102. 'b' => '2'
  103. ],
  104. '<title',
  105. 'Title',
  106. '/title',
  107. '<link',
  108. $this->Rss->Url->build('/', true),
  109. '/link',
  110. '<description',
  111. 'content',
  112. '/channel'
  113. ];
  114. $this->assertHtml($expected, $result);
  115. }
  116. /**
  117. * test correct creation of channel sub elements.
  118. *
  119. * @return void
  120. */
  121. public function testChannelElements()
  122. {
  123. $attrib = [];
  124. $elements = [
  125. 'title' => 'Title of RSS Feed',
  126. 'link' => 'http://example.com',
  127. 'description' => 'Description of RSS Feed',
  128. 'image' => [
  129. 'title' => 'Title of image',
  130. 'url' => 'http://example.com/example.png',
  131. 'link' => 'http://example.com'
  132. ],
  133. 'cloud' => [
  134. 'domain' => 'rpc.sys.com',
  135. 'port' => '80',
  136. 'path' => '/RPC2',
  137. 'registerProcedure' => 'myCloud.rssPleaseNotify',
  138. 'protocol' => 'xml-rpc'
  139. ]
  140. ];
  141. $content = 'content-here';
  142. $result = $this->Rss->channel($attrib, $elements, $content);
  143. //@codingStandardsIgnoreStart
  144. $expected = [
  145. '<channel',
  146. '<title', 'Title of RSS Feed', '/title',
  147. '<link', 'http://example.com', '/link',
  148. '<description', 'Description of RSS Feed', '/description',
  149. '<image',
  150. '<title', 'Title of image', '/title',
  151. '<url', 'http://example.com/example.png', '/url',
  152. '<link', 'http://example.com', '/link',
  153. '/image',
  154. 'cloud' => [
  155. 'domain' => 'rpc.sys.com',
  156. 'port' => '80',
  157. 'path' => '/RPC2',
  158. 'registerProcedure' => 'myCloud.rssPleaseNotify',
  159. 'protocol' => 'xml-rpc'
  160. ],
  161. 'content-here',
  162. '/channel',
  163. ];
  164. //@codingStandardsIgnoreEnd
  165. $this->assertHtml($expected, $result);
  166. }
  167. public function testChannelElementAttributes()
  168. {
  169. $attrib = [];
  170. $elements = [
  171. 'title' => 'Title of RSS Feed',
  172. 'link' => 'http://example.com',
  173. 'description' => 'Description of RSS Feed',
  174. 'image' => [
  175. 'title' => 'Title of image',
  176. 'url' => 'http://example.com/example.png',
  177. 'link' => 'http://example.com'
  178. ],
  179. 'atom:link' => [
  180. 'attrib' => [
  181. 'href' => 'http://www.example.com/rss.xml',
  182. 'rel' => 'self',
  183. 'type' => 'application/rss+xml']
  184. ]
  185. ];
  186. $content = 'content-here';
  187. $result = $this->Rss->channel($attrib, $elements, $content);
  188. //@codingStandardsIgnoreStart
  189. $expected = [
  190. '<channel',
  191. '<title', 'Title of RSS Feed', '/title',
  192. '<link', 'http://example.com', '/link',
  193. '<description', 'Description of RSS Feed', '/description',
  194. '<image',
  195. '<title', 'Title of image', '/title',
  196. '<url', 'http://example.com/example.png', '/url',
  197. '<link', 'http://example.com', '/link',
  198. '/image',
  199. 'atom:link' => [
  200. 'xmlns:atom' => 'http://www.w3.org/2005/Atom',
  201. 'href' => 'http://www.example.com/rss.xml',
  202. 'rel' => 'self',
  203. 'type' => 'application/rss+xml'
  204. ],
  205. 'content-here',
  206. '/channel',
  207. ];
  208. //@codingStandardsIgnoreEnd
  209. $this->assertHtml($expected, $result);
  210. }
  211. /**
  212. * testItems method
  213. *
  214. * @return void
  215. */
  216. public function testItems()
  217. {
  218. $items = [
  219. ['title' => 'title1', 'guid' => 'http://www.example.com/guid1', 'link' => 'http://www.example.com/link1', 'description' => 'description1'],
  220. ['title' => 'title2', 'guid' => 'http://www.example.com/guid2', 'link' => 'http://www.example.com/link2', 'description' => 'description2'],
  221. ['title' => 'title3', 'guid' => 'http://www.example.com/guid3', 'link' => 'http://www.example.com/link3', 'description' => 'description3']
  222. ];
  223. $result = $this->Rss->items($items);
  224. $expected = [
  225. '<item',
  226. '<title', 'title1', '/title',
  227. '<guid', 'http://www.example.com/guid1', '/guid',
  228. '<link', 'http://www.example.com/link1', '/link',
  229. '<description', 'description1', '/description',
  230. '/item',
  231. '<item',
  232. '<title', 'title2', '/title',
  233. '<guid', 'http://www.example.com/guid2', '/guid',
  234. '<link', 'http://www.example.com/link2', '/link',
  235. '<description', 'description2', '/description',
  236. '/item',
  237. '<item',
  238. '<title', 'title3', '/title',
  239. '<guid', 'http://www.example.com/guid3', '/guid',
  240. '<link', 'http://www.example.com/link3', '/link',
  241. '<description', 'description3', '/description',
  242. '/item'
  243. ];
  244. $this->assertHtml($expected, $result);
  245. $items = [
  246. ['title' => 'title1', 'guid' => 'http://www.example.com/guid1', 'link' => 'http://www.example.com/link1', 'description' => 'description1'],
  247. ['title' => 'title2', 'guid' => 'http://www.example.com/guid2', 'link' => 'http://www.example.com/link2', 'description' => 'description2'],
  248. ['title' => 'title3', 'guid' => 'http://www.example.com/guid3', 'link' => 'http://www.example.com/link3', 'description' => 'description3']
  249. ];
  250. $result = $this->Rss->items($items, function ($v) {
  251. $v['title'] = $v['title'] . '-transformed';
  252. return $v;
  253. });
  254. $expected = [
  255. '<item',
  256. '<title', 'title1-transformed', '/title',
  257. '<guid', 'http://www.example.com/guid1', '/guid',
  258. '<link', 'http://www.example.com/link1', '/link',
  259. '<description', 'description1', '/description',
  260. '/item',
  261. '<item',
  262. '<title', 'title2-transformed', '/title',
  263. '<guid', 'http://www.example.com/guid2', '/guid',
  264. '<link', 'http://www.example.com/link2', '/link',
  265. '<description', 'description2', '/description',
  266. '/item',
  267. '<item',
  268. '<title', 'title3-transformed', '/title',
  269. '<guid', 'http://www.example.com/guid3', '/guid',
  270. '<link', 'http://www.example.com/link3', '/link',
  271. '<description', 'description3', '/description',
  272. '/item'
  273. ];
  274. $this->assertHtml($expected, $result);
  275. $result = $this->Rss->items([]);
  276. $expected = '';
  277. $this->assertEquals($expected, $result);
  278. }
  279. /**
  280. * testItem method
  281. *
  282. * @return void
  283. */
  284. public function testItem()
  285. {
  286. $item = [
  287. 'title' => 'My title',
  288. 'description' => 'My description',
  289. 'link' => 'http://www.google.com/'
  290. ];
  291. $result = $this->Rss->item(null, $item);
  292. $expected = [
  293. '<item',
  294. '<title',
  295. 'My title',
  296. '/title',
  297. '<description',
  298. 'My description',
  299. '/description',
  300. '<link',
  301. 'http://www.google.com/',
  302. '/link',
  303. '<guid',
  304. 'http://www.google.com/',
  305. '/guid',
  306. '/item'
  307. ];
  308. $this->assertHtml($expected, $result);
  309. $item = [
  310. 'title' => 'My Title',
  311. 'link' => 'http://www.example.com/1',
  312. 'description' => 'descriptive words',
  313. 'pubDate' => '2008-05-31 12:00:00',
  314. 'source' => ['http://www.google.com/', 'Google'],
  315. 'guid' => 'http://www.example.com/1'
  316. ];
  317. $result = $this->Rss->item(null, $item);
  318. $expected = [
  319. '<item',
  320. '<title',
  321. 'My Title',
  322. '/title',
  323. '<link',
  324. 'http://www.example.com/1',
  325. '/link',
  326. '<description',
  327. 'descriptive words',
  328. '/description',
  329. '<pubDate',
  330. date('r', strtotime('2008-05-31 12:00:00')),
  331. '/pubDate',
  332. 'source' => ['url' => 'http://www.google.com/'],
  333. 'Google',
  334. '/source',
  335. '<guid',
  336. 'http://www.example.com/1',
  337. '/guid',
  338. '/item'
  339. ];
  340. $this->assertHtml($expected, $result);
  341. $item = [
  342. 'title' => 'My Title & more'
  343. ];
  344. $result = $this->Rss->item(null, $item);
  345. $expected = [
  346. '<item',
  347. '<title', 'My Title &amp; more', '/title',
  348. '/item'
  349. ];
  350. $this->assertHtml($expected, $result);
  351. $item = [
  352. 'title' => 'Foo bar',
  353. 'link' => [
  354. 'url' => 'http://example.com/foo?a=1&b=2',
  355. 'convertEntities' => false
  356. ],
  357. 'description' => [
  358. 'value' => 'descriptive words',
  359. 'cdata' => true,
  360. ],
  361. 'pubDate' => '2008-05-31 12:00:00',
  362. 'source' => 'http://www.google.com/'
  363. ];
  364. $result = $this->Rss->item(null, $item);
  365. $expected = [
  366. '<item',
  367. '<title',
  368. 'Foo bar',
  369. '/title',
  370. '<link',
  371. 'http://example.com/foo?a=1&amp;b=2',
  372. '/link',
  373. '<description',
  374. '<![CDATA[descriptive words]]',
  375. '/description',
  376. '<pubDate',
  377. date('r', strtotime('2008-05-31 12:00:00')),
  378. '/pubDate',
  379. '<source',
  380. 'http://www.google.com/',
  381. '/source',
  382. '<guid',
  383. 'http://example.com/foo?a=1&amp;b=2',
  384. '/guid',
  385. '/item'
  386. ];
  387. $this->assertHtml($expected, $result);
  388. $item = [
  389. 'title' => 'My title',
  390. 'description' => 'My description',
  391. 'link' => 'http://www.google.com/',
  392. 'source' => ['url' => 'http://www.example.com/', 'title' => 'Example website']
  393. ];
  394. $result = $this->Rss->item(null, $item);
  395. $expected = [
  396. '<item',
  397. '<title',
  398. 'My title',
  399. '/title',
  400. '<description',
  401. 'My description',
  402. '/description',
  403. '<link',
  404. 'http://www.google.com/',
  405. '/link',
  406. 'source' => ['url' => 'http://www.example.com/'],
  407. 'Example website',
  408. '/source',
  409. '<guid',
  410. 'http://www.google.com/',
  411. '/guid',
  412. '/item'
  413. ];
  414. $this->assertHtml($expected, $result);
  415. $item = [
  416. 'title' => 'My title',
  417. 'description' => 'My description',
  418. 'link' => 'http://www.google.com/',
  419. 'category' => ['Category One', 'Category Two']
  420. ];
  421. $result = $this->Rss->item(null, $item);
  422. $expected = [
  423. '<item',
  424. '<title',
  425. 'My title',
  426. '/title',
  427. '<description',
  428. 'My description',
  429. '/description',
  430. '<link',
  431. 'http://www.google.com/',
  432. '/link',
  433. '<category',
  434. 'Category One',
  435. '/category',
  436. '<category',
  437. 'Category Two',
  438. '/category',
  439. '<guid',
  440. 'http://www.google.com/',
  441. '/guid',
  442. '/item'
  443. ];
  444. $this->assertHtml($expected, $result);
  445. }
  446. /**
  447. * test item() with cdata blocks.
  448. *
  449. * @return void
  450. */
  451. public function testItemCdata()
  452. {
  453. $item = [
  454. 'title' => [
  455. 'value' => 'My Title & more',
  456. 'cdata' => true,
  457. 'convertEntities' => false,
  458. ]
  459. ];
  460. $result = $this->Rss->item(null, $item);
  461. $expected = [
  462. '<item',
  463. '<title',
  464. '<![CDATA[My Title & more]]',
  465. '/title',
  466. '/item'
  467. ];
  468. $this->assertHtml($expected, $result);
  469. $item = [
  470. 'category' => [
  471. 'value' => 'CakePHP',
  472. 'cdata' => true,
  473. 'domain' => 'http://www.cakephp.org',
  474. ]
  475. ];
  476. $result = $this->Rss->item(null, $item);
  477. $expected = [
  478. '<item',
  479. 'category' => ['domain' => 'http://www.cakephp.org'],
  480. '<![CDATA[CakePHP]]',
  481. '/category',
  482. '/item'
  483. ];
  484. $this->assertHtml($expected, $result);
  485. $item = [
  486. 'category' => [
  487. [
  488. 'value' => 'CakePHP',
  489. 'cdata' => true,
  490. 'domain' => 'http://www.cakephp.org'
  491. ],
  492. [
  493. 'value' => 'Bakery',
  494. 'cdata' => true
  495. ]
  496. ]
  497. ];
  498. $result = $this->Rss->item(null, $item);
  499. $expected = [
  500. '<item',
  501. 'category' => ['domain' => 'http://www.cakephp.org'],
  502. '<![CDATA[CakePHP]]',
  503. '/category',
  504. '<category',
  505. '<![CDATA[Bakery]]',
  506. '/category',
  507. '/item'
  508. ];
  509. $this->assertHtml($expected, $result);
  510. $item = [
  511. 'title' => [
  512. 'value' => 'My Title',
  513. 'cdata' => true,
  514. ],
  515. 'link' => 'http://www.example.com/1',
  516. 'description' => [
  517. 'value' => 'descriptive words',
  518. 'cdata' => true,
  519. ],
  520. 'enclosure' => [
  521. 'url' => '/test.flv'
  522. ],
  523. 'pubDate' => '2008-05-31 12:00:00',
  524. 'guid' => 'http://www.example.com/1',
  525. 'category' => [
  526. [
  527. 'value' => 'CakePHP',
  528. 'cdata' => true,
  529. 'domain' => 'http://www.cakephp.org'
  530. ],
  531. [
  532. 'value' => 'Bakery',
  533. 'cdata' => true
  534. ]
  535. ]
  536. ];
  537. $result = $this->Rss->item(null, $item);
  538. $expected = [
  539. '<item',
  540. '<title',
  541. '<![CDATA[My Title]]',
  542. '/title',
  543. '<link',
  544. 'http://www.example.com/1',
  545. '/link',
  546. '<description',
  547. '<![CDATA[descriptive words]]',
  548. '/description',
  549. 'enclosure' => ['url' => $this->Rss->Url->build('/test.flv', true)],
  550. '<pubDate',
  551. date('r', strtotime('2008-05-31 12:00:00')),
  552. '/pubDate',
  553. '<guid',
  554. 'http://www.example.com/1',
  555. '/guid',
  556. 'category' => ['domain' => 'http://www.cakephp.org'],
  557. '<![CDATA[CakePHP]]',
  558. '/category',
  559. '<category',
  560. '<![CDATA[Bakery]]',
  561. '/category',
  562. '/item'
  563. ];
  564. $this->assertHtml($expected, $result);
  565. }
  566. /**
  567. * test item() with enclosure data.
  568. *
  569. * @return void
  570. */
  571. public function testItemEnclosureLength()
  572. {
  573. if (!is_writable(WWW_ROOT)) {
  574. $this->markTestSkipped('Webroot is not writable.');
  575. }
  576. $testExists = is_dir(WWW_ROOT . 'tests');
  577. $tmpFile = WWW_ROOT . 'tests/cakephp.file.test.tmp';
  578. $File = new File($tmpFile, true);
  579. $this->assertTrue($File->write('1234'), 'Could not write to ' . $tmpFile);
  580. clearstatcache();
  581. $item = [
  582. 'title' => [
  583. 'value' => 'My Title',
  584. 'cdata' => true,
  585. ],
  586. 'link' => 'http://www.example.com/1',
  587. 'description' => [
  588. 'value' => 'descriptive words',
  589. 'cdata' => true,
  590. ],
  591. 'enclosure' => [
  592. 'url' => '/tests/cakephp.file.test.tmp'
  593. ],
  594. 'pubDate' => '2008-05-31 12:00:00',
  595. 'guid' => 'http://www.example.com/1',
  596. 'category' => [
  597. [
  598. 'value' => 'CakePHP',
  599. 'cdata' => true,
  600. 'domain' => 'http://www.cakephp.org'
  601. ],
  602. [
  603. 'value' => 'Bakery',
  604. 'cdata' => true
  605. ]
  606. ]
  607. ];
  608. $result = $this->Rss->item(null, $item);
  609. if (!function_exists('mime_content_type')) {
  610. $type = null;
  611. } else {
  612. $type = mime_content_type($tmpFile);
  613. }
  614. $expected = [
  615. '<item',
  616. '<title',
  617. '<![CDATA[My Title]]',
  618. '/title',
  619. '<link',
  620. 'http://www.example.com/1',
  621. '/link',
  622. '<description',
  623. '<![CDATA[descriptive words]]',
  624. '/description',
  625. 'enclosure' => [
  626. 'url' => $this->Rss->Url->build('/tests/cakephp.file.test.tmp', true),
  627. 'length' => filesize($tmpFile),
  628. 'type' => $type
  629. ],
  630. '<pubDate',
  631. date('r', strtotime('2008-05-31 12:00:00')),
  632. '/pubDate',
  633. '<guid',
  634. 'http://www.example.com/1',
  635. '/guid',
  636. 'category' => ['domain' => 'http://www.cakephp.org'],
  637. '<![CDATA[CakePHP]]',
  638. '/category',
  639. '<category',
  640. '<![CDATA[Bakery]]',
  641. '/category',
  642. '/item'
  643. ];
  644. if ($type === null) {
  645. unset($expected['enclosure']['type']);
  646. }
  647. $this->assertHtml($expected, $result);
  648. $File->delete();
  649. if (!$testExists) {
  650. $Folder = new Folder(WWW_ROOT . 'tests');
  651. $Folder->delete();
  652. }
  653. }
  654. /**
  655. * testElementAttrNotInParent method
  656. *
  657. * @return void
  658. */
  659. public function testElementAttrNotInParent()
  660. {
  661. $attributes = [
  662. 'title' => 'Some Title',
  663. 'link' => 'http://link.com',
  664. 'description' => 'description'
  665. ];
  666. $elements = ['enclosure' => ['url' => 'http://test.com']];
  667. $result = $this->Rss->item($attributes, $elements);
  668. $expected = [
  669. 'item' => [
  670. 'title' => 'Some Title',
  671. 'link' => 'http://link.com',
  672. 'description' => 'description'
  673. ],
  674. 'enclosure' => [
  675. 'url' => 'http://test.com'
  676. ],
  677. '/item'
  678. ];
  679. $this->assertHtml($expected, $result);
  680. }
  681. public function testElementNamespaceWithoutPrefix()
  682. {
  683. $item = [
  684. 'creator' => 'Alex',
  685. ];
  686. $attributes = [
  687. 'namespace' => 'http://link.com'
  688. ];
  689. $result = $this->Rss->item($attributes, $item);
  690. $expected = [
  691. 'item' => [
  692. 'xmlns' => 'http://link.com'
  693. ],
  694. 'creator' => [
  695. 'xmlns' => 'http://link.com'
  696. ],
  697. 'Alex',
  698. '/creator',
  699. '/item'
  700. ];
  701. $this->assertHtml($expected, $result, true);
  702. }
  703. public function testElementNamespaceWithPrefix()
  704. {
  705. $item = [
  706. 'title' => 'Title',
  707. 'dc:creator' => 'Alex',
  708. 'dc:description' => 'descriptive words'
  709. ];
  710. $attributes = [
  711. 'namespace' => [
  712. 'prefix' => 'dc',
  713. 'url' => 'http://link.com'
  714. ]
  715. ];
  716. $result = $this->Rss->item($attributes, $item);
  717. $expected = [
  718. 'item' => [
  719. 'xmlns:dc' => 'http://link.com'
  720. ],
  721. 'title' => [
  722. 'xmlns:dc' => 'http://link.com'
  723. ],
  724. 'Title',
  725. '/title',
  726. 'dc:creator' => [
  727. 'xmlns:dc' => 'http://link.com'
  728. ],
  729. 'Alex',
  730. '/dc:creator',
  731. 'dc:description' => [
  732. 'xmlns:dc' => 'http://link.com'
  733. ],
  734. 'descriptive words',
  735. '/dc:description',
  736. '/item'
  737. ];
  738. $this->assertHtml($expected, $result, true);
  739. }
  740. }