mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Adding $data['attrib'] back to RssHelper::channel(); after more research use cases for this were found.
Related test case added git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7889 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
2444b29cd5
commit
69f883a89f
2 changed files with 44 additions and 1 deletions
|
@ -142,6 +142,9 @@ class RssHelper extends XmlHelper {
|
|||
if (strtolower($elem) == 'cloud') {
|
||||
$attributes = $data;
|
||||
$data = array();
|
||||
} elseif (isset($data['attrib']) && is_array($data['attrib'])) {
|
||||
$attributes = $data['attrib'];
|
||||
unset($data['attrib']);
|
||||
} else {
|
||||
$innerElements = '';
|
||||
foreach ($data as $subElement => $value) {
|
||||
|
|
|
@ -221,6 +221,46 @@ class RssTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
function testChannelElementAttributes() {
|
||||
$attrib = array();
|
||||
$elements = array(
|
||||
'title' => 'Title of RSS Feed',
|
||||
'link' => 'http://example.com',
|
||||
'description' => 'Description of RSS Feed',
|
||||
'image' => array(
|
||||
'title' => 'Title of image',
|
||||
'url' => 'http://example.com/example.png',
|
||||
'link' => 'http://example.com'
|
||||
),
|
||||
'atom:link' => array(
|
||||
'attrib' => array(
|
||||
'href' => 'http://www.example.com/rss.xml',
|
||||
'rel' => 'self',
|
||||
'type' => 'application/rss+xml')
|
||||
)
|
||||
);
|
||||
$content = 'content-here';
|
||||
$result = $this->Rss->channel($attrib, $elements, $content);
|
||||
$expected = array(
|
||||
'<channel',
|
||||
'<title', 'Title of RSS Feed', '/title',
|
||||
'<link', 'http://example.com', '/link',
|
||||
'<description', 'Description of RSS Feed', '/description',
|
||||
'<image',
|
||||
'<title', 'Title of image', '/title',
|
||||
'<url', 'http://example.com/example.png', '/url',
|
||||
'<link', 'http://example.com', '/link',
|
||||
'/image',
|
||||
'atom:link' => array(
|
||||
'href' => "http://www.example.com/rss.xml",
|
||||
'rel' => "self",
|
||||
'type' =>"application/rss+xml"
|
||||
),
|
||||
'content-here',
|
||||
'/channel',
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
/**
|
||||
* testItems method
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue