Skip to content

Commit

Permalink
Fix CS.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Aug 17, 2020
1 parent 306a940 commit 565e49b
Show file tree
Hide file tree
Showing 19 changed files with 39 additions and 50 deletions.
3 changes: 1 addition & 2 deletions tests/TestCase/Auth/MultiColumnAuthenticateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Cake\Http\ServerRequest;
use Cake\I18n\Time;
use Cake\ORM\TableRegistry;
use Cake\TestSuite\TestCase;
use Tools\Auth\MultiColumnAuthenticate;

Expand Down Expand Up @@ -46,7 +45,7 @@ public function setUp(): void {
]);

$password = password_hash('password', PASSWORD_DEFAULT);
$MultiColumnUsers = TableRegistry::getTableLocator()->get('MultiColumnUsers');
$MultiColumnUsers = $this->getTableLocator()->get('MultiColumnUsers');
$MultiColumnUsers->updateAll(['password' => $password], []);

$this->response = $this->getMockBuilder('Cake\Http\Response')->getMock();
Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase/Controller/ControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Tools\Test\TestCase\Controller;

use Cake\Core\Configure;
use Cake\ORM\TableRegistry;
use Shim\TestSuite\TestCase;
use Tools\Controller\Controller;

Expand Down Expand Up @@ -46,7 +45,7 @@ public function tearDown(): void {
public function testPaginate() {
Configure::write('Paginator.limit', 2);

$ToolsUser = TableRegistry::getTableLocator()->get('ToolsUsers');
$ToolsUser = $this->getTableLocator()->get('ToolsUsers');

$count = $ToolsUser->find()->count();
$this->assertTrue($count > 3);
Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase/Model/Behavior/AfterSaveBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tools\Test\TestCase\Model\Behavior;

use Cake\ORM\TableRegistry;
use Shim\TestSuite\TestCase;

class AfterSaveBehaviorTest extends TestCase {
Expand All @@ -25,7 +24,7 @@ class AfterSaveBehaviorTest extends TestCase {
public function setUp(): void {
parent::setUp();

$this->table = TableRegistry::getTableLocator()->get('Articles');
$this->table = $this->getTableLocator()->get('Articles');
$this->table->addBehavior('Tools.AfterSave');
}

Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase/Model/Behavior/BitmaskedBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tools\Test\TestCase\Model\Behavior;

use Cake\ORM\TableRegistry;
use RuntimeException;
use Shim\TestSuite\TestCase;
use TestApp\Model\Entity\BitmaskedComment;
Expand All @@ -27,7 +26,7 @@ class BitmaskedBehaviorTest extends TestCase {
public function setUp(): void {
parent::setUp();

$this->Comments = TableRegistry::getTableLocator()->get('BitmaskedComments');
$this->Comments = $this->getTableLocator()->get('BitmaskedComments');
$this->Comments->addBehavior('Tools.Bitmasked', ['mappedField' => 'statuses']);
}

Expand Down
7 changes: 3 additions & 4 deletions tests/TestCase/Model/Behavior/ConfirmableBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tools\Test\TestCase\Model\Behavior;

use Cake\ORM\TableRegistry;
use Shim\TestSuite\TestCase;

class ConfirmableBehaviorTest extends TestCase {
Expand Down Expand Up @@ -32,7 +31,7 @@ public function setUp(): void {
* @return void
*/
public function testBasicValidation() {
$this->Articles = TableRegistry::getTableLocator()->get('SluggedArticles');
$this->Articles = $this->getTableLocator()->get('SluggedArticles');
$this->Articles->addBehavior('Tools.Confirmable');

$animal = $this->Articles->newEmptyEntity();
Expand All @@ -57,7 +56,7 @@ public function testBasicValidation() {
* @return void
*/
public function testValidationThatHasBeenModifiedBefore() {
$this->Articles = TableRegistry::getTableLocator()->get('SluggedArticles');
$this->Articles = $this->getTableLocator()->get('SluggedArticles');
/*
$this->Articles->validator()->add('confirm', 'notBlank', [
'rule' => function ($value, $context) {
Expand Down Expand Up @@ -96,7 +95,7 @@ public function testValidationThatHasBeenModifiedBefore() {
* @return void
*/
public function testValidationFieldMissing() {
$this->Articles = TableRegistry::getTableLocator()->get('SluggedArticles');
$this->Articles = $this->getTableLocator()->get('SluggedArticles');
$this->Articles->addBehavior('Tools.Confirmable');

$animal = $this->Articles->newEmptyEntity();
Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase/Model/Behavior/JsonableBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tools\Test\TestCase\Model\Behavior;

use Cake\ORM\TableRegistry;
use PDOException;
use Shim\TestSuite\TestCase;
use stdClass;
Expand All @@ -27,7 +26,7 @@ class JsonableBehaviorTest extends TestCase {
public function setUp(): void {
parent::setUp();

$this->Comments = TableRegistry::getTableLocator()->get('JsonableComments');
$this->Comments = $this->getTableLocator()->get('JsonableComments');
$this->Comments->addBehavior('Tools.Jsonable', ['fields' => ['details']]);
}

Expand Down
5 changes: 2 additions & 3 deletions tests/TestCase/Model/Behavior/NeighborBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tools\Test\TestCase\Model\Behavior;

use Cake\ORM\TableRegistry;
use Shim\TestSuite\TestCase;

class NeighborBehaviorTest extends TestCase {
Expand All @@ -25,15 +24,15 @@ class NeighborBehaviorTest extends TestCase {
public function setUp(): void {
parent::setUp();

$this->Table = TableRegistry::getTableLocator()->get('Stories');
$this->Table = $this->getTableLocator()->get('Stories');
$this->Table->addBehavior('Tools.Neighbor');
}

/**
* @return void
*/
public function tearDown(): void {
TableRegistry::clear();
$this->getTableLocator()->clear();

parent::tearDown();
}
Expand Down
5 changes: 2 additions & 3 deletions tests/TestCase/Model/Behavior/PasswordableBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Cake\Auth\PasswordHasherFactory;
use Cake\Core\Configure;
use Cake\ORM\TableRegistry;
use Shim\TestSuite\TestCase;

class PasswordableBehaviorTest extends TestCase {
Expand Down Expand Up @@ -38,7 +37,7 @@ public function setUp(): void {
Configure::delete('Passwordable');
Configure::write('Passwordable.auth', 'AuthTest');

$this->Users = TableRegistry::getTableLocator()->get('ToolsUsers');
$this->Users = $this->getTableLocator()->get('ToolsUsers');

$this->hasher = PasswordHasherFactory::build('Default');
}
Expand All @@ -47,7 +46,7 @@ public function setUp(): void {
* @return void
*/
public function tearDown(): void {
TableRegistry::clear();
$this->getTableLocator()->clear();

parent::tearDown();
}
Expand Down
5 changes: 2 additions & 3 deletions tests/TestCase/Model/Behavior/ResetBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tools\Test\TestCase\Model\Behavior;

use Cake\ORM\TableRegistry;
use Shim\TestSuite\TestCase;
use TestApp\Model\Table\ResetCommentsTable;

Expand Down Expand Up @@ -31,15 +30,15 @@ class ResetBehaviorTest extends TestCase {
public function setUp(): void {
parent::setUp();

$this->Table = TableRegistry::getTableLocator()->get('ResetComments');
$this->Table = $this->getTableLocator()->get('ResetComments');
$this->Table->addBehavior('Tools.Reset');
}

/**
* @return void
*/
public function tearDown(): void {
TableRegistry::clear();
$this->getTableLocator()->clear();

parent::tearDown();
}
Expand Down
5 changes: 2 additions & 3 deletions tests/TestCase/Model/Behavior/SluggedBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Cake\Core\Configure;
use Cake\ORM\Entity;
use Cake\ORM\TableRegistry;
use RuntimeException;
use Shim\TestSuite\TestCase;
use TestApp\Model\Entity\SluggedArticle;
Expand Down Expand Up @@ -39,7 +38,7 @@ public function setUp(): void {
//$this->connection = ConnectionManager::get('test');

$options = ['alias' => 'Articles'];
$this->articles = TableRegistry::getTableLocator()->get('SluggedArticles', $options);
$this->articles = $this->getTableLocator()->get('SluggedArticles', $options);
Configure::delete('Slugged');

$this->articles->addBehavior('Tools.Slugged');
Expand All @@ -53,7 +52,7 @@ public function setUp(): void {
public function tearDown(): void {
unset($this->articles);

TableRegistry::clear();
$this->getTableLocator()->clear();
parent::tearDown();
}

Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase/Model/Behavior/StringBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tools\Test\TestCase\Model\Behavior;

use Cake\ORM\TableRegistry;
use Shim\TestSuite\TestCase;

class StringBehaviorTest extends TestCase {
Expand All @@ -25,7 +24,7 @@ class StringBehaviorTest extends TestCase {
public function setUp(): void {
parent::setUp();

$this->Comments = TableRegistry::getTableLocator()->get('StringComments');
$this->Comments = $this->getTableLocator()->get('StringComments');
$this->Comments->addBehavior('Tools.String', ['fields' => ['title'], 'input' => ['ucfirst']]);
}

Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase/Model/Behavior/ToggleBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tools\Test\TestCase\Model\Behavior;

use Cake\ORM\TableRegistry;
use Shim\TestSuite\TestCase;

class ToggleBehaviorTest extends TestCase {
Expand All @@ -25,7 +24,7 @@ class ToggleBehaviorTest extends TestCase {
public function setUp(): void {
parent::setUp();

$this->Addresses = TableRegistry::getTableLocator()->get('ToggleAddresses');
$this->Addresses = $this->getTableLocator()->get('ToggleAddresses');
$this->Addresses->addBehavior('Tools.Toggle', ['scopeFields' => 'category_id']);
}

Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase/Model/Behavior/TypeMapBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tools\Test\TestCase\Model\Behavior;

use Cake\ORM\TableRegistry;
use Shim\TestSuite\TestCase;

class TypeMapBehaviorTest extends TestCase {
Expand Down Expand Up @@ -37,7 +36,7 @@ public function setUp(): void {
* @return void
*/
public function testFields() {
$this->Table = TableRegistry::getTableLocator()->get('Data');
$this->Table = $this->getTableLocator()->get('Data');
$this->Table->addBehavior('Tools.Jsonable', ['fields' => ['data_array']]);

$entity = $this->Table->newEmptyEntity();
Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase/Model/Behavior/TypographicBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tools\Test\TestCase\Model\Behavior;

use Cake\ORM\TableRegistry;
use Shim\TestSuite\TestCase;
use Tools\Model\Behavior\TypographicBehavior;

Expand All @@ -26,7 +25,7 @@ class TypographicBehaviorTest extends TestCase {
public function setUp(): void {
parent::setUp();

$this->Model = TableRegistry::getTableLocator()->get('Articles');
$this->Model = $this->getTableLocator()->get('Articles');
$this->Model->addBehavior('Tools.Typographic', ['fields' => ['body'], 'before' => 'marshal']);
}

Expand Down
5 changes: 2 additions & 3 deletions tests/TestCase/Model/Entity/EntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tools\Test\TestCase\Model\Entity;

use Cake\ORM\TableRegistry;
use Shim\TestSuite\TestCase;
use Tools\Model\Entity\Entity;

Expand All @@ -27,14 +26,14 @@ class EntityTest extends TestCase {
public function setUp(): void {
parent::setUp();

$this->Users = TableRegistry::getTableLocator()->get('ToolsUsers');
$this->Users = $this->getTableLocator()->get('ToolsUsers');
}

/**
* @return void
*/
public function tearDown(): void {
TableRegistry::clear();
$this->getTableLocator()->clear();

parent::tearDown();
}
Expand Down
10 changes: 4 additions & 6 deletions tests/TestCase/Model/Table/TableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

namespace Tools\Test\TestCase\Model\Table;

use Cake\Datasource\ConnectionManager;
use Cake\I18n\Time;
use Cake\ORM\TableRegistry;
use Cake\Utility\Hash;
use Shim\TestSuite\TestCase;

Expand Down Expand Up @@ -38,17 +36,17 @@ class TableTest extends TestCase {
public function setUp(): void {
parent::setUp();

$this->Users = TableRegistry::getTableLocator()->get('ToolsUsers');
$this->Users = $this->getTableLocator()->get('ToolsUsers');

$this->Posts = TableRegistry::getTableLocator()->get('Posts');
$this->Posts = $this->getTableLocator()->get('Posts');
$this->Posts->belongsTo('Authors');
}

/**
* @return void
*/
public function tearDown(): void {
TableRegistry::clear();
$this->getTableLocator()->clear();

parent::tearDown();
}
Expand All @@ -69,7 +67,7 @@ public function testTruncate() {
* @return void
*/
public function testTimestamp() {
$this->Roles = TableRegistry::getTableLocator()->get('Roles');
$this->Roles = $this->getTableLocator()->get('Roles');
$entity = $this->Roles->newEntity(['name' => 'Foo', 'alias' => 'foo']);
$result = $this->Roles->save($entity);
$this->assertTrue(!empty($result['created']));
Expand Down
12 changes: 10 additions & 2 deletions tests/TestCase/Model/Table/TokensTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tools\Test\TestCase\Model\Table;

use Cake\ORM\TableRegistry;
use Shim\TestSuite\TestCase;
use Tools\Model\Table\TokensTable;

Expand All @@ -26,7 +25,16 @@ class TokensTableTest extends TestCase {
public function setUp(): void {
parent::setUp();

$this->Tokens = TableRegistry::getTableLocator()->get('Tools.Tokens');
$this->Tokens = $this->getTableLocator()->get('Tools.Tokens');
}

/**
* @return void
*/
public function tearDown(): void {
$this->getTableLocator()->clear();

parent::tearDown();
}

/**
Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase/Utility/FileLogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tools\Test\Utility;

use Cake\ORM\TableRegistry;
use Shim\TestSuite\TestCase;
use Tools\Utility\FileLog;

Expand Down Expand Up @@ -144,7 +143,7 @@ public function testLogsObject(): void {
}

$result = FileLog::write(
TableRegistry::getTableLocator()->get('Posts'),
$this->getTableLocator()->get('Posts'),
static::TEST_FILENAME_OBJECT
);

Expand Down
Loading

0 comments on commit 565e49b

Please sign in to comment.