RssHelperTest.php 23 KB

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