Browse Source

Merge remote-tracking branch 'origin/2.5' into 3.0

Conflicts:
	Cake/Test/TestCase/View/ViewTest.php
	lib/Cake/Test/Case/Controller/ControllerTest.php
mark_story 12 years ago
parent
commit
3d03d5b0f7

+ 15 - 2
Cake/Test/TestCase/Utility/FolderTest.php

@@ -318,11 +318,24 @@ class FolderTest extends TestCase {
  * @return void
  */
 	public function testAddPathElement() {
+		$expected = DS . 'some' . DS . 'dir' . DS . 'another_path';
+
 		$result = Folder::addPathElement(DS . 'some' . DS . 'dir', 'another_path');
-		$this->assertEquals(DS . 'some' . DS . 'dir' . DS . 'another_path', $result);
+		$this->assertEquals($expected, $result);
 
 		$result = Folder::addPathElement(DS . 'some' . DS . 'dir' . DS, 'another_path');
-		$this->assertEquals(DS . 'some' . DS . 'dir' . DS . 'another_path', $result);
+		$this->assertEquals($expected, $result);
+
+		$result = Folder::addPathElement(DS . 'some' . DS . 'dir', array('another_path'));
+		$this->assertEquals($expected, $result);
+
+		$result = Folder::addPathElement(DS . 'some' . DS . 'dir' . DS, array('another_path'));
+		$this->assertEquals($expected, $result);
+
+		$expected = DS . 'some' . DS . 'dir' . DS . 'another_path' . DS . 'and' . DS . 'another';
+
+		$result = Folder::addPathElement(DS . 'some' . DS . 'dir', array('another_path', 'and', 'another'));
+		$this->assertEquals($expected, $result);
 	}
 
 /**

+ 2 - 25
Cake/Test/TestCase/View/Helper/RssHelperTest.php

@@ -94,7 +94,7 @@ class RssHelperTest extends TestCase {
  */
 	public function testChannel() {
 		$attrib = array('a' => '1', 'b' => '2');
-		$elements = array('title' => 'title');
+		$elements = array('title' => 'Title');
 		$content = 'content';
 
 		$result = $this->Rss->channel($attrib, $elements, $content);
@@ -104,30 +104,7 @@ class RssHelperTest extends TestCase {
 				'b' => '2'
 			),
 			'<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',
 			$this->Rss->url('/', true),

+ 6 - 6
Cake/Test/TestCase/View/ViewTest.php

@@ -1576,12 +1576,12 @@ TEXT;
  *
  * @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);
+	public function testPropertySettingMagicGet() {
+		$this->assertFalse(isset($this->View->action));
+		$this->View->request->params['action'] = 'login';
+		$this->assertEquals('login', $this->View->action);
+		$this->assertTrue(isset($this->View->action));
+		$this->assertTrue(!empty($this->View->action));
 	}
 
 /**

+ 4 - 2
Cake/Utility/Folder.php

@@ -320,12 +320,14 @@ class Folder {
  * Returns $path with $element added, with correct slash in-between.
  *
  * @param string $path Path
- * @param string $element Element to and at end of path
+ * @param string|array $element Element to add at end of path
  * @return string Combined path
  * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::addPathElement
  */
 	public static function addPathElement($path, $element) {
-		return rtrim($path, DS) . DS . $element;
+		$element = (array)$element;
+		array_unshift($element, rtrim($path, DS));
+		return implode(DS, $element);
 	}
 
 /**

+ 3 - 3
Cake/View/Helper/RssHelper.php

@@ -122,12 +122,12 @@ class RssHelper extends Helper {
  * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/rss.html#RssHelper::channel
  */
 	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'])) {
 			$elements['link'] = '/';
 		}
+		if (!isset($elements['title'])) {
+			$elements['title'] = '';
+		}
 		if (!isset($elements['description'])) {
 			$elements['description'] = '';
 		}