Skip to content
Permalink
Browse files

Convert remaining uses of moved functions over to new class.

Change references to Table methods to use TableRegistry.
  • Loading branch information...
markstory committed Oct 7, 2013
1 parent fc23f74 commit 38e7469c5c47effeb1453d49470e7d960ed4f0d5
@@ -19,12 +19,14 @@
use Cake\ORM\Association\BelongsToMany;
use Cake\ORM\Query;
use Cake\ORM\Table;
use Cake\ORM\TableRegistry;
use Cake\TestSuite\TestCase;
/**
* Tests BelongsToMany class
*
*/
class BelongsToManyTest extends \Cake\TestSuite\TestCase {
class BelongsToManyTest extends TestCase {
/**
* Set up
@@ -47,7 +49,7 @@ public function setUp() {
'id' => ['type' => 'integer'],
'name' => ['type' => 'string'],
]);
Table::instance('Article', $this->article);
TableRegistry::set('Article', $this->article);
}
/**
@@ -57,7 +59,7 @@ public function setUp() {
*/
public function tearDown() {
parent::tearDown();
Table::clearRegistry();
TableRegistry::clear();
}
/**
@@ -126,7 +128,7 @@ public function testPivot() {
$this->assertInstanceOf($hasMany, $this->tag->association('ArticlesTag'));
$this->assertSame($pivot, $assoc->pivot());
$pivot2 = Table::build('Foo');
$pivot2 = TableRegistry::get('Foo');
$assoc->pivot($pivot2);
$this->assertSame($pivot2, $assoc->pivot());
@@ -163,7 +165,7 @@ public function testAttachTo() {
'targetTable' => $this->tag,
'conditions' => ['Tag.name' => 'cake']
];
Table::build('ArticlesTag', [
TableRegistry::get('ArticlesTag', [
'table' => 'articles_tags',
'schema' => [
'article_id' => ['type' => 'integer'],
@@ -213,7 +215,7 @@ public function testAttachToNoFields() {
'targetTable' => $this->tag,
'conditions' => ['Tag.name' => 'cake']
];
Table::build('ArticlesTag', [
TableRegistry::get('ArticlesTag', [
'table' => 'articles_tags',
'schema' => [
'article_id' => ['type' => 'integer'],
@@ -254,7 +256,7 @@ public function testEagerLoader() {
'sourceTable' => $this->article,
'targetTable' => $this->tag,
];
Table::build('ArticlesTag', [
TableRegistry::get('ArticlesTag', [
'table' => 'articles_tags',
'schema' => [
'article_id' => ['type' => 'integer'],
@@ -310,7 +312,7 @@ public function testEagerLoaderWithDefaults() {
'conditions' => ['Tag.name' => 'foo'],
'sort' => ['id' => 'ASC'],
];
Table::build('ArticlesTag', [
TableRegistry::get('ArticlesTag', [
'table' => 'articles_tags',
'schema' => [
'article_id' => ['type' => 'integer'],
@@ -362,7 +364,7 @@ public function testEagerLoaderWithOverrides() {
'conditions' => ['Tag.name' => 'foo'],
'sort' => ['id' => 'ASC'],
];
Table::build('ArticlesTag', [
TableRegistry::get('ArticlesTag', [
'table' => 'articles_tags',
'schema' => [
'article_id' => ['type' => 'integer'],
@@ -432,7 +434,7 @@ public function testEagerLoaderFieldsException() {
'conditions' => ['Tag.name' => 'foo'],
'sort' => ['id' => 'ASC'],
];
Table::build('ArticlesTag', [
TableRegistry::get('ArticlesTag', [
'table' => 'articles_tags',
'schema' => [
'article_id' => ['type' => 'integer'],
@@ -468,7 +470,7 @@ public function testEagerLoaderSubquery() {
'conditions' => ['Tag.name' => 'foo'],
'sort' => ['id' => 'ASC'],
];
Table::build('ArticlesTag', [
TableRegistry::get('ArticlesTag', [
'table' => 'articles_tags',
'schema' => [
'article_id' => ['type' => 'integer'],
@@ -19,6 +19,7 @@
use Cake\ORM\Association\BelongsTo;
use Cake\ORM\Query;
use Cake\ORM\Table;
use Cake\ORM\TableRegistry;
/**
* Tests BelongsTo class
@@ -33,13 +34,13 @@ class BelongsToTest extends \Cake\TestSuite\TestCase {
*/
public function setUp() {
parent::setUp();
$this->company = Table::build('Company', [
$this->company = TableRegistry::get('Company', [
'schema' => [
'id' => ['type' => 'integer'],
'company_name' => ['type' => 'string'],
]
]);
$this->client = Table::build('Client', [
$this->client = TableRegistry::get('Client', [
'schema' => [
'id' => ['type' => 'integer'],
'client_name' => ['type' => 'string'],
@@ -55,7 +56,7 @@ public function setUp() {
*/
public function tearDown() {
parent::tearDown();
Table::clearRegistry();
TableRegistry::clear();
}
/**
@@ -19,6 +19,7 @@
use Cake\ORM\Association\HasMany;
use Cake\ORM\Query;
use Cake\ORM\Table;
use Cake\ORM\TableRegistry;
/**
* Tests HasMany class
@@ -33,7 +34,7 @@ class HasManyTest extends \Cake\TestSuite\TestCase {
*/
public function setUp() {
parent::setUp();
$this->author = Table::build('Author', [
$this->author = TableRegistry::get('Author', [
'schema' => [
'id' => ['type' => 'integer'],
'username' => ['type' => 'string'],
@@ -56,7 +57,7 @@ public function setUp() {
*/
public function tearDown() {
parent::tearDown();
Table::clearRegistry();
TableRegistry::clear();
}
/**
@@ -19,6 +19,7 @@
use Cake\ORM\Association\HasOne;
use Cake\ORM\Query;
use Cake\ORM\Table;
use Cake\ORM\TableRegistry;
/**
* Tests HasOne class
@@ -33,13 +34,13 @@ class HasOneTest extends \Cake\TestSuite\TestCase {
*/
public function setUp() {
parent::setUp();
$this->user = Table::build('User', [
$this->user = TableRegistry::get('User', [
'schema' => [
'id' => ['type' => 'integer'],
'username' => ['type' => 'string'],
]
]);
$this->profile = Table::build('Profile', [
$this->profile = TableRegistry::get('Profile', [
'schema' => [
'id' => ['type' => 'integer'],
'first_name' => ['type' => 'string'],
@@ -55,7 +56,7 @@ public function setUp() {
*/
public function tearDown() {
parent::tearDown();
Table::clearRegistry();
TableRegistry::clear();
}
/**
@@ -18,11 +18,12 @@
use Cake\ORM\Association;
use Cake\ORM\Table;
use Cake\ORM\TableRegistry;
/**
* A Test double used to assert that default tables are created
*
**/
*/
class TestTable extends Table {
}
@@ -63,7 +64,7 @@ public function setUp() {
*/
public function tearDown() {
parent::tearDown();
Table::clearRegistry();
TableRegistry::clear();
}
/**
Oops, something went wrong.

0 comments on commit 38e7469

Please sign in to comment.
You can’t perform that action at this time.