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:
mark_story 2010-05-20 22:55:25 -04:00
parent df6989e3d6
commit 94ac914426
2 changed files with 6 additions and 4 deletions

View file

@ -64,7 +64,7 @@ class Router {
* @var array
* @access private
*/
private $__validExtensions = null;
private $__validExtensions = array();
/**
* 'Constant' regular expression definitions for named route elements

View file

@ -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);
}