mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Changing Router::$__validExtensions so Router::extensions() always returns an array like the doc block says.
Updating test cases for PHPUnit.
This commit is contained in:
parent
df6989e3d6
commit
94ac914426
2 changed files with 6 additions and 4 deletions
|
@ -64,7 +64,7 @@ class Router {
|
|||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
private $__validExtensions = null;
|
||||
private $__validExtensions = array();
|
||||
|
||||
/**
|
||||
* 'Constant' regular expression definitions for named route elements
|
||||
|
|
|
@ -1067,7 +1067,7 @@ class RouterTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testExtensionParsingSetting() {
|
||||
$this->assertFalse(Router::extensions());
|
||||
$this->assertEquals(array(), Router::extensions());
|
||||
|
||||
Router::parseExtensions('rss');
|
||||
$this->assertEqual(Router::extensions(), array('rss'));
|
||||
|
@ -1927,7 +1927,7 @@ class RouterTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testUsingCustomRouteClass() {
|
||||
Mock::generate('CakeRoute', 'MockConnectedRoute');
|
||||
$mock = $this->getMock('CakeRoute', array(), array(), 'MockConnectedRoute', false);
|
||||
$routes = Router::connect(
|
||||
'/:slug',
|
||||
array('controller' => 'posts', 'action' => 'view'),
|
||||
|
@ -1935,7 +1935,9 @@ class RouterTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTrue(is_a($routes[0], 'MockConnectedRoute'), 'Incorrect class used. %s');
|
||||
$expected = array('controller' => 'posts', 'action' => 'view', 'slug' => 'test');
|
||||
$routes[0]->setReturnValue('parse', $expected);
|
||||
$routes[0]->expects($this->any())
|
||||
->method('parse')
|
||||
->will($this->returnValue($expected));
|
||||
$result = Router::parse('/test');
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue