RssHelperTest.php 23 KB

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