RssHelperTest.php 23 KB

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