RssHelperTest.php 23 KB

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