From 197ebd175a20b0570337c3a87e8dc4cb62255ce3 Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 16 Jan 2014 21:41:22 -0500 Subject: [PATCH] Rename Model/Repository -> Model/Table. --- src/ORM/TableRegistry.php | 4 ++-- src/TestSuite/TestCase.php | 2 +- tests/TestCase/Console/ShellTest.php | 6 +++--- .../Component/PaginatorComponentTest.php | 2 +- tests/TestCase/Controller/ControllerTest.php | 8 ++++---- tests/TestCase/Core/AppTest.php | 6 +++--- tests/TestCase/ORM/TableRegistryTest.php | 12 +++++------ tests/TestCase/ORM/TableTest.php | 20 +++++++++---------- tests/TestCase/TestSuite/TestCaseTest.php | 6 +++--- .../TestPluginCommentsTable.php | 7 +++---- .../{Repository => Table}/ArticlesTable.php | 2 +- .../ArticlesTagsTable.php | 2 +- .../{Repository => Table}/AuthUsersTable.php | 2 +- .../{Repository => Table}/AuthorsTable.php | 2 +- .../PaginatorPostsTable.php | 2 +- .../{Repository => Table}/PostsTable.php | 2 +- .../Model/{Repository => Table}/TagsTable.php | 2 +- .../test_theme/img/__cake_test_image.gif | 0 .../webroot/theme/test_theme/js/__test_js.js | 0 19 files changed, 43 insertions(+), 44 deletions(-) rename tests/test_app/Plugin/TestPlugin/Model/{Repository => Table}/TestPluginCommentsTable.php (95%) rename tests/test_app/TestApp/Model/{Repository => Table}/ArticlesTable.php (94%) rename tests/test_app/TestApp/Model/{Repository => Table}/ArticlesTagsTable.php (94%) rename tests/test_app/TestApp/Model/{Repository => Table}/AuthUsersTable.php (93%) rename tests/test_app/TestApp/Model/{Repository => Table}/AuthorsTable.php (94%) rename tests/test_app/TestApp/Model/{Repository => Table}/PaginatorPostsTable.php (97%) rename tests/test_app/TestApp/Model/{Repository => Table}/PostsTable.php (94%) rename tests/test_app/TestApp/Model/{Repository => Table}/TagsTable.php (94%) create mode 100644 tests/test_app/webroot/theme/test_theme/img/__cake_test_image.gif create mode 100644 tests/test_app/webroot/theme/test_theme/js/__test_js.js diff --git a/src/ORM/TableRegistry.php b/src/ORM/TableRegistry.php index 086c9d950a9..e5ed8fda8a1 100644 --- a/src/ORM/TableRegistry.php +++ b/src/ORM/TableRegistry.php @@ -117,7 +117,7 @@ public static function config($alias = null, $options = null) { * * If $options does not contain `className` CakePHP will attempt to construct the * class name based on the alias. For example 'Users' would result in - * `App\Model\Repository\UsersTable` being attempted. If this class does not exist, + * `App\Model\Table\UsersTable` being attempted. If this class does not exist, * then the default `Cake\ORM\Table` class will be used. By setting the `className` * option you can define the specific class to use. This className can * use a short class reference. @@ -151,7 +151,7 @@ public static function get($alias, $options = []) { if (empty($options['className'])) { $class = Inflector::camelize($alias); - $className = App::classname($class, 'Model/Repository', 'Table'); + $className = App::classname($class, 'Model/Table', 'Table'); $options['className'] = $className ?: 'Cake\ORM\Table'; } diff --git a/src/TestSuite/TestCase.php b/src/TestSuite/TestCase.php index 428c82b932d..97762470c0e 100644 --- a/src/TestSuite/TestCase.php +++ b/src/TestSuite/TestCase.php @@ -595,7 +595,7 @@ protected function skipUnless($condition, $message = '') { public function getMockForModel($alias, $methods = array(), $options = array()) { if (empty($options['className'])) { $class = Inflector::camelize($alias); - $className = App::classname($class, 'Model/Repository', 'Table'); + $className = App::classname($class, 'Model/Table', 'Table'); if (!$className) { throw new \Cake\ORM\Error\MissingTableClassException(array($alias)); } diff --git a/tests/TestCase/Console/ShellTest.php b/tests/TestCase/Console/ShellTest.php index 59bda363762..1f76b52d58b 100644 --- a/tests/TestCase/Console/ShellTest.php +++ b/tests/TestCase/Console/ShellTest.php @@ -176,7 +176,7 @@ public function testInitialize() { $this->assertTrue(isset($this->Shell->TestPluginComments)); $this->assertInstanceOf( - 'TestPlugin\Model\Repository\TestPluginCommentsTable', + 'TestPlugin\Model\Table\TestPluginCommentsTable', $this->Shell->TestPluginComments ); } @@ -191,7 +191,7 @@ public function testLoadModel() { $Shell = new MergeShell(); $this->assertInstanceOf( - 'TestApp\Model\Repository\ArticlesTable', + 'TestApp\Model\Table\ArticlesTable', $Shell->Articles ); $this->assertEquals('Articles', $Shell->modelClass); @@ -200,7 +200,7 @@ public function testLoadModel() { $this->Shell->loadModel('TestPlugin.TestPluginComments'); $this->assertTrue(isset($this->Shell->TestPluginComments)); $this->assertInstanceOf( - 'TestPlugin\Model\Repository\TestPluginCommentsTable', + 'TestPlugin\Model\Table\TestPluginCommentsTable', $this->Shell->TestPluginComments ); } diff --git a/tests/TestCase/Controller/Component/PaginatorComponentTest.php b/tests/TestCase/Controller/Component/PaginatorComponentTest.php index ee8755d6d2b..1caf45625ad 100644 --- a/tests/TestCase/Controller/Component/PaginatorComponentTest.php +++ b/tests/TestCase/Controller/Component/PaginatorComponentTest.php @@ -710,7 +710,7 @@ public function testPaginateCustomFindCount() { */ protected function _getMockPosts($methods = []) { return $this->getMock( - 'TestApp\Model\Repository\PaginatorPostsTable', + 'TestApp\Model\Table\PaginatorPostsTable', $methods, [['connection' => ConnectionManager::get('test'), 'alias' => 'PaginatorPosts']] ); diff --git a/tests/TestCase/Controller/ControllerTest.php b/tests/TestCase/Controller/ControllerTest.php index 5e1c3a981ef..af41f4341d5 100644 --- a/tests/TestCase/Controller/ControllerTest.php +++ b/tests/TestCase/Controller/ControllerTest.php @@ -234,7 +234,7 @@ public function tearDown() { * * @return void */ - public function testRepositoryAutoload() { + public function testTableAutoload() { Configure::write('App.namespace', 'TestApp'); $request = new Request('controller_posts/index'); $response = $this->getMock('Cake\Network\Response'); @@ -242,7 +242,7 @@ public function testRepositoryAutoload() { $Controller->modelClass = 'Articles'; $this->assertInstanceOf( - 'TestApp\Model\Repository\ArticlesTable', + 'TestApp\Model\Table\ArticlesTable', $Controller->Articles ); } @@ -263,7 +263,7 @@ public function testLoadModel() { $result = $Controller->loadModel('Articles'); $this->assertTrue($result); $this->assertInstanceOf( - 'TestApp\Model\Repository\ArticlesTable', + 'TestApp\Model\Table\ArticlesTable', $Controller->Articles ); } @@ -285,7 +285,7 @@ public function testLoadModelInPlugins() { $result = $Controller->loadModel('TestPlugin.TestPluginComments'); $this->assertTrue($result); $this->assertInstanceOf( - 'TestPlugin\Model\Repository\TestPluginCommentsTable', + 'TestPlugin\Model\Table\TestPluginCommentsTable', $Controller->TestPluginComments ); } diff --git a/tests/TestCase/Core/AppTest.php b/tests/TestCase/Core/AppTest.php index a1d77c0ecc7..655ded7690c 100644 --- a/tests/TestCase/Core/AppTest.php +++ b/tests/TestCase/Core/AppTest.php @@ -173,7 +173,7 @@ public function testListObjects() { $result = App::objects('View/Helper', null, false); $this->assertContains('BananaHelper', $result); - $result = App::objects('Model/Repository', null, false); + $result = App::objects('Model/Table', null, false); $this->assertContains('ArticlesTable', $result); $result = App::objects('file'); @@ -214,7 +214,7 @@ public function testListObjectsIgnoreDotDirectories() { public function testListObjectsInPlugin() { Plugin::load(array('TestPlugin', 'TestPluginTwo')); - $result = App::objects('TestPlugin.Model/Repository'); + $result = App::objects('TestPlugin.Model/Table'); $this->assertContains('TestPluginCommentsTable', $result); $result = App::objects('TestPlugin.Model/Behavior'); @@ -230,7 +230,7 @@ public function testListObjectsInPlugin() { $result = App::objects('TestPluginTwo.Model/Behavior'); $this->assertSame(array(), $result); - $result = App::objects('Model/Repository', null, false); + $result = App::objects('Model/Table', null, false); $this->assertContains('PostsTable', $result); $this->assertContains('ArticlesTable', $result); } diff --git a/tests/TestCase/ORM/TableRegistryTest.php b/tests/TestCase/ORM/TableRegistryTest.php index b1ada856008..b8b3b756f6e 100644 --- a/tests/TestCase/ORM/TableRegistryTest.php +++ b/tests/TestCase/ORM/TableRegistryTest.php @@ -159,22 +159,22 @@ public function testGetExistingWithConfigData() { */ public function testBuildConvention() { $table = TableRegistry::get('articles'); - $this->assertInstanceOf('\TestApp\Model\Repository\ArticlesTable', $table); + $this->assertInstanceOf('\TestApp\Model\Table\ArticlesTable', $table); $table = TableRegistry::get('Articles'); - $this->assertInstanceOf('\TestApp\Model\Repository\ArticlesTable', $table); + $this->assertInstanceOf('\TestApp\Model\Table\ArticlesTable', $table); $table = TableRegistry::get('authors'); - $this->assertInstanceOf('\TestApp\Model\Repository\AuthorsTable', $table); + $this->assertInstanceOf('\TestApp\Model\Table\AuthorsTable', $table); $table = TableRegistry::get('Authors'); - $this->assertInstanceOf('\TestApp\Model\Repository\AuthorsTable', $table); + $this->assertInstanceOf('\TestApp\Model\Table\AuthorsTable', $table); $class = $this->getMockClass('\Cake\ORM\Table'); $class::staticExpects($this->once()) ->method('defaultConnectionName') ->will($this->returnValue('test')); - if (!class_exists('MyPlugin\Model\Repository\SuperTestsTable')) { - class_alias($class, 'MyPlugin\Model\Repository\SuperTestsTable'); + if (!class_exists('MyPlugin\Model\Table\SuperTestsTable')) { + class_alias($class, 'MyPlugin\Model\Table\SuperTestsTable'); } $table = TableRegistry::get('MyPlugin.SuperTests'); diff --git a/tests/TestCase/ORM/TableTest.php b/tests/TestCase/ORM/TableTest.php index 2d2074f782b..3e08624d486 100644 --- a/tests/TestCase/ORM/TableTest.php +++ b/tests/TestCase/ORM/TableTest.php @@ -807,7 +807,7 @@ public function testEntityClassDefault() { * * @return void */ - public function testRepositoryClassInApp() { + public function testTableClassInApp() { $class = $this->getMockClass('\Cake\ORM\Entity'); if (!class_exists('TestApp\Model\Entity\TestUser')) { @@ -824,7 +824,7 @@ class_alias($class, 'TestApp\Model\Entity\TestUser'); * * @return void */ - public function testRepositoryClassInPlugin() { + public function testTableClassInPlugin() { $class = $this->getMockClass('\Cake\ORM\Entity'); if (!class_exists('MyPlugin\Model\Entity\SuperUser')) { @@ -846,7 +846,7 @@ class_alias($class, 'MyPlugin\Model\Entity\SuperUser'); * @expectedExceptionMessage Entity class FooUser could not be found. * @return void */ - public function testRepositoryClassNonExisting() { + public function testTableClassNonExisting() { $table = new Table; $this->assertFalse($table->entityClass('FooUser')); } @@ -857,8 +857,8 @@ public function testRepositoryClassNonExisting() { * * @return void */ - public function testRepositoryClassConventionForAPP() { - $table = new \TestApp\Model\Repository\ArticlesTable; + public function testTableClassConventionForAPP() { + $table = new \TestApp\Model\Table\ArticlesTable; $this->assertEquals('TestApp\Model\Entity\Article', $table->entityClass()); } @@ -881,7 +881,7 @@ public function testSetEntityClass() { * @return void */ public function testReciprocalBelongsToLoading() { - $table = new \TestApp\Model\Repository\ArticlesTable([ + $table = new \TestApp\Model\Table\ArticlesTable([ 'connection' => $this->connection, ]); $result = $table->find('all')->contain(['authors'])->first(); @@ -895,7 +895,7 @@ public function testReciprocalBelongsToLoading() { * @return void */ public function testReciprocalHasManyLoading() { - $table = new \TestApp\Model\Repository\ArticlesTable([ + $table = new \TestApp\Model\Table\ArticlesTable([ 'connection' => $this->connection, ]); $result = $table->find('all')->contain(['authors' => ['articles']])->first(); @@ -912,7 +912,7 @@ public function testReciprocalHasManyLoading() { * @return void */ public function testReciprocalBelongsToMany() { - $table = new \TestApp\Model\Repository\ArticlesTable([ + $table = new \TestApp\Model\Table\ArticlesTable([ 'connection' => $this->connection, ]); $result = $table->find('all')->contain(['tags'])->first(); @@ -929,7 +929,7 @@ public function testReciprocalBelongsToMany() { * @return void */ public function testFindCleanEntities() { - $table = new \TestApp\Model\Repository\ArticlesTable([ + $table = new \TestApp\Model\Table\ArticlesTable([ 'connection' => $this->connection, ]); $results = $table->find('all')->contain(['tags', 'authors'])->toArray(); @@ -956,7 +956,7 @@ public function testFindCleanEntities() { * @return void */ public function testFindPersistedEntities() { - $table = new \TestApp\Model\Repository\ArticlesTable([ + $table = new \TestApp\Model\Table\ArticlesTable([ 'connection' => $this->connection, ]); $results = $table->find('all')->contain(['tags', 'authors'])->toArray(); diff --git a/tests/TestCase/TestSuite/TestCaseTest.php b/tests/TestCase/TestSuite/TestCaseTest.php index c73ce7aba40..8c358623d06 100644 --- a/tests/TestCase/TestSuite/TestCaseTest.php +++ b/tests/TestCase/TestSuite/TestCaseTest.php @@ -352,7 +352,7 @@ public function testGetMockForModel() { $Posts = $this->getMockForModel('Posts'); $entity = new \Cake\ORM\Entity(array()); - $this->assertInstanceOf('TestApp\Model\Repository\PostsTable', $Posts); + $this->assertInstanceOf('TestApp\Model\Table\PostsTable', $Posts); $this->assertNull($Posts->save($entity)); $this->assertNull($Posts->table()); @@ -381,11 +381,11 @@ public function testGetMockForModelWithPlugin() { $TestPluginComment = $this->getMockForModel('TestPlugin.TestPluginComments'); $result = TableRegistry::get('TestPlugin.TestPluginComments'); - $this->assertInstanceOf('\TestPlugin\Model\Repository\TestPluginCommentsTable', $result); + $this->assertInstanceOf('\TestPlugin\Model\Table\TestPluginCommentsTable', $result); $TestPluginComment = $this->getMockForModel('TestPlugin.TestPluginComments', array('save')); - $this->assertInstanceOf('\TestPlugin\Model\Repository\TestPluginCommentsTable', $TestPluginComment); + $this->assertInstanceOf('\TestPlugin\Model\Table\TestPluginCommentsTable', $TestPluginComment); $TestPluginComment->expects($this->at(0)) ->method('save') ->will($this->returnValue(true)); diff --git a/tests/test_app/Plugin/TestPlugin/Model/Repository/TestPluginCommentsTable.php b/tests/test_app/Plugin/TestPlugin/Model/Table/TestPluginCommentsTable.php similarity index 95% rename from tests/test_app/Plugin/TestPlugin/Model/Repository/TestPluginCommentsTable.php rename to tests/test_app/Plugin/TestPlugin/Model/Table/TestPluginCommentsTable.php index c79f18adfba..1d4f41dc8d7 100644 --- a/tests/test_app/Plugin/TestPlugin/Model/Repository/TestPluginCommentsTable.php +++ b/tests/test_app/Plugin/TestPlugin/Model/Table/TestPluginCommentsTable.php @@ -14,15 +14,14 @@ * @since CakePHP v 3.0.0 * @license http://www.opensource.org/licenses/mit-license.php MIT License */ +namespace TestPlugin\Model\Table; + +use Cake\ORM\Table; /** * Class TestPluginCommentsTable * */ -namespace TestPlugin\Model\Repository; - -use Cake\ORM\Table; - class TestPluginCommentsTable extends Table { protected $_table = 'test_plugin_comments'; diff --git a/tests/test_app/TestApp/Model/Repository/ArticlesTable.php b/tests/test_app/TestApp/Model/Table/ArticlesTable.php similarity index 94% rename from tests/test_app/TestApp/Model/Repository/ArticlesTable.php rename to tests/test_app/TestApp/Model/Table/ArticlesTable.php index 04c83e4fd42..8fa69ea6301 100644 --- a/tests/test_app/TestApp/Model/Repository/ArticlesTable.php +++ b/tests/test_app/TestApp/Model/Table/ArticlesTable.php @@ -9,7 +9,7 @@ * @since CakePHP(tm) v 3.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -namespace TestApp\Model\Repository; +namespace TestApp\Model\Table; use Cake\ORM\Table; diff --git a/tests/test_app/TestApp/Model/Repository/ArticlesTagsTable.php b/tests/test_app/TestApp/Model/Table/ArticlesTagsTable.php similarity index 94% rename from tests/test_app/TestApp/Model/Repository/ArticlesTagsTable.php rename to tests/test_app/TestApp/Model/Table/ArticlesTagsTable.php index 8354a76c002..632f95ae2f5 100644 --- a/tests/test_app/TestApp/Model/Repository/ArticlesTagsTable.php +++ b/tests/test_app/TestApp/Model/Table/ArticlesTagsTable.php @@ -9,7 +9,7 @@ * @since CakePHP(tm) v 3.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -namespace TestApp\Model\Repository; +namespace TestApp\Model\Table; use Cake\ORM\Table; diff --git a/tests/test_app/TestApp/Model/Repository/AuthUsersTable.php b/tests/test_app/TestApp/Model/Table/AuthUsersTable.php similarity index 93% rename from tests/test_app/TestApp/Model/Repository/AuthUsersTable.php rename to tests/test_app/TestApp/Model/Table/AuthUsersTable.php index 6f7205e3d22..a2a8ec5fcd3 100644 --- a/tests/test_app/TestApp/Model/Repository/AuthUsersTable.php +++ b/tests/test_app/TestApp/Model/Table/AuthUsersTable.php @@ -9,7 +9,7 @@ * @since CakePHP(tm) v 3.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -namespace TestApp\Model\Repository; +namespace TestApp\Model\Table; use Cake\ORM\Table; diff --git a/tests/test_app/TestApp/Model/Repository/AuthorsTable.php b/tests/test_app/TestApp/Model/Table/AuthorsTable.php similarity index 94% rename from tests/test_app/TestApp/Model/Repository/AuthorsTable.php rename to tests/test_app/TestApp/Model/Table/AuthorsTable.php index 28ef5dfb259..0f4d04601c4 100644 --- a/tests/test_app/TestApp/Model/Repository/AuthorsTable.php +++ b/tests/test_app/TestApp/Model/Table/AuthorsTable.php @@ -9,7 +9,7 @@ * @since CakePHP(tm) v 3.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -namespace TestApp\Model\Repository; +namespace TestApp\Model\Table; use Cake\ORM\Table; diff --git a/tests/test_app/TestApp/Model/Repository/PaginatorPostsTable.php b/tests/test_app/TestApp/Model/Table/PaginatorPostsTable.php similarity index 97% rename from tests/test_app/TestApp/Model/Repository/PaginatorPostsTable.php rename to tests/test_app/TestApp/Model/Table/PaginatorPostsTable.php index 58a4b2c92c0..fa1fd1dfe44 100644 --- a/tests/test_app/TestApp/Model/Repository/PaginatorPostsTable.php +++ b/tests/test_app/TestApp/Model/Table/PaginatorPostsTable.php @@ -11,7 +11,7 @@ * @since CakePHP v 3.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -namespace TestApp\Model\Repository; +namespace TestApp\Model\Table; use Cake\ORM\Query; use Cake\ORM\Table; diff --git a/tests/test_app/TestApp/Model/Repository/PostsTable.php b/tests/test_app/TestApp/Model/Table/PostsTable.php similarity index 94% rename from tests/test_app/TestApp/Model/Repository/PostsTable.php rename to tests/test_app/TestApp/Model/Table/PostsTable.php index ca0dce21176..e65ec5f4bab 100644 --- a/tests/test_app/TestApp/Model/Repository/PostsTable.php +++ b/tests/test_app/TestApp/Model/Table/PostsTable.php @@ -13,7 +13,7 @@ * @since CakePHP v 3.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -namespace TestApp\Model\Repository; +namespace TestApp\Model\Table; use Cake\ORM\Table; diff --git a/tests/test_app/TestApp/Model/Repository/TagsTable.php b/tests/test_app/TestApp/Model/Table/TagsTable.php similarity index 94% rename from tests/test_app/TestApp/Model/Repository/TagsTable.php rename to tests/test_app/TestApp/Model/Table/TagsTable.php index 1776a44a7e1..f0316fec462 100644 --- a/tests/test_app/TestApp/Model/Repository/TagsTable.php +++ b/tests/test_app/TestApp/Model/Table/TagsTable.php @@ -9,7 +9,7 @@ * @since CakePHP(tm) v 3.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -namespace TestApp\Model\Repository; +namespace TestApp\Model\Table; use Cake\ORM\Table; diff --git a/tests/test_app/webroot/theme/test_theme/img/__cake_test_image.gif b/tests/test_app/webroot/theme/test_theme/img/__cake_test_image.gif new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/test_app/webroot/theme/test_theme/js/__test_js.js b/tests/test_app/webroot/theme/test_theme/js/__test_js.js new file mode 100644 index 00000000000..e69de29bb2d