Skip to content

Commit

Permalink
Fix more TableRegistry references.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpustulka committed Feb 15, 2018
1 parent a6ceb0a commit ff222a8
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/TestSuite/TestCase.php
Expand Up @@ -695,7 +695,7 @@ public function getMockForModel($alias, array $methods = [], array $options = []

list(, $baseClass) = pluginSplit($alias);
$options += ['alias' => $baseClass, 'connection' => $connection];
$options += $locator->config($alias);
$options += $locator->getConfig($alias);

/** @var \Cake\ORM\Table|\PHPUnit_Framework_MockObject_MockObject $mock */
$mock = $this->getMockBuilder($options['className'])
Expand Down
Expand Up @@ -236,7 +236,7 @@ public function testRequestParamsSetting()
]
];

$table = TableRegistry::get('PaginatorPosts');
$table = $this->getTableLocator()->get('PaginatorPosts');

$this->Paginator->paginate($table, $settings);
$this->assertArrayHasKey('PaginatorPosts', $this->controller->request->getParam('paging'));
Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase/ORM/AssociationCollectionTest.php
Expand Up @@ -19,7 +19,6 @@
use Cake\ORM\Association\BelongsToMany;
use Cake\ORM\Entity;
use Cake\ORM\Locator\LocatorInterface;
use Cake\ORM\TableRegistry;
use Cake\TestSuite\TestCase;

/**
Expand Down Expand Up @@ -50,7 +49,7 @@ public function setUp()
*/
public function testConstructor()
{
$this->assertSame(TableRegistry::getTableLocator(), $this->associations->getTableLocator());
$this->assertSame($this->getTableLocator(), $this->associations->getTableLocator());

$tableLocator = $this->createMock(LocatorInterface::class);
$associations = new AssociationCollection($tableLocator);
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/ORM/Behavior/TreeBehaviorTest.php
Expand Up @@ -36,7 +36,7 @@ class TreeBehaviorTest extends TestCase
public function setUp()
{
parent::setUp();
$this->table = TableRegistry::get('NumberTrees');
$this->table = $this->getTableLocator()->get('NumberTrees');
$this->table->setPrimaryKey(['id']);
$this->table->addBehavior('Tree');
}
Expand Down Expand Up @@ -239,7 +239,7 @@ public function testFindChildren()
*/
public function testScopeNull()
{
$table = TableRegistry::get('MenuLinkTrees');
$table = $this->getTableLocator()->get('MenuLinkTrees');
$table->addBehavior('Tree');
$table->behaviors()->get('Tree')->setConfig('scope', null);

Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/ORM/QueryTest.php
Expand Up @@ -3323,7 +3323,7 @@ public function testLeftJoinWithSelect()
*/
public function testLeftJoinWithAutoFields()
{
$table = TableRegistry::get('articles');
$table = $this->getTableLocator()->get('articles');
$table->belongsTo('authors');

$results = $table
Expand Down
8 changes: 4 additions & 4 deletions tests/TestCase/ORM/TableTest.php
Expand Up @@ -652,7 +652,7 @@ public function testGetAssociationNonExistent()
{
$this->expectException(InvalidArgumentException::class);

TableRegistry::get('Groups')->getAssociation('FooBar');
$this->getTableLocator()->get('Groups')->getAssociation('FooBar');
}

/**
Expand Down Expand Up @@ -5905,7 +5905,7 @@ public function testPatchEntityMarshallerUsage()
*/
public function testPatchEntity()
{
$table = TableRegistry::get('Articles');
$table = $this->getTableLocator()->get('Articles');
$entity = new Entity(['title' => 'old title'], ['markNew' => false]);
$data = ['title' => 'new title'];
$entity = $table->patchEntity($entity, $data);
Expand Down Expand Up @@ -5950,7 +5950,7 @@ public function testPatchEntitiesMarshallerUsage()
*/
public function testPatchEntities()
{
$table = TableRegistry::get('Articles');
$table = $this->getTableLocator()->get('Articles');
$entities = $table->find()->limit(2)->toArray();

$data = [
Expand Down Expand Up @@ -6770,7 +6770,7 @@ public function testSaveOrFailErrorDisplay()
]);
$entity->setError('field', 'Some message');
$entity->setError('multiple', ['one' => 'One', 'two' => 'Two']);
$table = TableRegistry::get('users');
$table = $this->getTableLocator()->get('users');

$table->saveOrFail($entity);
}
Expand Down

0 comments on commit ff222a8

Please sign in to comment.