From 5c48a926e7e7383f19f887a9d3960e92f13a0cb8 Mon Sep 17 00:00:00 2001 From: nate Date: Wed, 15 Aug 2007 16:26:04 +0000 Subject: [PATCH] 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 --- cake/tests/cases/libs/router.test.php | 24 +++++++--- .../article_featureds_tags_fixture.php | 45 +++++++++++++++++++ 2 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 cake/tests/fixtures/article_featureds_tags_fixture.php diff --git a/cake/tests/cases/libs/router.test.php b/cake/tests/cases/libs/router.test.php index 099d29a09..ef692b4b9 100644 --- a/cake/tests/cases/libs/router.test.php +++ b/cake/tests/cases/libs/router.test.php @@ -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() { diff --git a/cake/tests/fixtures/article_featureds_tags_fixture.php b/cake/tests/fixtures/article_featureds_tags_fixture.php new file mode 100644 index 000000000..fde9bdd60 --- /dev/null +++ b/cake/tests/fixtures/article_featureds_tags_fixture.php @@ -0,0 +1,45 @@ + + * 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), + ); +} + +?> \ No newline at end of file