Issues (4141)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

lib/Cake/Test/Case/View/Helper/RssHelperTest.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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
 * @package       Cake.Test.Case.View.Helper
15
 * @since         CakePHP(tm) v 1.2.0.4206
16
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
17
 */
18
19
App::uses('View', 'View');
20
App::uses('RssHelper', 'View/Helper');
21
App::uses('TimeHelper', 'View/Helper');
22
App::uses('File', 'Utility');
23
24
/**
25
 * RssHelperTest class
26
 *
27
 * @package       Cake.Test.Case.View.Helper
28
 */
29
class RssHelperTest extends CakeTestCase {
30
31
/**
32
 * setUp method
33
 *
34
 * @return void
35
 */
36
	public function setUp() {
37
		parent::setUp();
38
		$controller = null;
39
		$this->View = new View($controller);
40
		$this->Rss = new RssHelper($this->View);
41
	}
42
43
/**
44
 * tearDown method
45
 *
46
 * @return void
47
 */
48
	public function tearDown() {
49
		parent::tearDown();
50
		unset($this->Rss);
51
	}
52
53
/**
54
 * testDocument method
55
 *
56
 * @return void
57
 */
58
	public function testDocument() {
59
		$result = $this->Rss->document();
60
		$expected = array(
61
			'rss' => array(
62
				'version' => '2.0'
63
			)
64
		);
65
		$this->assertTags($result, $expected);
66
67
		$result = $this->Rss->document(null, 'content');
68
		$expected = array(
69
			'rss' => array(
70
				'version' => '2.0'
71
			),
72
			'content'
73
		);
74
		$this->assertTags($result, $expected);
75
76
		$result = $this->Rss->document(array('contrived' => 'parameter'), 'content');
77
		$expected = array(
78
			'rss' => array(
79
				'contrived' => 'parameter',
80
				'version' => '2.0'
81
			),
82
			'content'
83
		);
84
		$this->assertTags($result, $expected);
85
	}
86
87
/**
88
 * testChannel method
89
 *
90
 * @return void
91
 */
92
	public function testChannel() {
93
		$attrib = array('a' => '1', 'b' => '2');
94
		$elements = array('title' => 'title');
95
		$content = 'content';
96
97
		$result = $this->Rss->channel($attrib, $elements, $content);
98
		$expected = array(
99
			'channel' => array(
100
				'a' => '1',
101
				'b' => '2'
102
			),
103
			'<title',
104
			'title',
105
			'/title',
106
			'<link',
107
			$this->Rss->url('/', true),
108
			'/link',
109
			'<description',
110
			'content',
111
			'/channel'
112
		);
113
		$this->assertTags($result, $expected);
114
115
		$this->View->pageTitle = 'title';
116
		$attrib = array('a' => '1', 'b' => '2');
117
		$elements = array();
118
		$content = 'content';
119
120
		$result = $this->Rss->channel($attrib, $elements, $content);
121
		$expected = array(
122
			'channel' => array(
123
				'a' => '1',
124
				'b' => '2'
125
			),
126
			'<title',
127
			'title',
128
			'/title',
129
			'<link',
130
			$this->Rss->url('/', true),
131
			'/link',
132
			'<description',
133
			'content',
134
			'/channel'
135
		);
136
		$this->assertTags($result, $expected);
137
	}
138
139
/**
140
 * test correct creation of channel sub elements.
141
 *
142
 * @return void
143
 */
144
	public function testChannelElements() {
145
		$attrib = array();
146
		$elements = array(
147
			'title' => 'Title of RSS Feed',
148
			'link' => 'http://example.com',
149
			'description' => 'Description of RSS Feed',
150
			'image' => array(
151
				'title' => 'Title of image',
152
				'url' => 'http://example.com/example.png',
153
				'link' => 'http://example.com'
154
			),
155
			'cloud' => array(
156
				'domain' => "rpc.sys.com",
157
				'port' => "80",
158
				'path' => "/RPC2",
159
				'registerProcedure' => "myCloud.rssPleaseNotify",
160
				'protocol' => "xml-rpc"
161
			)
162
		);
163
		$content = 'content-here';
164
		$result = $this->Rss->channel($attrib, $elements, $content);
165
		$expected = array(
166
			'<channel',
167
				'<title', 'Title of RSS Feed', '/title',
168
				'<link', 'http://example.com', '/link',
169
				'<description', 'Description of RSS Feed', '/description',
170
				'<image',
171
					'<title', 'Title of image', '/title',
172
					'<url', 'http://example.com/example.png', '/url',
173
					'<link', 'http://example.com', '/link',
174
				'/image',
175
				'cloud' => array(
176
					'domain' => "rpc.sys.com",
177
					'port' => "80",
178
					'path' => "/RPC2",
179
					'registerProcedure' => "myCloud.rssPleaseNotify",
180
					'protocol' => "xml-rpc"
181
				),
182
			'content-here',
183
			'/channel',
184
		);
185
		$this->assertTags($result, $expected);
186
	}
187
188
	public function testChannelElementAttributes() {
189
		$attrib = array();
190
		$elements = array(
191
			'title' => 'Title of RSS Feed',
192
			'link' => 'http://example.com',
193
			'description' => 'Description of RSS Feed',
194
			'image' => array(
195
				'title' => 'Title of image',
196
				'url' => 'http://example.com/example.png',
197
				'link' => 'http://example.com'
198
			),
199
			'atom:link' => array(
200
				'attrib' => array(
201
					'href' => 'http://www.example.com/rss.xml',
202
					'rel' => 'self',
203
					'type' => 'application/rss+xml')
204
			)
205
		);
206
		$content = 'content-here';
207
		$result = $this->Rss->channel($attrib, $elements, $content);
208
		$expected = array(
209
			'<channel',
210
				'<title', 'Title of RSS Feed', '/title',
211
				'<link', 'http://example.com', '/link',
212
				'<description', 'Description of RSS Feed', '/description',
213
				'<image',
214
					'<title', 'Title of image', '/title',
215
					'<url', 'http://example.com/example.png', '/url',
216
					'<link', 'http://example.com', '/link',
217
				'/image',
218
				'atom:link' => array(
219
					'xmlns:atom' => 'http://www.w3.org/2005/Atom',
220
					'href' => "http://www.example.com/rss.xml",
221
					'rel' => "self",
222
					'type' => "application/rss+xml"
223
				),
224
			'content-here',
225
			'/channel',
226
		);
227
		$this->assertTags($result, $expected);
228
	}
229
230
/**
231
 * testItems method
232
 *
233
 * @return void
234
 */
235
	public function testItems() {
236
		$items = array(
237
			array('title' => 'title1', 'guid' => 'http://www.example.com/guid1', 'link' => 'http://www.example.com/link1', 'description' => 'description1'),
238
			array('title' => 'title2', 'guid' => 'http://www.example.com/guid2', 'link' => 'http://www.example.com/link2', 'description' => 'description2'),
239
			array('title' => 'title3', 'guid' => 'http://www.example.com/guid3', 'link' => 'http://www.example.com/link3', 'description' => 'description3')
240
		);
241
242
		$result = $this->Rss->items($items);
243
		$expected = array(
244
			'<item',
245
				'<title', 'title1', '/title',
246
				'<guid', 'http://www.example.com/guid1', '/guid',
247
				'<link', 'http://www.example.com/link1', '/link',
248
				'<description', 'description1', '/description',
249
			'/item',
250
			'<item',
251
				'<title', 'title2', '/title',
252
				'<guid', 'http://www.example.com/guid2', '/guid',
253
				'<link', 'http://www.example.com/link2', '/link',
254
				'<description', 'description2', '/description',
255
			'/item',
256
			'<item',
257
				'<title', 'title3', '/title',
258
				'<guid', 'http://www.example.com/guid3', '/guid',
259
				'<link', 'http://www.example.com/link3', '/link',
260
				'<description', 'description3', '/description',
261
			'/item'
262
		);
263
		$this->assertTags($result, $expected);
264
265
		$items = array(
266
			array('title' => 'title1', 'guid' => 'http://www.example.com/guid1', 'link' => 'http://www.example.com/link1', 'description' => 'description1'),
267
			array('title' => 'title2', 'guid' => 'http://www.example.com/guid2', 'link' => 'http://www.example.com/link2', 'description' => 'description2'),
268
			array('title' => 'title3', 'guid' => 'http://www.example.com/guid3', 'link' => 'http://www.example.com/link3', 'description' => 'description3')
269
		);
270
271
		$result = $this->Rss->items($items, create_function('$v', '$v[\'title\'] = $v[\'title\'] . \'-transformed\'; return $v;'));
0 ignored issues
show
Security Best Practice introduced by
The use of create_function is highly discouraged, better use a closure.

create_function can pose a great security vulnerability as it is similar to eval, and could be used for arbitrary code execution. We highly recommend to use a closure instead.

// Instead of
$function = create_function('$a, $b', 'return $a + $b');

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