mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Merge branch '2.1' into 2.2
This commit is contained in:
commit
46bce1a00f
6 changed files with 37 additions and 19 deletions
|
@ -305,11 +305,11 @@ class Scaffold {
|
|||
throw new NotFoundException(__d('cake', 'Invalid %s', Inflector::humanize($this->modelClass)));
|
||||
}
|
||||
if ($this->ScaffoldModel->delete()) {
|
||||
$message = __d('cake', 'The %1$s with id: %2$d has been deleted.', Inflector::humanize($this->modelClass), $id);
|
||||
$message = __d('cake', 'The %1$s with id: %2$s has been deleted.', Inflector::humanize($this->modelClass), $id);
|
||||
return $this->_sendMessage($message);
|
||||
} else {
|
||||
$message = __d('cake',
|
||||
'There was an error deleting the %1$s with id: %2$d',
|
||||
'There was an error deleting the %1$s with id: %2$s',
|
||||
Inflector::humanize($this->modelClass),
|
||||
$id
|
||||
);
|
||||
|
|
|
@ -478,8 +478,11 @@ class CakeRoute {
|
|||
* @return string Composed route string.
|
||||
*/
|
||||
protected function _writeUrl($params) {
|
||||
if (isset($params['prefix'], $params['action'])) {
|
||||
$params['action'] = str_replace($params['prefix'] . '_', '', $params['action']);
|
||||
if (isset($params['prefix'])) {
|
||||
$prefixed = $params['prefix'] . '_';
|
||||
}
|
||||
if (isset($prefixed, $params['action']) && strpos($params['action'], $prefixed) === 0) {
|
||||
$params['action'] = substr($params['action'], strlen($prefixed) * -1);
|
||||
unset($params['prefix']);
|
||||
}
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ class Router {
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $_routeClass = 'CakeRoute';
|
||||
protected static $_routeClass = 'CakeRoute';
|
||||
|
||||
/**
|
||||
* Set the default route class to use or return the current one
|
||||
|
@ -893,8 +893,9 @@ class Router {
|
|||
|
||||
list($args, $named) = array(Hash::filter($args), Hash::filter($named));
|
||||
foreach (self::$_prefixes as $prefix) {
|
||||
if (!empty($url[$prefix])) {
|
||||
$url['action'] = str_replace($prefix . '_', '', $url['action']);
|
||||
$prefixed = $prefix . '_';
|
||||
if (!empty($url[$prefix]) && strpos($url['action'], $prefixed) === 0) {
|
||||
$url['action'] = substr($url['action'], strlen($prefixed) * -1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3304,8 +3304,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$expected = array(
|
||||
'Article' => true,
|
||||
'Comment' => array(
|
||||
true,
|
||||
true
|
||||
true,
|
||||
true
|
||||
)
|
||||
);
|
||||
$this->assertSame($expected, $result);
|
||||
|
@ -3323,8 +3323,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$expected = array(
|
||||
'Article' => true,
|
||||
'Comment' => array(
|
||||
false,
|
||||
true
|
||||
false,
|
||||
true
|
||||
)
|
||||
);
|
||||
$this->assertSame($expected, $result);
|
||||
|
@ -3363,8 +3363,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$expected = array(
|
||||
'Article' => true,
|
||||
'Comment' => array(
|
||||
true,
|
||||
true
|
||||
true,
|
||||
true
|
||||
)
|
||||
);
|
||||
$this->assertSame($expected, $result);
|
||||
|
@ -3381,8 +3381,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$expected = array(
|
||||
'Article' => true,
|
||||
'Comment' => array(
|
||||
true,
|
||||
false
|
||||
true,
|
||||
false
|
||||
)
|
||||
);
|
||||
$this->assertSame($expected, $result);
|
||||
|
@ -3730,8 +3730,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$expected = array(
|
||||
'Article' => true,
|
||||
'Comment' => array(
|
||||
true,
|
||||
true
|
||||
true,
|
||||
true
|
||||
)
|
||||
);
|
||||
$this->assertSame($expected, $result);
|
||||
|
@ -3759,8 +3759,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$expected = array(
|
||||
'Article' => true,
|
||||
'Comment' => array(
|
||||
true,
|
||||
true
|
||||
true,
|
||||
true
|
||||
)
|
||||
);
|
||||
$this->assertSame($expected, $result);
|
||||
|
|
|
@ -299,6 +299,16 @@ class CakeRouteTest extends CakeTestCase {
|
|||
$result = $route->match($url);
|
||||
$expected = '/admin/subscriptions/edit/1';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$url = array(
|
||||
'controller' => 'subscribe',
|
||||
'admin' => true,
|
||||
'action' => 'edit_admin_e',
|
||||
1
|
||||
);
|
||||
$result = $route->match($url);
|
||||
$expected = '/admin/subscriptions/edit_admin_e/1';
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1582,6 +1582,10 @@ class RouterTest extends CakeTestCase {
|
|||
$expected = '/protected/images/add';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Router::url(array('controller' => 'images', 'action' => 'add_protected_test', 'protected' => true));
|
||||
$expected = '/protected/images/add_protected_test';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = Router::url(array('action' => 'edit', 1));
|
||||
$expected = '/images/edit/1';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
|
Loading…
Add table
Reference in a new issue