From c849dd773afe38054a793c24320bf925d171b3e1 Mon Sep 17 00:00:00 2001 From: phpnut Date: Sun, 30 Mar 2008 04:35:05 +0000 Subject: [PATCH] "Fixing inflection of people uninflected plural. Renamed PersonFixture. Fixed ModelTest::testHabtmFinderQuery() test when prefix is used." git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6612 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/inflector.php | 2 +- cake/tests/cases/libs/inflector.test.php | 12 ++++++++++++ cake/tests/cases/libs/model/model.test.php | 9 ++++----- cake/tests/fixtures/person_fixture.php | 4 ++-- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/cake/libs/inflector.php b/cake/libs/inflector.php index 9e7367740..c0c5edd20 100644 --- a/cake/libs/inflector.php +++ b/cake/libs/inflector.php @@ -102,7 +102,7 @@ class Inflector extends Object { 'equipment', 'Faroese', 'flounder', 'Foochowese', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'graffiti', 'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings', 'jackanapes', 'Kiplingese', 'Kongoese', 'Lucchese', 'mackerel', 'Maltese', 'media', 'mews', 'moose', 'mumps', 'Nankingese', 'news', - 'nexus', 'Niasese', 'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'pliers', 'Portuguese', 'proceedings', + 'nexus', 'Niasese', 'Pekingese', 'People', 'Piedmontese', 'pincers', 'Pistoiese', 'pliers', 'Portuguese', 'proceedings', 'rabies', 'rice', 'rhinoceros', 'salmon', 'Sarawakese', 'scissors', 'sea[- ]bass', 'series', 'Shavese', 'shears', 'siemens', 'species', 'swine', 'testes', 'trousers', 'trout', 'tuna', 'Vermontese', 'Wenchowese', 'whiting', 'wildebeest', 'Yengeese',); diff --git a/cake/tests/cases/libs/inflector.test.php b/cake/tests/cases/libs/inflector.test.php index c5208d45d..eb231a718 100644 --- a/cake/tests/cases/libs/inflector.test.php +++ b/cake/tests/cases/libs/inflector.test.php @@ -161,6 +161,10 @@ class InflectorTest extends UnitTestCase { $result = $this->Inflector->singularize('viri'); $expected = 'virus'; $this->assertEqual($result, $expected); + + $result = $this->Inflector->singularize('people'); + $expected = 'person'; + $this->assertEqual($result, $expected); } function testInflectingPlurals() { @@ -283,6 +287,14 @@ class InflectorTest extends UnitTestCase { $result = $this->Inflector->pluralize('virus'); $expected = 'viri'; $this->assertEqual($result, $expected); + + $result = $this->Inflector->pluralize('person'); + $expected = 'people'; + $this->assertEqual($result, $expected); + + $result = $this->Inflector->pluralize('people'); + $expected = 'people'; + $this->assertEqual($result, $expected); } function testInflectorSlug() { diff --git a/cake/tests/cases/libs/model/model.test.php b/cake/tests/cases/libs/model/model.test.php index 94b519d70..2b5447e21 100644 --- a/cake/tests/cases/libs/model/model.test.php +++ b/cake/tests/cases/libs/model/model.test.php @@ -48,7 +48,7 @@ class ModelTest extends CakeTestCase { 'core.syfile', 'core.image', 'core.device_type', 'core.device_type_category', 'core.feature_set', 'core.exterior_type_category', 'core.document', 'core.device', 'core.document_directory', 'core.primary_model', 'core.secondary_model', 'core.something', 'core.something_else', 'core.join_thing', 'core.join_a', 'core.join_b', 'core.join_c', 'core.join_a_b', 'core.join_a_c', - 'core.uuid', 'core.data_test', 'core.posts_tag', 'core.the_paper_monkies', 'core.people' + 'core.uuid', 'core.data_test', 'core.posts_tag', 'core.the_paper_monkies', 'core.person' ); function start() { @@ -143,13 +143,13 @@ class ModelTest extends CakeTestCase { $sql = $db->buildStatement( array( 'fields' => $db->fields($this->Article->Tag, null, array('Tag.id', 'Tag.tag', 'ArticlesTag.article_id', 'ArticlesTag.tag_id')), - 'table' => 'tags', + 'table' => $db->fullTableName('tags'), 'alias' => 'Tag', 'limit' => null, 'offset' => null, 'joins' => array(array( 'alias' => 'ArticlesTag', - 'table' => 'articles_tags', + 'table' => $db->fullTableName('articles_tags'), 'conditions' => array( array("ArticlesTag.article_id" => '{$__cakeID__$}'), array("ArticlesTag.tag_id" => '{$__cakeIdentifier[Tag.id]__$}') @@ -376,7 +376,7 @@ class ModelTest extends CakeTestCase { } function testFindSelfAssociations() { - $this->loadFixtures('People'); + $this->loadFixtures('Person'); $this->model =& new Person(); $this->model->recursive = 2; $result = $this->model->read(null, 1); @@ -3426,5 +3426,4 @@ class ModelTest extends CakeTestCase { ClassRegistry::flush(); } } - ?> \ No newline at end of file diff --git a/cake/tests/fixtures/person_fixture.php b/cake/tests/fixtures/person_fixture.php index 81a1828c8..705bf46ca 100644 --- a/cake/tests/fixtures/person_fixture.php +++ b/cake/tests/fixtures/person_fixture.php @@ -32,8 +32,8 @@ * @package cake.tests * @subpackage cake.tests.fixtures */ -class PeopleFixture extends CakeTestFixture { - var $name = 'People'; +class PersonFixture extends CakeTestFixture { + var $name = 'Person'; var $fields = array( 'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'name' => array('type'=>'string', 'null' => false, 'length' => 32),