mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Merge branch '2.0' into 2.1
This commit is contained in:
commit
7d51db9e63
6 changed files with 90 additions and 12 deletions
|
@ -276,7 +276,10 @@ class TestTask extends BakeTask {
|
|||
if (strtolower($type) == 'model' || empty($this->classTypes[$type])) {
|
||||
return $class;
|
||||
}
|
||||
if (strlen($class) - strpos($class, $type) == strlen($type)) {
|
||||
|
||||
$position = strpos($class, $type);
|
||||
|
||||
if ($position !== false && strlen($class) - $position == strlen($type)) {
|
||||
return $class;
|
||||
}
|
||||
return $class . $type;
|
||||
|
|
|
@ -191,7 +191,7 @@ class UpgradeShell extends AppShell {
|
|||
$defaultOptions = array(
|
||||
'recursive' => true,
|
||||
'checkFolder' => true,
|
||||
'regex' => '@class (\S*) .*{@i'
|
||||
'regex' => '@class (\S*) .*(\s|\v)*{@i'
|
||||
);
|
||||
foreach ($sourceDirs as $dir => $options) {
|
||||
if (is_numeric($dir)) {
|
||||
|
|
|
@ -403,6 +403,9 @@ class TestTaskTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Task->getRealClassname('Controller', 'PostsController');
|
||||
$this->assertEquals('PostsController', $result);
|
||||
|
||||
$result = $this->Task->getRealClassname('Controller', 'AlertTypes');
|
||||
$this->assertEquals('AlertTypesController', $result);
|
||||
|
||||
$result = $this->Task->getRealClassname('Helper', 'Form');
|
||||
$this->assertEquals('FormHelper', $result);
|
||||
|
|
|
@ -661,11 +661,12 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
|
||||
$this->Paginator->request->params['pass'] = array(2);
|
||||
$this->Paginator->request->params['named'] = array('foo' => 'bar');
|
||||
$this->Paginator->request->query = array('x' => 'y');
|
||||
$this->Paginator->beforeRender('posts/index');
|
||||
|
||||
$result = $this->Paginator->sort('title');
|
||||
$expected = array(
|
||||
'a' => array('href' => '/articles/index/2/page:1/foo:bar/sort:title/direction:asc'),
|
||||
'a' => array('href' => '/articles/index/2/page:1/foo:bar/sort:title/direction:asc?x=y'),
|
||||
'Title',
|
||||
'/a'
|
||||
);
|
||||
|
@ -675,24 +676,91 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
$expected = array(
|
||||
array('span' => array('class' => 'current')), '1', '/span',
|
||||
' | ',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:2/foo:bar')), '2', '/a', '/span',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:2/foo:bar?x=y')), '2', '/a', '/span',
|
||||
' | ',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:3/foo:bar')), '3', '/a', '/span',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:3/foo:bar?x=y')), '3', '/a', '/span',
|
||||
' | ',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:4/foo:bar')), '4', '/a', '/span',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:4/foo:bar?x=y')), '4', '/a', '/span',
|
||||
' | ',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:5/foo:bar')), '5', '/a', '/span',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:5/foo:bar?x=y')), '5', '/a', '/span',
|
||||
' | ',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:6/foo:bar')), '6', '/a', '/span',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:6/foo:bar?x=y')), '6', '/a', '/span',
|
||||
' | ',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:7/foo:bar')), '7', '/a', '/span',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:7/foo:bar?x=y')), '7', '/a', '/span',
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Paginator->next('Next');
|
||||
$expected = array(
|
||||
'span' => array('class' => 'next'),
|
||||
'a' => array('href' => '/articles/index/2/page:2/foo:bar', 'rel' => 'next'),
|
||||
'a' => array('href' => '/articles/index/2/page:2/foo:bar?x=y', 'rel' => 'next'),
|
||||
'Next',
|
||||
'/a',
|
||||
'/span'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testPassedArgsMergingWithUrlOptionsParamTypeQuerystring method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPassedArgsMergingWithUrlOptionsParamTypeQuerystring() {
|
||||
Router::reload();
|
||||
Router::parse('/');
|
||||
Router::setRequestInfo(array(
|
||||
array('plugin' => null, 'controller' => 'articles', 'action' => 'index', 'pass' => array('2'), 'named' => array('foo' => 'bar'), 'url' => array('url' => 'articles/index/2/foo:bar')),
|
||||
array('base' => '/', 'here' => '/articles/', 'webroot' => '/')
|
||||
));
|
||||
$this->Paginator->request->params['paging'] = array(
|
||||
'Article' => array(
|
||||
'page' => 1, 'current' => 3, 'count' => 13,
|
||||
'prevPage' => false, 'nextPage' => true, 'pageCount' => 8,
|
||||
'options' => array(
|
||||
'page' => 1,
|
||||
'order' => array(),
|
||||
'conditions' => array()
|
||||
),
|
||||
'paramType' => 'querystring'
|
||||
)
|
||||
);
|
||||
|
||||
$this->Paginator->request->params['pass'] = array(2);
|
||||
$this->Paginator->request->params['named'] = array('foo' => 'bar');
|
||||
$this->Paginator->request->query = array('x' => 'y');
|
||||
$this->Paginator->beforeRender('posts/index');
|
||||
|
||||
$result = $this->Paginator->sort('title');
|
||||
$expected = array(
|
||||
'a' => array('href' => '/articles/index/2/foo:bar?x=y&page=1&sort=title&direction=asc'),
|
||||
'Title',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Paginator->numbers();
|
||||
$expected = array(
|
||||
array('span' => array('class' => 'current')), '1', '/span',
|
||||
' | ',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/foo:bar?x=y&page=2')), '2', '/a', '/span',
|
||||
' | ',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/foo:bar?x=y&page=3')), '3', '/a', '/span',
|
||||
' | ',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/foo:bar?x=y&page=4')), '4', '/a', '/span',
|
||||
' | ',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/foo:bar?x=y&page=5')), '5', '/a', '/span',
|
||||
' | ',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/foo:bar?x=y&page=6')), '6', '/a', '/span',
|
||||
' | ',
|
||||
array('span' => array()), array('a' => array('href' => '/articles/index/2/foo:bar?x=y&page=7')), '7', '/a', '/span',
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Paginator->next('Next');
|
||||
$expected = array(
|
||||
'span' => array('class' => 'next'),
|
||||
'a' => array('href' => '/articles/index/2/foo:bar?x=y&page=2', 'rel' => 'next'),
|
||||
'Next',
|
||||
'/a',
|
||||
'/span'
|
||||
|
|
|
@ -319,8 +319,9 @@ class Set {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements partial support for XPath 2.0. If $path is an array or $data is empty it the call
|
||||
* is delegated to Set::classicExtract.
|
||||
* Implements partial support for XPath 2.0. If $path does not contain a '/' the call
|
||||
* is delegated to Set::classicExtract(). Also the $path and $data arguments are
|
||||
* reversible.
|
||||
*
|
||||
* #### Currently implemented selectors:
|
||||
*
|
||||
|
|
|
@ -109,6 +109,9 @@ class PaginatorHelper extends AppHelper {
|
|||
*/
|
||||
public function beforeRender($viewFile) {
|
||||
$this->options['url'] = array_merge($this->request->params['pass'], $this->request->params['named']);
|
||||
if (!empty($this->request->query)) {
|
||||
$this->options['url']['?'] = $this->request->query;
|
||||
}
|
||||
parent::beforeRender($viewFile);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue