mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge remote branch 'origin/2.0' into 2.0-class-loading
Temporarly commenting code on App class while the transition is made Conflicts: lib/Cake/Core/App.php
This commit is contained in:
commit
e8a93aef93
10 changed files with 137 additions and 52 deletions
|
@ -411,6 +411,11 @@ class App {
|
|||
*
|
||||
* `App::objects('plugin');` returns `array('DebugKit', 'Blog', 'User');`
|
||||
*
|
||||
* You can also search only within a plugin's objects by using the plugin dot
|
||||
* syntax (these objects are not cached):
|
||||
*
|
||||
* `App::objects('MyPlugin.model');` returns `array('Post', 'Comment');`
|
||||
*
|
||||
* @param string $type Type of object, i.e. 'model', 'controller', 'helper', or 'plugin'
|
||||
* @param mixed $path Optional Scan only the path given. If null, paths for the chosen
|
||||
* type will be used.
|
||||
|
@ -434,6 +439,22 @@ class App {
|
|||
if ($type == 'plugins') {
|
||||
$extension = '/.*/';
|
||||
$includeDirectories = true;
|
||||
|
||||
/* $extension = false;
|
||||
list($plugin, $type) = pluginSplit($type);
|
||||
$name = $type;
|
||||
|
||||
if ($plugin) {
|
||||
$path = Inflector::pluralize($type);
|
||||
if ($path == 'helpers') {
|
||||
$path = 'views' . DS .$path;
|
||||
} elseif ($path == 'behaviors') {
|
||||
$path = 'models' . DS .$path;
|
||||
} elseif ($path == 'components') {
|
||||
$path = 'controllers' . DS .$path;
|
||||
}
|
||||
$path = self::pluginPath($plugin) . $path;
|
||||
$cache = false; */
|
||||
}
|
||||
|
||||
if ($type === 'file' && !$path) {
|
||||
|
@ -475,6 +496,9 @@ class App {
|
|||
if ($cache === true) {
|
||||
self::$__cache = true;
|
||||
}
|
||||
if ($plugin) {
|
||||
return $objects;
|
||||
}
|
||||
self::$__objects[$name] = $objects;
|
||||
self::$_objectCacheChange = true;
|
||||
}
|
||||
|
|
|
@ -150,14 +150,14 @@ class Mysql extends DboSource {
|
|||
$flags[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES ' . $config['encoding'];
|
||||
}
|
||||
$this->_connection = new PDO(
|
||||
"mysql:{$config['host']};port={$config['port']};dbname={$config['database']}",
|
||||
"mysql:host={$config['host']};port={$config['port']};dbname={$config['database']}",
|
||||
$config['login'],
|
||||
$config['password'],
|
||||
$flags
|
||||
);
|
||||
$this->connected = true;
|
||||
} catch (PDOException $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
throw new MissingConnectionException(array('class' => $e->getMessage()));
|
||||
}
|
||||
|
||||
$this->_useAlias = (bool)version_compare($this->getVersion(), "4.1", ">=");
|
||||
|
@ -240,7 +240,7 @@ class Mysql extends DboSource {
|
|||
foreach ($this->map as $col => $meta) {
|
||||
list($table, $column, $type) = $meta;
|
||||
$resultRow[$table][$column] = $row[$col];
|
||||
if ($type == 'boolean') {
|
||||
if ($type == 'boolean' && !is_null($row[$col])) {
|
||||
$resultRow[$table][$column] = $this->boolean($resultRow[$table][$column]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ class DboPostgres extends DboSource {
|
|||
$this->_execute('SET search_path TO ' . $config['schema']);
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
throw new MissingConnectionException(array('class' => $e->getMessage()));
|
||||
}
|
||||
|
||||
return $this->connected;
|
||||
|
@ -707,7 +707,7 @@ class DboPostgres extends DboSource {
|
|||
|
||||
switch ($type) {
|
||||
case 'bool':
|
||||
$resultRow[$table][$column] = $this->boolean($row[$index]);
|
||||
$resultRow[$table][$column] = is_null($row[$index]) ? null : $this->boolean($row[$index]);
|
||||
break;
|
||||
case 'binary':
|
||||
case 'bytea':
|
||||
|
|
|
@ -116,9 +116,8 @@ class Sqlite extends DboSource {
|
|||
$this->_connection = new PDO('sqlite:' . $config['database'], null, null, $flags);
|
||||
$this->_connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$this->connected = true;
|
||||
}
|
||||
catch(PDOException $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
} catch(PDOException $e) {
|
||||
throw new MissingConnectionException(array('class' => $e->getMessage()));
|
||||
}
|
||||
return $this->connected;
|
||||
}
|
||||
|
@ -287,7 +286,7 @@ class Sqlite extends DboSource {
|
|||
// so try to figure it out based on the querystring
|
||||
$querystring = $results->queryString;
|
||||
if (stripos($querystring, 'SELECT') === 0) {
|
||||
$last = stripos($querystring, 'FROM');
|
||||
$last = strripos($querystring, 'FROM');
|
||||
if ($last !== false) {
|
||||
$selectpart = substr($querystring, 7, $last - 8);
|
||||
$selects = explode(',', $selectpart);
|
||||
|
@ -337,9 +336,9 @@ class Sqlite extends DboSource {
|
|||
if ($row = $this->_result->fetch()) {
|
||||
$resultRow = array();
|
||||
foreach ($this->map as $col => $meta) {
|
||||
list($table, $column, $tpye) = $meta;
|
||||
list($table, $column, $type) = $meta;
|
||||
$resultRow[$table][$column] = $row[$col];
|
||||
if ($type === 'boolean') {
|
||||
if ($type == 'boolean' && !is_null($row[$col])) {
|
||||
$resultRow[$table][$column] = $this->boolean($resultRow[$table][$column]);
|
||||
}
|
||||
}
|
||||
|
|
12
lib/Cake/View/Helper/PaginatorHelper.php
Normal file → Executable file
12
lib/Cake/View/Helper/PaginatorHelper.php
Normal file → Executable file
|
@ -292,20 +292,20 @@ class PaginatorHelper extends AppHelper {
|
|||
* - `escape` Whether you want the contents html entity encoded, defaults to true
|
||||
* - `model` The model to use, defaults to PaginatorHelper::defaultModel()
|
||||
*
|
||||
* @param string $title Title for the link.
|
||||
* @param string $key The name of the key that the recordset should be sorted. If $key is null
|
||||
* $title will be used for the key, and a title will be generated by inflection.
|
||||
* @param string $key The name of the key that the recordset should be sorted.
|
||||
* @param string $title Title for the link. If $title is null $key will be used
|
||||
* for the title and will be generated by inflection.
|
||||
* @param array $options Options for sorting link. See above for list of keys.
|
||||
* @return string A link sorting default by 'asc'. If the resultset is sorted 'asc' by the specified
|
||||
* key the returned link will sort by 'desc'.
|
||||
*/
|
||||
public function sort($title, $key = null, $options = array()) {
|
||||
public function sort($key, $title = null, $options = array()) {
|
||||
$options = array_merge(array('url' => array(), 'model' => null), $options);
|
||||
$url = $options['url'];
|
||||
unset($options['url']);
|
||||
|
||||
if (empty($key)) {
|
||||
$key = $title;
|
||||
if (empty($title)) {
|
||||
$title = $key;
|
||||
$title = __(Inflector::humanize(preg_replace('/_id$/', '', $title)));
|
||||
}
|
||||
$dir = isset($options['direction']) ? $options['direction'] : 'asc';
|
||||
|
|
|
@ -141,6 +141,42 @@ class AppImportTest extends CakeTestCase {
|
|||
App::build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests listing objects within a plugin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testListObjectsInPlugin() {
|
||||
App::build(array(
|
||||
'models' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'models' . DS),
|
||||
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
|
||||
));
|
||||
|
||||
$oldCache = App::$models;
|
||||
$result = App::objects('TestPlugin.model');
|
||||
$this->assertTrue(in_array('TestPluginPost', $result));
|
||||
$this->assertEquals($oldCache, App::$models);
|
||||
|
||||
$result = App::objects('TestPlugin.behavior');
|
||||
$this->assertTrue(in_array('TestPluginPersisterOne', $result));
|
||||
|
||||
$result = App::objects('TestPlugin.helper');
|
||||
$expected = array('OtherHelper', 'PluggedHelper', 'TestPluginApp');
|
||||
$this->assertEquals($result, $expected);
|
||||
|
||||
$result = App::objects('TestPlugin.component');
|
||||
$this->assertTrue(in_array('OtherComponent', $result));
|
||||
|
||||
$result = App::objects('TestPluginTwo.behavior');
|
||||
$this->assertEquals($result, array());
|
||||
|
||||
$result = App::objects('model', null, false);
|
||||
$this->assertTrue(in_array('Comment', $result));
|
||||
$this->assertTrue(in_array('Post', $result));
|
||||
|
||||
App::build();
|
||||
}
|
||||
|
||||
/**
|
||||
* test that pluginPath can find paths for plugins.
|
||||
*
|
||||
|
|
|
@ -181,19 +181,19 @@ class DboMysqlTest extends CakeTestCase {
|
|||
|
||||
$this->assertTrue((bool)$this->model->save(array('bool' => 5, 'small_int' => 5)));
|
||||
$result = $this->model->find('first');
|
||||
$this->assertIdentical($result['Tinyint']['bool'], '1');
|
||||
$this->assertIdentical($result['Tinyint']['bool'], true);
|
||||
$this->assertIdentical($result['Tinyint']['small_int'], '5');
|
||||
$this->model->deleteAll(true);
|
||||
|
||||
$this->assertTrue((bool)$this->model->save(array('bool' => 0, 'small_int' => 100)));
|
||||
$result = $this->model->find('first');
|
||||
$this->assertIdentical($result['Tinyint']['bool'], '0');
|
||||
$this->assertIdentical($result['Tinyint']['bool'], false);
|
||||
$this->assertIdentical($result['Tinyint']['small_int'], '100');
|
||||
$this->model->deleteAll(true);
|
||||
|
||||
$this->assertTrue((bool)$this->model->save(array('bool' => true, 'small_int' => 0)));
|
||||
$result = $this->model->find('first');
|
||||
$this->assertIdentical($result['Tinyint']['bool'], '1');
|
||||
$this->assertIdentical($result['Tinyint']['bool'], true);
|
||||
$this->assertIdentical($result['Tinyint']['small_int'], '0');
|
||||
$this->model->deleteAll(true);
|
||||
|
||||
|
@ -3368,4 +3368,18 @@ class DboMysqlTest extends CakeTestCase {
|
|||
$this->assertTrue(Set::matches('/Comment[id=2]', $result));
|
||||
$this->assertFalse(Set::matches('/Comment[id=10]', $result));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException MissingConnectionException
|
||||
* @return void
|
||||
*/
|
||||
function testExceptionOnBrokenConnection() {
|
||||
$dbo = new DboMysql(array(
|
||||
'driver' => 'mysql',
|
||||
'host' => 'imaginary_host',
|
||||
'login' => 'mark',
|
||||
'password' => 'inyurdatabase',
|
||||
'database' => 'imaginary'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,6 +176,9 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->load('TriggerMockFirst');
|
||||
$this->Objects->load('TriggerMockSecond');
|
||||
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockFirst;
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockSecond;
|
||||
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->will($this->returnValue(true));
|
||||
|
@ -196,6 +199,9 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->load('TriggerMockFirst', array(), false);
|
||||
$this->Objects->load('TriggerMockSecond');
|
||||
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockFirst;
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockSecond;
|
||||
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->will($this->returnValue(true));
|
||||
|
@ -217,6 +223,9 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->load('TriggerMockFirst');
|
||||
$this->Objects->load('TriggerMockSecond');
|
||||
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockFirst;
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockSecond;
|
||||
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->will($this->returnValue(true));
|
||||
|
@ -239,6 +248,9 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->load('TriggerMockFirst');
|
||||
$this->Objects->load('TriggerMockSecond');
|
||||
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockFirst;
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockSecond;
|
||||
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->will($this->returnValue(array('one', 'two')));
|
||||
|
@ -264,6 +276,9 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->load('TriggerMockFirst');
|
||||
$this->Objects->load('TriggerMockSecond');
|
||||
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockFirst;
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockSecond;
|
||||
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->will($this->returnValue(false));
|
||||
|
@ -288,6 +303,9 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->load('TriggerMockFirst');
|
||||
$this->Objects->load('TriggerMockSecond');
|
||||
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockFirst;
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockSecond;
|
||||
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->with(array('value'))
|
||||
|
@ -317,15 +335,14 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->load('TriggerMockFirst');
|
||||
$this->Objects->load('TriggerMockSecond');
|
||||
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->with(array('value'))
|
||||
->will($this->returnValue(array('new value')));
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockFirst;
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockSecond;
|
||||
|
||||
$this->Objects->TriggerMockSecond->expects($this->once())
|
||||
->method('callback')
|
||||
->with(array('value'))
|
||||
->will($this->returnValue(array('newer value')));
|
||||
$this->Objects->TriggerMockFirst->expects($this->never())
|
||||
->method('callback');
|
||||
|
||||
$this->Objects->TriggerMockSecond->expects($this->never())
|
||||
->method('callback');
|
||||
|
||||
$result = $this->Objects->trigger(
|
||||
'callback',
|
||||
|
@ -337,7 +354,6 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
/**
|
||||
* test that returrning null doesn't modify parameters.
|
||||
*
|
||||
* @expectedException CakeException
|
||||
* @return void
|
||||
*/
|
||||
function testTriggerModParamsNullIgnored() {
|
||||
|
@ -345,6 +361,9 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->load('TriggerMockFirst');
|
||||
$this->Objects->load('TriggerMockSecond');
|
||||
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockFirst;
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockSecond;
|
||||
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->with(array('value'))
|
||||
|
@ -358,9 +377,9 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$result = $this->Objects->trigger(
|
||||
'callback',
|
||||
array(array('value')),
|
||||
array('modParams' => 2)
|
||||
array('modParams' => 0)
|
||||
);
|
||||
$this->assertEquals('new value', $result);
|
||||
$this->assertEquals(array('new value'), $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -659,14 +659,6 @@ class TestMail extends CakeTestModel {
|
|||
*/
|
||||
class FormHelperTest extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* fixtures property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
public $fixtures = array(null);
|
||||
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
|
|
27
lib/Cake/tests/cases/libs/view/helpers/paginator.test.php
Normal file → Executable file
27
lib/Cake/tests/cases/libs/view/helpers/paginator.test.php
Normal file → Executable file
|
@ -171,7 +171,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Paginator->sort('TestTitle', 'title');
|
||||
$result = $this->Paginator->sort('title', 'TestTitle');
|
||||
$expected = array(
|
||||
'a' => array('href' => '/officespace/accounts/index/param/page:1/sort:title/direction:asc'),
|
||||
'TestTitle',
|
||||
|
@ -179,7 +179,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Paginator->sort(array('asc' => 'ascending', 'desc' => 'descending'), 'title');
|
||||
$result = $this->Paginator->sort('title', array('asc' => 'ascending', 'desc' => 'descending'));
|
||||
$expected = array(
|
||||
'a' => array('href' => '/officespace/accounts/index/param/page:1/sort:title/direction:asc'),
|
||||
'ascending',
|
||||
|
@ -188,7 +188,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
$this->assertTags($result, $expected);
|
||||
|
||||
$this->Paginator->request->params['paging']['Article']['options']['sort'] = 'title';
|
||||
$result = $this->Paginator->sort(array('asc' => 'ascending', 'desc' => 'descending'), 'title');
|
||||
$result = $this->Paginator->sort('title', array('asc' => 'ascending', 'desc' => 'descending'));
|
||||
$expected = array(
|
||||
'a' => array('href' => '/officespace/accounts/index/param/page:1/sort:title/direction:desc', 'class' => 'asc'),
|
||||
'descending',
|
||||
|
@ -208,29 +208,29 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
|
||||
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc');
|
||||
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
||||
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'desc'));
|
||||
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'desc'));
|
||||
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
|
||||
|
||||
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc');
|
||||
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
||||
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'asc'));
|
||||
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'asc'));
|
||||
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
|
||||
|
||||
|
||||
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
||||
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
||||
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'asc'));
|
||||
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'asc'));
|
||||
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
|
||||
|
||||
|
||||
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
||||
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
||||
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'desc'));
|
||||
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'desc'));
|
||||
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
|
||||
|
||||
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
||||
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
||||
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'desc', 'class' => 'foo'));
|
||||
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'desc', 'class' => 'foo'));
|
||||
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="foo asc">Title<\/a>$/', $result);
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
));
|
||||
$this->Paginator->options(array('url' => array('param')));
|
||||
|
||||
$result = $this->Paginator->sort('TestTitle', 'title', array('direction' => 'desc'));
|
||||
$result = $this->Paginator->sort('title', 'TestTitle', array('direction' => 'desc'));
|
||||
$expected = array(
|
||||
'a' => array('href' => '/accounts/index/param/page:1/sort:title/direction:desc'),
|
||||
'TestTitle',
|
||||
|
@ -304,7 +304,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Paginator->sort(array('asc' => 'ascending', 'desc' => 'descending'), 'title', array('direction' => 'desc'));
|
||||
$result = $this->Paginator->sort('title', array('asc' => 'ascending', 'desc' => 'descending'), array('direction' => 'desc'));
|
||||
$expected = array(
|
||||
'a' => array('href' => '/accounts/index/param/page:1/sort:title/direction:desc'),
|
||||
'descending',
|
||||
|
@ -328,7 +328,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
));
|
||||
|
||||
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc');
|
||||
$result = $this->Paginator->sort('Title','Article.title');
|
||||
$result = $this->Paginator->sort('Article.title', 'Title');
|
||||
$expected = array(
|
||||
'a' => array('href' => '/officespace/accounts/index/page:1/sort:Article.title/direction:asc', 'class' => 'desc'),
|
||||
'Title',
|
||||
|
@ -336,8 +336,9 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
|
||||
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
||||
$result = $this->Paginator->sort('Title','Article.title');
|
||||
$result = $this->Paginator->sort('Article.title', 'Title');
|
||||
$expected = array(
|
||||
'a' => array('href' => '/officespace/accounts/index/page:1/sort:Article.title/direction:desc', 'class' => 'asc'),
|
||||
'Title',
|
||||
|
@ -486,7 +487,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
$this->assertTags($result, $expected);
|
||||
|
||||
$this->Paginator->options(array('url' => array('param')));
|
||||
$result = $this->Paginator->sort('Title', 'Article.title');
|
||||
$result = $this->Paginator->sort('Article.title', 'Title');
|
||||
$expected = array(
|
||||
'a' => array('href' => '/admin/test/index/param/page:1/sort:Article.title/direction:asc'),
|
||||
'Title',
|
||||
|
|
Loading…
Reference in a new issue