\n";
foreach ($otherFields as $_field) {
- echo "\t\t\t".${$otherSingularVar}[$_field]." | \n";
+ echo "\t\t\t" . ${$otherSingularVar}[$_field] . " | \n";
}
echo "\t\t\t\n";
diff --git a/cake/tests/cases/console/cake.test.php b/cake/tests/cases/console/cake.test.php
index 7880acfdc..04900aa9f 100644
--- a/cake/tests/cases/console/cake.test.php
+++ b/cake/tests/cases/console/cake.test.php
@@ -451,6 +451,25 @@ class ShellDispatcherTest extends CakeTestCase {
$Dispatcher->params = $Dispatcher->args = array();
$Dispatcher->parseParams($params);
$this->assertEqual($expected, $Dispatcher->params);
+
+
+ $params = array(
+ 'cake.php',
+ '-working',
+ 'D:\www',
+ 'bake',
+ 'my_app',
+ );
+ $expected = array(
+ 'working' => 'D:\www',
+ 'app' => 'www',
+ 'root' => 'D:',
+ 'webroot' => 'webroot'
+ );
+
+ $Dispatcher->params = $Dispatcher->args = array();
+ $Dispatcher->parseParams($params);
+ $this->assertEqual($expected, $Dispatcher->params);
}
/**
diff --git a/cake/tests/cases/libs/http_socket.test.php b/cake/tests/cases/libs/http_socket.test.php
index 4dcaabb3c..6389823d4 100644
--- a/cake/tests/cases/libs/http_socket.test.php
+++ b/cake/tests/cases/libs/http_socket.test.php
@@ -539,12 +539,12 @@ class HttpSocketTest extends CakeTestCase {
$this->Socket->setReturnValue('read', false);
$this->Socket->_mock->_call_counts['read'] = 0;
$number = mt_rand(0, 9999999);
- $serverResponse = "HTTP/1.x 200 OK\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\nContent-Type: text/html\r\n\r\nHello, your lucky number is ".$number."";
+ $serverResponse = "HTTP/1.x 200 OK\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\nContent-Type: text/html\r\n\r\nHello, your lucky number is " . $number . "";
$this->Socket->setReturnValueAt(0, 'read', $serverResponse);
$this->Socket->expect('write', array("GET / HTTP/1.1\r\nHost: www.cakephp.org\r\nConnection: close\r\nUser-Agent: CakePHP\r\n\r\n"));
$this->Socket->expectCallCount('read', 2);
$response = $this->Socket->request($request);
- $this->assertIdentical($response, "Hello, your lucky number is ".$number."");
+ $this->assertIdentical($response, "Hello, your lucky number is " . $number . "");
$this->Socket->reset();
$serverResponse = "HTTP/1.x 200 OK\r\nSet-Cookie: foo=bar\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\nContent-Type: text/html\r\n\r\nThis is a cookie test!";
diff --git a/cake/tests/cases/libs/router.test.php b/cake/tests/cases/libs/router.test.php
index 54b6fa3c3..7780a4448 100644
--- a/cake/tests/cases/libs/router.test.php
+++ b/cake/tests/cases/libs/router.test.php
@@ -1705,5 +1705,74 @@ class RouterTest extends CakeTestCase {
$this->assertEqual(Router::stripPlugin($url), $url);
$this->assertEqual(Router::stripPlugin($url, null), $url);
}
+/**
+ * testCurentRoute
+ *
+ * This test needs some improvement and actual requestAction() usage
+ *
+ * @return void
+ * @access public
+ */
+ function testCurentRoute() {
+ $url = array('controller' => 'pages', 'action' => 'display', 'government');
+ Router::connect('/government', $url);
+ Router::parse('/government');
+ $route = Router::currentRoute();
+ $this->assertEqual(array_merge($url, array('plugin' => false)), $route[3]);
+ }
+/**
+ * testRequestRoute
+ *
+ * @return void
+ * @access public
+ */
+ function testRequestRoute() {
+ $url = array('controller' => 'products', 'action' => 'display', 5);
+ Router::connect('/government', $url);
+ Router::parse('/government');
+ $route = Router::requestRoute();
+ $this->assertEqual(array_merge($url, array('plugin' => false)), $route[3]);
+
+ // test that the first route is matched
+ $newUrl = array('controller' => 'products', 'action' => 'display', 6);
+ Router::connect('/government', $url);
+ Router::parse('/government');
+ $route = Router::requestRoute();
+ $this->assertEqual(array_merge($url, array('plugin' => false)), $route[3]);
+
+ // test that an unmatched route does not change the current route
+ $newUrl = array('controller' => 'products', 'action' => 'display', 6);
+ Router::connect('/actor', $url);
+ Router::parse('/government');
+ $route = Router::requestRoute();
+ $this->assertEqual(array_merge($url, array('plugin' => false)), $route[3]);
+ }
+/**
+ * testGetParams
+ *
+ * @return void
+ * @access public
+ */
+ function testGetParams() {
+ $paths = array('base' => '/', 'here' => '/products/display/5', 'webroot' => '/webroot');
+ $params = array('param1' => '1', 'param2' => '2');
+ Router::setRequestInfo(array($params, $paths));
+ $expected = array(
+ 'plugin' => false, 'controller' => false, 'action' => false,
+ 'param1' => '1', 'param2' => '2'
+ );
+ $this->assertEqual(Router::getparams(), $expected);
+ $this->assertEqual(Router::getparam('controller'), false);
+ $this->assertEqual(Router::getparam('param1'), '1');
+ $this->assertEqual(Router::getparam('param2'), '2');
+
+ Router::reload();
+
+ $params = array('controller' => 'pages', 'action' => 'display');
+ Router::setRequestInfo(array($params, $paths));
+ $expected = array('plugin' => false, 'controller' => 'pages', 'action' => 'display');
+ $this->assertEqual(Router::getparams(), $expected);
+ $this->assertEqual(Router::getparams(true), $expected);
+ }
}
?>
\ No newline at end of file
diff --git a/cake/tests/cases/libs/sanitize.test.php b/cake/tests/cases/libs/sanitize.test.php
index 16dc92e18..32d15a68e 100644
--- a/cake/tests/cases/libs/sanitize.test.php
+++ b/cake/tests/cases/libs/sanitize.test.php
@@ -311,8 +311,8 @@ class SanitizeTest extends CakeTestCase {
$result = Sanitize::stripScripts($string);
$this->assertEqual($result, $expected);
- $string = ''."\n".''."\n".''."\n".'';
- $expected = "\n".''."\n".''."\n".'';
+ $string = '' . "\n" . '' . "\n" . '' . "\n" . '';
+ $expected = "\n" . '' . "\n" . ''."\n".'';
$result = Sanitize::stripScripts($string);
$this->assertEqual($result, $expected);
diff --git a/cake/tests/cases/libs/view/helpers/paginator.test.php b/cake/tests/cases/libs/view/helpers/paginator.test.php
index 7b7c93523..329328ae8 100644
--- a/cake/tests/cases/libs/view/helpers/paginator.test.php
+++ b/cake/tests/cases/libs/view/helpers/paginator.test.php
@@ -765,29 +765,116 @@ class PaginatorHelperTest extends CakeTestCase {
'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
);
$result = $this->Paginator->numbers();
- $expected = '4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12';
- $this->assertEqual($result, $expected);
+ $expected = array(
+ array('span' => array()), array('a' => array('href' => '/index/page:4')), '4', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:5')), '5', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:6')), '6', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:7')), '7', '/a', '/span',
+ ' | ',
+ array('span' => array('class' => 'current')), '8', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:9')), '9', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:10')), '10', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:11')), '11', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:12')), '12', '/a', '/span',
+ );
+ $this->assertTags($result, $expected);
$result = $this->Paginator->numbers(array('tag' => 'li'));
- $expected = '4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12';
- $this->assertEqual($result, $expected);
+ $expected = array(
+ array('li' => array()), array('a' => array('href' => '/index/page:4')), '4', '/a', '/li',
+ ' | ',
+ array('li' => array()), array('a' => array('href' => '/index/page:5')), '5', '/a', '/li',
+ ' | ',
+ array('li' => array()), array('a' => array('href' => '/index/page:6')), '6', '/a', '/li',
+ ' | ',
+ array('li' => array()), array('a' => array('href' => '/index/page:7')), '7', '/a', '/li',
+ ' | ',
+ array('li' => array('class' => 'current')), '8', '/li',
+ ' | ',
+ array('li' => array()), array('a' => array('href' => '/index/page:9')), '9', '/a', '/li',
+ ' | ',
+ array('li' => array()), array('a' => array('href' => '/index/page:10')), '10', '/a', '/li',
+ ' | ',
+ array('li' => array()), array('a' => array('href' => '/index/page:11')), '11', '/a', '/li',
+ ' | ',
+ array('li' => array()), array('a' => array('href' => '/index/page:12')), '12', '/a', '/li',
+ );
+ $this->assertTags($result, $expected);
$result = $this->Paginator->numbers(array('tag' => 'li', 'separator' => false));
- $expected = '456789101112';
- $this->assertEqual($result, $expected);
+ $expected = array(
+ array('li' => array()), array('a' => array('href' => '/index/page:4')), '4', '/a', '/li',
+ array('li' => array()), array('a' => array('href' => '/index/page:5')), '5', '/a', '/li',
+ array('li' => array()), array('a' => array('href' => '/index/page:6')), '6', '/a', '/li',
+ array('li' => array()), array('a' => array('href' => '/index/page:7')), '7', '/a', '/li',
+ array('li' => array('class' => 'current')), '8', '/li',
+ array('li' => array()), array('a' => array('href' => '/index/page:9')), '9', '/a', '/li',
+ array('li' => array()), array('a' => array('href' => '/index/page:10')), '10', '/a', '/li',
+ array('li' => array()), array('a' => array('href' => '/index/page:11')), '11', '/a', '/li',
+ array('li' => array()), array('a' => array('href' => '/index/page:12')), '12', '/a', '/li',
+ );
+ $this->assertTags($result, $expected);
$result = $this->Paginator->numbers(true);
- $expected = 'first | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | last';
- $this->assertEqual($result, $expected);
-
+ $expected = array(
+ array('span' => array()), array('a' => array('href' => '/index/page:1')), 'first', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4')), '4', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:5')), '5', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:6')), '6', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:7')), '7', '/a', '/span',
+ ' | ',
+ array('span' => array('class' => 'current')), '8', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:9')), '9', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:10')), '10', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:11')), '11', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:12')), '12', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:15')), 'last', '/a', '/span',
+ );
+ $this->assertTags($result, $expected);
+
$this->Paginator->params['paging'] = array('Client' => array(
'page' => 1, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15,
'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()),
'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
);
$result = $this->Paginator->numbers();
- $expected = '1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9';
- $this->assertEqual($result, $expected);
+ $expected = array(
+ array('span' => array('class' => 'current')), '1', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:2')), '2', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:3')), '3', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4')), '4', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:5')), '5', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:6')), '6', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:7')), '7', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:8')), '8', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:9')), '9', '/a', '/span',
+ );
+ $this->assertTags($result, $expected);
+
$this->Paginator->params['paging'] = array('Client' => array(
'page' => 14, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15,
@@ -795,8 +882,26 @@ class PaginatorHelperTest extends CakeTestCase {
'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
);
$result = $this->Paginator->numbers();
- $expected = '7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15';
- $this->assertEqual($result, $expected);
+ $expected = array(
+ array('span' => array()), array('a' => array('href' => '/index/page:7')), '7', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:8')), '8', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:9')), '9', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:10')), '10', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:11')), '11', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:12')), '12', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:13')), '13', '/a', '/span',
+ ' | ',
+ array('span' => array('class' => 'current')), '14', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:15')), '15', '/a', '/span',
+ );
+ $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array(
'page' => 2, 'current' => 3, 'count' => 27, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 9,
@@ -805,12 +910,48 @@ class PaginatorHelperTest extends CakeTestCase {
);
$result = $this->Paginator->numbers(array('first' => 1));
- $expected = '1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9';
- $this->assertEqual($result, $expected);
+ $expected = array(
+ array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span',
+ ' | ',
+ array('span' => array('class' => 'current')), '2', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:3')), '3', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4')), '4', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:5')), '5', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:6')), '6', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:7')), '7', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:8')), '8', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:9')), '9', '/a', '/span',
+ );
+ $this->assertTags($result, $expected);
$result = $this->Paginator->numbers(array('last' => 1));
- $expected = '1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9';
- $this->assertEqual($result, $expected);
+ $expected = array(
+ array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span',
+ ' | ',
+ array('span' => array('class' => 'current')), '2', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:3')), '3', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4')), '4', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:5')), '5', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:6')), '6', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:7')), '7', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:8')), '8', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:9')), '9', '/a', '/span',
+ );
+ $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array(
'page' => 15, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15,
@@ -819,8 +960,29 @@ class PaginatorHelperTest extends CakeTestCase {
);
$result = $this->Paginator->numbers(array('first' => 1));
- $expected = '1...7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15';
- $this->assertEqual($result, $expected);
+ $expected = array(
+ array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span',
+ '...',
+ array('span' => array()), array('a' => array('href' => '/index/page:7')), '7', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:8')), '8', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:9')), '9', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:10')), '10', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:11')), '11', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:12')), '12', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:13')), '13', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:14')), '14', '/a', '/span',
+ ' | ',
+ array('span' => array('class' => 'current')), '15', '/span',
+
+ );
+ $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array(
'page' => 10, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15,
@@ -829,8 +991,30 @@ class PaginatorHelperTest extends CakeTestCase {
);
$result = $this->Paginator->numbers(array('first' => 1, 'last' => 1));
- $expected = '1...6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15';
- $this->assertEqual($result, $expected);
+ $expected = array(
+ array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span',
+ '...',
+ array('span' => array()), array('a' => array('href' => '/index/page:6')), '6', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:7')), '7', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:8')), '8', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:9')), '9', '/a', '/span',
+ ' | ',
+ array('span' => array('class' => 'current')), '10', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:11')), '11', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:12')), '12', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:13')), '13', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:14')), '14', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:15')), '15', '/a', '/span',
+ );
+ $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array(
'page' => 6, 'current' => 15, 'count' => 623, 'prevPage' => 1, 'nextPage' => 1, 'pageCount' => 42,
@@ -839,8 +1023,30 @@ class PaginatorHelperTest extends CakeTestCase {
);
$result = $this->Paginator->numbers(array('first' => 1, 'last' => 1));
- $expected = '1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10...42';
- $this->assertEqual($result, $expected);
+ $expected = array(
+ array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:2')), '2', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:3')), '3', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4')), '4', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:5')), '5', '/a', '/span',
+ ' | ',
+ array('span' => array('class' => 'current')), '6', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:7')), '7', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:8')), '8', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:9')), '9', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:10')), '10', '/a', '/span',
+ '...',
+ array('span' => array()), array('a' => array('href' => '/index/page:42')), '42', '/a', '/span',
+ );
+ $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array(
'page' => 37, 'current' => 15, 'count' => 623, 'prevPage' => 1, 'nextPage' => 1, 'pageCount' => 42,
@@ -849,8 +1055,30 @@ class PaginatorHelperTest extends CakeTestCase {
);
$result = $this->Paginator->numbers(array('first' => 1, 'last' => 1));
- $expected = '1...33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42';
- $this->assertEqual($result, $expected);
+ $expected = array(
+ array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span',
+ '...',
+ array('span' => array()), array('a' => array('href' => '/index/page:33')), '33', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:34')), '34', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:35')), '35', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:36')), '36', '/a', '/span',
+ ' | ',
+ array('span' => array('class' => 'current')), '37', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:38')), '38', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:39')), '39', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:40')), '40', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:41')), '41', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:42')), '42', '/a', '/span',
+ );
+ $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array(
'Client' => array(
@@ -876,8 +1104,14 @@ class PaginatorHelperTest extends CakeTestCase {
);
$options = array('modulus' => 10);
$result = $this->Paginator->numbers($options);
- $expected = '1 | 2 | 3';
- $this->assertEqual($result, $expected);
+ $expected = array(
+ array('span' => array('class' => 'current')), '1', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:2')), '2', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:3')), '3', '/a', '/span',
+ );
+ $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array(
'page' => 2, 'current' => 10, 'count' => 31, 'prevPage' => true, 'nextPage' => true, 'pageCount' => 4,
@@ -885,8 +1119,17 @@ class PaginatorHelperTest extends CakeTestCase {
'options' => array('page' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
);
$result = $this->Paginator->numbers();
- $expected = '1 | 2 | 3 | 4';
- $this->assertEqual($result, $expected);
+ $expected = array(
+ array('span' => array()), array('a' => array('href' => '/index/page:1/sort:Client.name/direction:DESC')), '1', '/a', '/span',
+ ' | ',
+ array('span' => array('class' => 'current')), '2', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:3/sort:Client.name/direction:DESC')), '3', '/a', '/span',
+ ' | ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4/sort:Client.name/direction:DESC')), '4', '/a', '/span',
+ );
+ $this->assertTags($result, $expected);
+
$this->Paginator->params['paging'] = array('Client' => array(
'page' => 4895, 'current' => 10, 'count' => 48962, 'prevPage' => 1, 'nextPage' => 1, 'pageCount' => 4897,
@@ -910,11 +1153,7 @@ class PaginatorHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
- $this->Paginator->params['paging'] = array('Client' => array(
- 'page' => 3, 'current' => 10, 'count' => 48962, 'prevPage' => 1, 'nextPage' => 1, 'pageCount' => 4897,
- 'defaults' => array('limit' => 10),
- 'options' => array('page' => 4894, 'limit' => 10, 'order' => 'Client.name DESC', 'conditions' => array()))
- );
+ $this->Paginator->params['paging']['Client']['page'] = 3;
$result = $this->Paginator->numbers(array('first' => 2, 'modulus' => 2, 'last' => 2));
$expected = array(
@@ -947,6 +1186,125 @@ class PaginatorHelperTest extends CakeTestCase {
array('span' => array()), array('a' => array('href' => '/index/page:4897')), '4897', '/a', '/span',
);
$this->assertTags($result, $expected);
+
+ $result = $this->Paginator->numbers(array('first' => 5, 'modulus' => 5, 'last' => 5, 'separator' => ' - '));
+ $expected = array(
+ array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:2')), '2', '/a', '/span',
+ ' - ',
+ array('span' => array('class' => 'current')), '3', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4')), '4', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:5')), '5', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:6')), '6', '/a', '/span',
+ '...',
+ array('span' => array()), array('a' => array('href' => '/index/page:4893')), '4893', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4894')), '4894', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4895')), '4895', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4896')), '4896', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4897')), '4897', '/a', '/span',
+ );
+ $this->assertTags($result, $expected);
+
+ $this->Paginator->params['paging']['Client']['page'] = 4893;
+ $result = $this->Paginator->numbers(array('first' => 5, 'modulus' => 4, 'last' => 5, 'separator' => ' - '));
+ $expected = array(
+ array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:2')), '2', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:3')), '3', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4')), '4', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:5')), '5', '/a', '/span',
+ '...',
+ array('span' => array()), array('a' => array('href' => '/index/page:4891')), '4891', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4892')), '4892', '/a', '/span',
+ ' - ',
+ array('span' => array('class' => 'current')), '4893', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4894')), '4894', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4895')), '4895', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4896')), '4896', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4897')), '4897', '/a', '/span',
+ );
+ $this->assertTags($result, $expected);
+
+ $this->Paginator->params['paging']['Client']['page'] = 58;
+ $result = $this->Paginator->numbers(array('first' => 5, 'modulus' => 4, 'last' => 5, 'separator' => ' - '));
+ $expected = array(
+ array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:2')), '2', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:3')), '3', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4')), '4', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:5')), '5', '/a', '/span',
+ '...',
+ array('span' => array()), array('a' => array('href' => '/index/page:56')), '56', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:57')), '57', '/a', '/span',
+ ' - ',
+ array('span' => array('class' => 'current')), '58', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:59')), '59', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:60')), '60', '/a', '/span',
+ '...',
+ array('span' => array()), array('a' => array('href' => '/index/page:4893')), '4893', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4894')), '4894', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4895')), '4895', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4896')), '4896', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4897')), '4897', '/a', '/span',
+ );
+ $this->assertTags($result, $expected);
+
+ $this->Paginator->params['paging']['Client']['page'] = 5;
+ $result = $this->Paginator->numbers(array('first' => 5, 'modulus' => 4, 'last' => 5, 'separator' => ' - '));
+ $expected = array(
+ array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:2')), '2', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:3')), '3', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4')), '4', '/a', '/span',
+ ' - ',
+ array('span' => array('class' => 'current')), '5', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:6')), '6', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:7')), '7', '/a', '/span',
+ '...',
+ array('span' => array()), array('a' => array('href' => '/index/page:4893')), '4893', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4894')), '4894', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4895')), '4895', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4896')), '4896', '/a', '/span',
+ ' - ',
+ array('span' => array()), array('a' => array('href' => '/index/page:4897')), '4897', '/a', '/span',
+ );
+ $this->assertTags($result, $expected);
}
/**
diff --git a/cake/tests/lib/cake_reporter.php b/cake/tests/lib/cake_reporter.php
index 18ab5f762..0dd954898 100644
--- a/cake/tests/lib/cake_reporter.php
+++ b/cake/tests/lib/cake_reporter.php
@@ -97,7 +97,6 @@ class CakeHtmlReporter extends SimpleReporter {
echo "" . $this->getFailCount() . " fails and ";
echo "" . $this->getExceptionCount() . " exceptions.";
echo "\n";
- echo " |