RssHelperTest.php 23 KB

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