RssHelperTest.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774
  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. * @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, create_function('$v', '$v[\'title\'] = $v[\'title\'] . \'-transformed\'; return $v;'));
  248. $expected = [
  249. '<item',
  250. '<title', 'title1-transformed', '/title',
  251. '<guid', 'http://www.example.com/guid1', '/guid',
  252. '<link', 'http://www.example.com/link1', '/link',
  253. '<description', 'description1', '/description',
  254. '/item',
  255. '<item',
  256. '<title', 'title2-transformed', '/title',
  257. '<guid', 'http://www.example.com/guid2', '/guid',
  258. '<link', 'http://www.example.com/link2', '/link',
  259. '<description', 'description2', '/description',
  260. '/item',
  261. '<item',
  262. '<title', 'title3-transformed', '/title',
  263. '<guid', 'http://www.example.com/guid3', '/guid',
  264. '<link', 'http://www.example.com/link3', '/link',
  265. '<description', 'description3', '/description',
  266. '/item'
  267. ];
  268. $this->assertHtml($expected, $result);
  269. $result = $this->Rss->items([]);
  270. $expected = '';
  271. $this->assertEquals($expected, $result);
  272. }
  273. /**
  274. * testItem method
  275. *
  276. * @return void
  277. */
  278. public function testItem()
  279. {
  280. $item = [
  281. 'title' => 'My title',
  282. 'description' => 'My description',
  283. 'link' => 'http://www.google.com/'
  284. ];
  285. $result = $this->Rss->item(null, $item);
  286. $expected = [
  287. '<item',
  288. '<title',
  289. 'My title',
  290. '/title',
  291. '<description',
  292. 'My description',
  293. '/description',
  294. '<link',
  295. 'http://www.google.com/',
  296. '/link',
  297. '<guid',
  298. 'http://www.google.com/',
  299. '/guid',
  300. '/item'
  301. ];
  302. $this->assertHtml($expected, $result);
  303. $item = [
  304. 'title' => 'My Title',
  305. 'link' => 'http://www.example.com/1',
  306. 'description' => 'descriptive words',
  307. 'pubDate' => '2008-05-31 12:00:00',
  308. 'source' => ['http://www.google.com/', 'Google'],
  309. 'guid' => 'http://www.example.com/1'
  310. ];
  311. $result = $this->Rss->item(null, $item);
  312. $expected = [
  313. '<item',
  314. '<title',
  315. 'My Title',
  316. '/title',
  317. '<link',
  318. 'http://www.example.com/1',
  319. '/link',
  320. '<description',
  321. 'descriptive words',
  322. '/description',
  323. '<pubDate',
  324. date('r', strtotime('2008-05-31 12:00:00')),
  325. '/pubDate',
  326. 'source' => ['url' => 'http://www.google.com/'],
  327. 'Google',
  328. '/source',
  329. '<guid',
  330. 'http://www.example.com/1',
  331. '/guid',
  332. '/item'
  333. ];
  334. $this->assertHtml($expected, $result);
  335. $item = [
  336. 'title' => 'My Title & more'
  337. ];
  338. $result = $this->Rss->item(null, $item);
  339. $expected = [
  340. '<item',
  341. '<title', 'My Title &amp; more', '/title',
  342. '/item'
  343. ];
  344. $this->assertHtml($expected, $result);
  345. $item = [
  346. 'title' => 'Foo bar',
  347. 'link' => [
  348. 'url' => 'http://example.com/foo?a=1&b=2',
  349. 'convertEntities' => false
  350. ],
  351. 'description' => [
  352. 'value' => 'descriptive words',
  353. 'cdata' => true,
  354. ],
  355. 'pubDate' => '2008-05-31 12:00:00',
  356. 'source' => 'http://www.google.com/'
  357. ];
  358. $result = $this->Rss->item(null, $item);
  359. $expected = [
  360. '<item',
  361. '<title',
  362. 'Foo bar',
  363. '/title',
  364. '<link',
  365. 'http://example.com/foo?a=1&amp;b=2',
  366. '/link',
  367. '<description',
  368. '<![CDATA[descriptive words]]',
  369. '/description',
  370. '<pubDate',
  371. date('r', strtotime('2008-05-31 12:00:00')),
  372. '/pubDate',
  373. '<source',
  374. 'http://www.google.com/',
  375. '/source',
  376. '<guid',
  377. 'http://example.com/foo?a=1&amp;b=2',
  378. '/guid',
  379. '/item'
  380. ];
  381. $this->assertHtml($expected, $result);
  382. $item = [
  383. 'title' => 'My title',
  384. 'description' => 'My description',
  385. 'link' => 'http://www.google.com/',
  386. 'source' => ['url' => 'http://www.example.com/', 'title' => 'Example website']
  387. ];
  388. $result = $this->Rss->item(null, $item);
  389. $expected = [
  390. '<item',
  391. '<title',
  392. 'My title',
  393. '/title',
  394. '<description',
  395. 'My description',
  396. '/description',
  397. '<link',
  398. 'http://www.google.com/',
  399. '/link',
  400. 'source' => ['url' => 'http://www.example.com/'],
  401. 'Example website',
  402. '/source',
  403. '<guid',
  404. 'http://www.google.com/',
  405. '/guid',
  406. '/item'
  407. ];
  408. $this->assertHtml($expected, $result);
  409. $item = [
  410. 'title' => 'My title',
  411. 'description' => 'My description',
  412. 'link' => 'http://www.google.com/',
  413. 'category' => ['Category One', 'Category Two']
  414. ];
  415. $result = $this->Rss->item(null, $item);
  416. $expected = [
  417. '<item',
  418. '<title',
  419. 'My title',
  420. '/title',
  421. '<description',
  422. 'My description',
  423. '/description',
  424. '<link',
  425. 'http://www.google.com/',
  426. '/link',
  427. '<category',
  428. 'Category One',
  429. '/category',
  430. '<category',
  431. 'Category Two',
  432. '/category',
  433. '<guid',
  434. 'http://www.google.com/',
  435. '/guid',
  436. '/item'
  437. ];
  438. $this->assertHtml($expected, $result);
  439. }
  440. /**
  441. * test item() with cdata blocks.
  442. *
  443. * @return void
  444. */
  445. public function testItemCdata()
  446. {
  447. $item = [
  448. 'title' => [
  449. 'value' => 'My Title & more',
  450. 'cdata' => true,
  451. 'convertEntities' => false,
  452. ]
  453. ];
  454. $result = $this->Rss->item(null, $item);
  455. $expected = [
  456. '<item',
  457. '<title',
  458. '<![CDATA[My Title & more]]',
  459. '/title',
  460. '/item'
  461. ];
  462. $this->assertHtml($expected, $result);
  463. $item = [
  464. 'category' => [
  465. 'value' => 'CakePHP',
  466. 'cdata' => true,
  467. 'domain' => 'http://www.cakephp.org',
  468. ]
  469. ];
  470. $result = $this->Rss->item(null, $item);
  471. $expected = [
  472. '<item',
  473. 'category' => ['domain' => 'http://www.cakephp.org'],
  474. '<![CDATA[CakePHP]]',
  475. '/category',
  476. '/item'
  477. ];
  478. $this->assertHtml($expected, $result);
  479. $item = [
  480. 'category' => [
  481. [
  482. 'value' => 'CakePHP',
  483. 'cdata' => true,
  484. 'domain' => 'http://www.cakephp.org'
  485. ],
  486. [
  487. 'value' => 'Bakery',
  488. 'cdata' => true
  489. ]
  490. ]
  491. ];
  492. $result = $this->Rss->item(null, $item);
  493. $expected = [
  494. '<item',
  495. 'category' => ['domain' => 'http://www.cakephp.org'],
  496. '<![CDATA[CakePHP]]',
  497. '/category',
  498. '<category',
  499. '<![CDATA[Bakery]]',
  500. '/category',
  501. '/item'
  502. ];
  503. $this->assertHtml($expected, $result);
  504. $item = [
  505. 'title' => [
  506. 'value' => 'My Title',
  507. 'cdata' => true,
  508. ],
  509. 'link' => 'http://www.example.com/1',
  510. 'description' => [
  511. 'value' => 'descriptive words',
  512. 'cdata' => true,
  513. ],
  514. 'enclosure' => [
  515. 'url' => '/test.flv'
  516. ],
  517. 'pubDate' => '2008-05-31 12:00:00',
  518. 'guid' => 'http://www.example.com/1',
  519. 'category' => [
  520. [
  521. 'value' => 'CakePHP',
  522. 'cdata' => true,
  523. 'domain' => 'http://www.cakephp.org'
  524. ],
  525. [
  526. 'value' => 'Bakery',
  527. 'cdata' => true
  528. ]
  529. ]
  530. ];
  531. $result = $this->Rss->item(null, $item);
  532. $expected = [
  533. '<item',
  534. '<title',
  535. '<![CDATA[My Title]]',
  536. '/title',
  537. '<link',
  538. 'http://www.example.com/1',
  539. '/link',
  540. '<description',
  541. '<![CDATA[descriptive words]]',
  542. '/description',
  543. 'enclosure' => ['url' => $this->Rss->Url->build('/test.flv', true)],
  544. '<pubDate',
  545. date('r', strtotime('2008-05-31 12:00:00')),
  546. '/pubDate',
  547. '<guid',
  548. 'http://www.example.com/1',
  549. '/guid',
  550. 'category' => ['domain' => 'http://www.cakephp.org'],
  551. '<![CDATA[CakePHP]]',
  552. '/category',
  553. '<category',
  554. '<![CDATA[Bakery]]',
  555. '/category',
  556. '/item'
  557. ];
  558. $this->assertHtml($expected, $result);
  559. }
  560. /**
  561. * test item() with enclosure data.
  562. *
  563. * @return void
  564. */
  565. public function testItemEnclosureLength()
  566. {
  567. if (!is_writable(WWW_ROOT)) {
  568. $this->markTestSkipped('Webroot is not writable.');
  569. }
  570. $testExists = is_dir(WWW_ROOT . 'tests');
  571. $tmpFile = WWW_ROOT . 'tests/cakephp.file.test.tmp';
  572. $File = new File($tmpFile, true);
  573. $this->assertTrue($File->write('1234'), 'Could not write to ' . $tmpFile);
  574. clearstatcache();
  575. $item = [
  576. 'title' => [
  577. 'value' => 'My Title',
  578. 'cdata' => true,
  579. ],
  580. 'link' => 'http://www.example.com/1',
  581. 'description' => [
  582. 'value' => 'descriptive words',
  583. 'cdata' => true,
  584. ],
  585. 'enclosure' => [
  586. 'url' => '/tests/cakephp.file.test.tmp'
  587. ],
  588. 'pubDate' => '2008-05-31 12:00:00',
  589. 'guid' => 'http://www.example.com/1',
  590. 'category' => [
  591. [
  592. 'value' => 'CakePHP',
  593. 'cdata' => true,
  594. 'domain' => 'http://www.cakephp.org'
  595. ],
  596. [
  597. 'value' => 'Bakery',
  598. 'cdata' => true
  599. ]
  600. ]
  601. ];
  602. $result = $this->Rss->item(null, $item);
  603. if (!function_exists('mime_content_type')) {
  604. $type = null;
  605. } else {
  606. $type = mime_content_type($tmpFile);
  607. }
  608. $expected = [
  609. '<item',
  610. '<title',
  611. '<![CDATA[My Title]]',
  612. '/title',
  613. '<link',
  614. 'http://www.example.com/1',
  615. '/link',
  616. '<description',
  617. '<![CDATA[descriptive words]]',
  618. '/description',
  619. 'enclosure' => [
  620. 'url' => $this->Rss->Url->build('/tests/cakephp.file.test.tmp', true),
  621. 'length' => filesize($tmpFile),
  622. 'type' => $type
  623. ],
  624. '<pubDate',
  625. date('r', strtotime('2008-05-31 12:00:00')),
  626. '/pubDate',
  627. '<guid',
  628. 'http://www.example.com/1',
  629. '/guid',
  630. 'category' => ['domain' => 'http://www.cakephp.org'],
  631. '<![CDATA[CakePHP]]',
  632. '/category',
  633. '<category',
  634. '<![CDATA[Bakery]]',
  635. '/category',
  636. '/item'
  637. ];
  638. if ($type === null) {
  639. unset($expected['enclosure']['type']);
  640. }
  641. $this->assertHtml($expected, $result);
  642. $File->delete();
  643. if (!$testExists) {
  644. $Folder = new Folder(WWW_ROOT . 'tests');
  645. $Folder->delete();
  646. }
  647. }
  648. /**
  649. * testElementAttrNotInParent method
  650. *
  651. * @return void
  652. */
  653. public function testElementAttrNotInParent()
  654. {
  655. $attributes = [
  656. 'title' => 'Some Title',
  657. 'link' => 'http://link.com',
  658. 'description' => 'description'
  659. ];
  660. $elements = ['enclosure' => ['url' => 'http://test.com']];
  661. $result = $this->Rss->item($attributes, $elements);
  662. $expected = [
  663. 'item' => [
  664. 'title' => 'Some Title',
  665. 'link' => 'http://link.com',
  666. 'description' => 'description'
  667. ],
  668. 'enclosure' => [
  669. 'url' => 'http://test.com'
  670. ],
  671. '/item'
  672. ];
  673. $this->assertHtml($expected, $result);
  674. }
  675. public function testElementNamespaceWithoutPrefix()
  676. {
  677. $item = [
  678. 'creator' => 'Alex',
  679. ];
  680. $attributes = [
  681. 'namespace' => 'http://link.com'
  682. ];
  683. $result = $this->Rss->item($attributes, $item);
  684. $expected = [
  685. 'item' => [
  686. 'xmlns' => 'http://link.com'
  687. ],
  688. 'creator' => [
  689. 'xmlns' => 'http://link.com'
  690. ],
  691. 'Alex',
  692. '/creator',
  693. '/item'
  694. ];
  695. $this->assertHtml($expected, $result, true);
  696. }
  697. public function testElementNamespaceWithPrefix()
  698. {
  699. $item = [
  700. 'title' => 'Title',
  701. 'dc:creator' => 'Alex',
  702. 'dc:description' => 'descriptive words'
  703. ];
  704. $attributes = [
  705. 'namespace' => [
  706. 'prefix' => 'dc',
  707. 'url' => 'http://link.com'
  708. ]
  709. ];
  710. $result = $this->Rss->item($attributes, $item);
  711. $expected = [
  712. 'item' => [
  713. 'xmlns:dc' => 'http://link.com'
  714. ],
  715. 'title' => [
  716. 'xmlns:dc' => 'http://link.com'
  717. ],
  718. 'Title',
  719. '/title',
  720. 'dc:creator' => [
  721. 'xmlns:dc' => 'http://link.com'
  722. ],
  723. 'Alex',
  724. '/dc:creator',
  725. 'dc:description' => [
  726. 'xmlns:dc' => 'http://link.com'
  727. ],
  728. 'descriptive words',
  729. '/dc:description',
  730. '/item'
  731. ];
  732. $this->assertHtml($expected, $result, true);
  733. }
  734. }