Merge pull request #1699 from dereuromark/2.5-page-title

2.5 page title
This commit is contained in:
Mark Story 2013-10-04 05:18:22 -07:00
commit 7df9925618
4 changed files with 5 additions and 42 deletions

View file

@ -605,7 +605,6 @@ class ControllerTest extends CakeTestCase {
$Controller->set('title', 'someTitle'); $Controller->set('title', 'someTitle');
$this->assertSame($Controller->viewVars['title'], 'someTitle'); $this->assertSame($Controller->viewVars['title'], 'someTitle');
$this->assertTrue(empty($Controller->pageTitle));
$Controller->viewVars = array(); $Controller->viewVars = array();
$expected = array('ModelName' => 'name', 'ModelName2' => 'name2'); $expected = array('ModelName' => 'name', 'ModelName2' => 'name2');

View file

@ -93,7 +93,7 @@ class RssHelperTest extends CakeTestCase {
*/ */
public function testChannel() { public function testChannel() {
$attrib = array('a' => '1', 'b' => '2'); $attrib = array('a' => '1', 'b' => '2');
$elements = array('title' => 'title'); $elements = array('title' => 'Title');
$content = 'content'; $content = 'content';
$result = $this->Rss->channel($attrib, $elements, $content); $result = $this->Rss->channel($attrib, $elements, $content);
@ -103,30 +103,7 @@ class RssHelperTest extends CakeTestCase {
'b' => '2' 'b' => '2'
), ),
'<title', '<title',
'title', 'Title',
'/title',
'<link',
$this->Rss->url('/', true),
'/link',
'<description',
'content',
'/channel'
);
$this->assertTags($result, $expected);
$this->View->pageTitle = 'title';
$attrib = array('a' => '1', 'b' => '2');
$elements = array();
$content = 'content';
$result = $this->Rss->channel($attrib, $elements, $content);
$expected = array(
'channel' => array(
'a' => '1',
'b' => '2'
),
'<title',
'title',
'/title', '/title',
'<link', '<link',
$this->Rss->url('/', true), $this->Rss->url('/', true),

View file

@ -1610,19 +1610,6 @@ TEXT;
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
} }
/**
* Test that setting arbitrary properties still works.
*
* @return void
*/
public function testPropertySetting() {
$this->assertFalse(isset($this->View->pageTitle));
$this->View->pageTitle = 'test';
$this->assertTrue(isset($this->View->pageTitle));
$this->assertTrue(!empty($this->View->pageTitle));
$this->assertEquals('test', $this->View->pageTitle);
}
/** /**
* Test that setting arbitrary properties still works. * Test that setting arbitrary properties still works.
* *

View file

@ -123,12 +123,12 @@ class RssHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/rss.html#RssHelper::channel * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/rss.html#RssHelper::channel
*/ */
public function channel($attrib = array(), $elements = array(), $content = null) { public function channel($attrib = array(), $elements = array(), $content = null) {
if (!isset($elements['title']) && !empty($this->_View->pageTitle)) {
$elements['title'] = $this->_View->pageTitle;
}
if (!isset($elements['link'])) { if (!isset($elements['link'])) {
$elements['link'] = '/'; $elements['link'] = '/';
} }
if (!isset($elements['title'])) {
$elements['title'] = '';
}
if (!isset($elements['description'])) { if (!isset($elements['description'])) {
$elements['description'] = ''; $elements['description'] = '';
} }