mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Merge pull request #1699 from dereuromark/2.5-page-title
2.5 page title
This commit is contained in:
commit
7df9925618
4 changed files with 5 additions and 42 deletions
|
@ -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');
|
||||||
|
|
|
@ -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),
|
||||||
|
|
|
@ -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.
|
||||||
*
|
*
|
||||||
|
|
|
@ -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'] = '';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue