Permalink
Browse files

Rename Model/Repository -> Model/Table.

  • Loading branch information...
1 parent d38888e commit 197ebd175a20b0570337c3a87e8dc4cb62255ce3 @markstory markstory committed Jan 17, 2014
@@ -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';
}
@@ -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));
}
@@ -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
);
}
@@ -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']]
);
@@ -234,15 +234,15 @@ 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');
$Controller = new Controller($request, $response);
$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
);
}
@@ -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);
}
@@ -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');
@@ -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();
@@ -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));
@@ -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';
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 197ebd1

Please sign in to comment.