Adding model test fixture and additional Router test

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5527 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2007-08-15 16:26:04 +00:00
parent 3b0099b877
commit 5c48a926e7
2 changed files with 64 additions and 5 deletions

View file

@ -259,13 +259,10 @@ class RouterTest extends UnitTestCase {
array('language' => '[a-z]{3}')
);
$this->router->connect('/:language/:controller/:action/*',
array(),
array('language' => '[a-z]{3}')
);
$this->router->connect('/:language/:controller/:action/*', array(), array('language' => '[a-z]{3}'));
$result = $this->router->url(array('language' => 'eng', 'action' => 'index', 'controller' => 'pages'));
$expected = '/eng/pages'; // Passes as expected
$expected = '/eng/pages';
$this->assertEqual($result, $expected);
$result = $this->router->url(array('language' => 'eng', 'controller' => 'pages'));
@ -274,6 +271,23 @@ class RouterTest extends UnitTestCase {
$result = $this->router->url(array('language' => 'eng', 'controller' => 'pages', 'action' => 'add'));
$expected = '/eng/pages/add/';
$this->assertEqual($result, $expected);
$this->router->reload();
Router::setRequestInfo(array(
array(
'pass' => array(), 'action' => 'index', 'plugin' => null, 'controller' => 'users',
'url' => array('url' => 'users'), 'bare' => 0, 'webservices' => ''
),
array(
'base' => '/', 'here' => '/',
'webroot' => '/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array(),
'webservices' => null
)
));
$result = $this->router->url(array('action' => 'login'));
$expected = '/users/login/';
$this->assertEqual($result, $expected);
}
function testUrlGenerationWithExtensions() {

View file

@ -0,0 +1,45 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
* Copyright 2005-2007, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @subpackage cake.tests.fixtures
* @since CakePHP(tm) v 1.2.0.4667
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.fixtures
*/
class ArticleFeaturedsTagsFixture extends CakeTestFixture {
var $name = 'ArticleFeaturedsTags';
var $primaryKey = array('article_featured_id', 'tag_id');
var $fields = array(
'article_featured_id' => array('type' => 'integer', 'null' => false),
'tag_id' => array('type' => 'integer', 'null' => false),
);
}
?>