Merge branch 'master' into 2.5

This commit is contained in:
mark_story 2014-03-23 11:01:13 -04:00
commit 57b8008dbe
2 changed files with 11 additions and 7 deletions

View file

@ -516,7 +516,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
protected function _assertAttributes($assertions, $string) {
$asserts = $assertions['attrs'];
$explains = $assertions['explains'];
while (count($asserts) > 0) {
$len = count($asserts);
do {
$matches = false;
foreach ($asserts as $j => $assert) {
if (preg_match(sprintf('/^%s/s', $assert), $string, $match)) {
@ -530,7 +531,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
if ($matches === false) {
$this->assertTrue(false, 'Attribute did not match. Was expecting ' . $explains[$j]);
}
}
$len = count($asserts);
} while ($len > 0);
return $string;
}

View file

@ -713,14 +713,15 @@ class HtmlHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#creating-breadcrumb-trails-with-htmlhelper
*/
public function getCrumbList($options = array(), $startText = false) {
$defaults = array('firstClass' => 'first', 'lastClass' => 'last', 'separator' => '');
$defaults = array('firstClass' => 'first', 'lastClass' => 'last', 'separator' => '', 'escape' => true);
$options = array_merge($defaults, (array)$options);
$firstClass = $options['firstClass'];
$lastClass = $options['lastClass'];
$separator = $options['separator'];
unset($options['firstClass'], $options['lastClass'], $options['separator']);
$escape = $options['escape'];
unset($options['firstClass'], $options['lastClass'], $options['separator'], $options['escape']);
$crumbs = $this->_prepareCrumbs($startText);
$crumbs = $this->_prepareCrumbs($startText, $escape);
if (empty($crumbs)) {
return null;
}
@ -752,9 +753,10 @@ class HtmlHelper extends AppHelper {
* Prepends startText to crumbs array if set
*
* @param string $startText Text to prepend
* @param boolean $escape If the output should be escaped or not
* @return array Crumb list including startText (if provided)
*/
protected function _prepareCrumbs($startText) {
protected function _prepareCrumbs($startText, $escape = true) {
$crumbs = $this->_crumbs;
if ($startText) {
if (!is_array($startText)) {
@ -766,7 +768,7 @@ class HtmlHelper extends AppHelper {
$startText += array('url' => '/', 'text' => __d('cake', 'Home'));
list($url, $text) = array($startText['url'], $startText['text']);
unset($startText['url'], $startText['text']);
array_unshift($crumbs, array($text, $url, $startText));
array_unshift($crumbs, array($text, $url, $startText + array('escape' => $escape)));
}
return $crumbs;
}