mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
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:
parent
3b0099b877
commit
5c48a926e7
2 changed files with 64 additions and 5 deletions
|
@ -259,13 +259,10 @@ class RouterTest extends UnitTestCase {
|
||||||
array('language' => '[a-z]{3}')
|
array('language' => '[a-z]{3}')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->router->connect('/:language/:controller/:action/*',
|
$this->router->connect('/:language/:controller/:action/*', array(), array('language' => '[a-z]{3}'));
|
||||||
array(),
|
|
||||||
array('language' => '[a-z]{3}')
|
|
||||||
);
|
|
||||||
|
|
||||||
$result = $this->router->url(array('language' => 'eng', 'action' => 'index', 'controller' => 'pages'));
|
$result = $this->router->url(array('language' => 'eng', 'action' => 'index', 'controller' => 'pages'));
|
||||||
$expected = '/eng/pages'; // Passes as expected
|
$expected = '/eng/pages';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->router->url(array('language' => 'eng', 'controller' => 'pages'));
|
$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'));
|
$result = $this->router->url(array('language' => 'eng', 'controller' => 'pages', 'action' => 'add'));
|
||||||
$expected = '/eng/pages/add/';
|
$expected = '/eng/pages/add/';
|
||||||
$this->assertEqual($result, $expected);
|
$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() {
|
function testUrlGenerationWithExtensions() {
|
||||||
|
|
45
cake/tests/fixtures/article_featureds_tags_fixture.php
vendored
Normal file
45
cake/tests/fixtures/article_featureds_tags_fixture.php
vendored
Normal 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),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
Loading…
Add table
Reference in a new issue