Browse Source

Rename Model/Repository -> Model/Table.

mark_story 12 years ago
parent
commit
197ebd175a

+ 2 - 2
src/ORM/TableRegistry.php

@@ -117,7 +117,7 @@ class TableRegistry {
  *
  * 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 @@ class TableRegistry {
 
 		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';
 		}
 

+ 1 - 1
src/TestSuite/TestCase.php

@@ -595,7 +595,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
 	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));
 			}

+ 3 - 3
tests/TestCase/Console/ShellTest.php

@@ -176,7 +176,7 @@ class ShellTest extends TestCase {
 
 		$this->assertTrue(isset($this->Shell->TestPluginComments));
 		$this->assertInstanceOf(
-			'TestPlugin\Model\Repository\TestPluginCommentsTable',
+			'TestPlugin\Model\Table\TestPluginCommentsTable',
 			$this->Shell->TestPluginComments
 		);
 	}
@@ -191,7 +191,7 @@ class ShellTest extends TestCase {
 
 		$Shell = new MergeShell();
 		$this->assertInstanceOf(
-			'TestApp\Model\Repository\ArticlesTable',
+			'TestApp\Model\Table\ArticlesTable',
 			$Shell->Articles
 		);
 		$this->assertEquals('Articles', $Shell->modelClass);
@@ -200,7 +200,7 @@ class ShellTest extends TestCase {
 		$this->Shell->loadModel('TestPlugin.TestPluginComments');
 		$this->assertTrue(isset($this->Shell->TestPluginComments));
 		$this->assertInstanceOf(
-			'TestPlugin\Model\Repository\TestPluginCommentsTable',
+			'TestPlugin\Model\Table\TestPluginCommentsTable',
 			$this->Shell->TestPluginComments
 		);
 	}

+ 1 - 1
tests/TestCase/Controller/Component/PaginatorComponentTest.php

@@ -710,7 +710,7 @@ class PaginatorComponentTest extends TestCase {
  */
 	protected function _getMockPosts($methods = []) {
 		return $this->getMock(
-			'TestApp\Model\Repository\PaginatorPostsTable',
+			'TestApp\Model\Table\PaginatorPostsTable',
 			$methods,
 			[['connection' => ConnectionManager::get('test'), 'alias' => 'PaginatorPosts']]
 		);

+ 4 - 4
tests/TestCase/Controller/ControllerTest.php

@@ -234,7 +234,7 @@ class ControllerTest extends TestCase {
  *
  * @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 @@ class ControllerTest extends TestCase {
 		$Controller->modelClass = 'Articles';
 
 		$this->assertInstanceOf(
-			'TestApp\Model\Repository\ArticlesTable',
+			'TestApp\Model\Table\ArticlesTable',
 			$Controller->Articles
 		);
 	}
@@ -263,7 +263,7 @@ class ControllerTest extends TestCase {
 		$result = $Controller->loadModel('Articles');
 		$this->assertTrue($result);
 		$this->assertInstanceOf(
-			'TestApp\Model\Repository\ArticlesTable',
+			'TestApp\Model\Table\ArticlesTable',
 			$Controller->Articles
 		);
 	}
@@ -285,7 +285,7 @@ class ControllerTest extends TestCase {
 		$result = $Controller->loadModel('TestPlugin.TestPluginComments');
 		$this->assertTrue($result);
 		$this->assertInstanceOf(
-			'TestPlugin\Model\Repository\TestPluginCommentsTable',
+			'TestPlugin\Model\Table\TestPluginCommentsTable',
 			$Controller->TestPluginComments
 		);
 	}

+ 3 - 3
tests/TestCase/Core/AppTest.php

@@ -173,7 +173,7 @@ class AppTest extends TestCase {
 		$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 @@ class AppTest extends TestCase {
 	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 @@ class AppTest extends TestCase {
 		$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);
 	}

+ 6 - 6
tests/TestCase/ORM/TableRegistryTest.php

@@ -159,22 +159,22 @@ class TableRegistryTest extends TestCase {
  */
 	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');

+ 10 - 10
tests/TestCase/ORM/TableTest.php

@@ -807,7 +807,7 @@ class TableTest extends \Cake\TestSuite\TestCase {
  *
  * @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 TableTest extends \Cake\TestSuite\TestCase {
  *
  * @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 TableTest extends \Cake\TestSuite\TestCase {
  * @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 @@ class TableTest extends \Cake\TestSuite\TestCase {
  *
  * @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 @@ class TableTest extends \Cake\TestSuite\TestCase {
  * @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 @@ class TableTest extends \Cake\TestSuite\TestCase {
  * @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 @@ class TableTest extends \Cake\TestSuite\TestCase {
  * @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 @@ class TableTest extends \Cake\TestSuite\TestCase {
  * @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 @@ class TableTest extends \Cake\TestSuite\TestCase {
  * @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();

+ 3 - 3
tests/TestCase/TestSuite/TestCaseTest.php

@@ -352,7 +352,7 @@ class TestCaseTest extends TestCase {
 		$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 @@ class TestCaseTest extends TestCase {
 		$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));

+ 3 - 4
tests/test_app/Plugin/TestPlugin/Model/Repository/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';

+ 1 - 1
tests/test_app/TestApp/Model/Repository/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;
 

+ 1 - 1
tests/test_app/TestApp/Model/Repository/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;
 

+ 1 - 1
tests/test_app/TestApp/Model/Repository/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;
 

+ 1 - 1
tests/test_app/TestApp/Model/Repository/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;
 

+ 1 - 1
tests/test_app/TestApp/Model/Repository/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;

+ 1 - 1
tests/test_app/TestApp/Model/Repository/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;
 

+ 1 - 1
tests/test_app/TestApp/Model/Repository/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;
 

+ 0 - 0
tests/test_app/webroot/theme/test_theme/img/__cake_test_image.gif


+ 0 - 0
tests/test_app/webroot/theme/test_theme/js/__test_js.js