Skip to content

Commit

Permalink
Remove use of deprecated methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Dec 12, 2018
1 parent 336a97f commit 7ff3b8d
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 34 deletions.
10 changes: 5 additions & 5 deletions tests/TestCase/Shell/BakeShellTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,12 @@ public function testLoadTasksPlugin()
*/
public function testLoadTasksVendoredPlugin()
{
$this->deprecated(function () {
Plugin::load('Pastry/PastryTest', [
$this->loadPlugins([
'Pastry/PastryTest' => [
'path' => Configure::read('App.paths.plugins')[0] . 'PastryTest' . DS,
'autoload' => true
]);
});
'autoload' => true,
],
]);

$this->Shell->loadTasks();
$this->assertContains('Pastry/PastryTest.ApplePie', $this->Shell->tasks);
Expand Down
1 change: 1 addition & 0 deletions tests/TestCase/Shell/Task/BakeTemplateTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function setUp()
public function tearDown()
{
parent::tearDown();

unset($this->Task);
$this->removePlugins(['TestBakeTheme']);
}
Expand Down
5 changes: 3 additions & 2 deletions tests/TestCase/Shell/Task/ControllerTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ public function tearDown()
{
unset($this->Task);
TableRegistry::getTableLocator()->clear();

parent::tearDown();
$this->removePlugins(['ControllerTest']);
$this->removePlugins(['Company/Pastry']);

$this->removePlugins(['ControllerTest', 'Company/Pastry']);
}

/**
Expand Down
4 changes: 1 addition & 3 deletions tests/TestCase/Shell/Task/FixtureTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,7 @@ public function testMainWithSingularTable()
*/
public function testMainWithPluginModel()
{
$this->deprecated(function () {
Plugin::load('FixtureTest', ['path' => APP . 'Plugin/FixtureTest/']);
});
$this->loadPlugins(['FixtureTest' => ['path' => APP . 'Plugin/FixtureTest/']]);

$this->generatedFile = APP . 'Plugin/FixtureTest/tests/Fixture/ArticlesFixture.php';
$this->exec('bake fixture --connection test FixtureTest.Articles');
Expand Down
6 changes: 3 additions & 3 deletions tests/TestCase/Shell/Task/TemplateTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@ public function testGetPathPlugin()
$this->Task->controllerName = 'Posts';

$pluginPath = APP . 'Plugin/TestTemplate/';
$this->deprecated(function () use ($pluginPath) {
Plugin::load('TestTemplate', ['path' => $pluginPath]);
});
$this->loadPlugins([
'TestTemplate' => ['path' => $pluginPath],
]);

$this->Task->params['plugin'] = $this->Task->plugin = 'TestTemplate';
$result = $this->Task->getPath();
Expand Down
14 changes: 5 additions & 9 deletions tests/TestCase/Shell/Task/TestTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,7 @@ public function testOutputClassOptionsForTable()
*/
public function testOutputClassOptionsForTablePlugin()
{
$this->deprecated(function () {
Plugin::load('BakeTest');
});
$this->loadPlugins(['BakeTest']);
$this->Task->plugin = 'BakeTest';

$expected = [
Expand Down Expand Up @@ -758,9 +756,7 @@ public function testBakeWithPlugin()
{
$this->Task->plugin = 'TestTest';

$this->deprecated(function () {
Plugin::load('TestTest', ['path' => APP . 'Plugin' . DS . 'TestTest' . DS]);
});
$this->loadPlugins(['TestTest' => ['path' => APP . 'Plugin' . DS . 'TestTest' . DS]]);
$path = APP . 'Plugin/TestTest/tests/TestCase/View/Helper/FormHelperTest.php';
$path = str_replace('/', DS, $path);
$this->Task->expects($this->once())->method('createFile')
Expand Down Expand Up @@ -824,9 +820,9 @@ public function testTestCaseFileNamePlugin()
{
$this->Task->path = DS . 'my/path/tests/';

$this->deprecated(function () {
Plugin::load('TestTest', ['path' => APP . 'Plugin' . DS . 'TestTest' . DS]);
});
$this->loadPlugins([
'TestTest' => ['path' => APP . 'Plugin' . DS . 'TestTest' . DS]
]);
$this->Task->plugin = 'TestTest';
$class = 'TestBake\Model\Entity\Post';
$result = $this->Task->testCaseFileName('entity', $class);
Expand Down
19 changes: 7 additions & 12 deletions tests/TestCase/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
*/
namespace Bake\Test\TestCase;

use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\Routing\Router;
use Cake\TestSuite\ConsoleIntegrationTestTrait;
use Cake\TestSuite\StringCompareTrait;
use Cake\TestSuite\TestCase as BaseTestCase;
Expand All @@ -39,11 +39,9 @@ public function setUp()
{
parent::setUp();

$this->deprecated(function () {
Plugin::load('WyriHaximus/TwigView', [
'bootstrap' => true,
]);
});
Router::reload();

$this->loadPlugins(['WyriHaximus/TwigView' => ['bootstrap' => true]]);
}

public function tearDown()
Expand Down Expand Up @@ -74,12 +72,9 @@ protected function _loadTestPlugin($name)
$root = dirname(dirname(__FILE__)) . DS;
$path = $root . 'test_app' . DS . 'Plugin' . DS . $name . DS;

$this->deprecated(function () use ($name, $path) {
Plugin::load($name, [
'path' => $path,
'autoload' => true
]);
});
$this->loadPlugins([
$name => ['path' => $path, 'autoload' => true],
]);
}

/**
Expand Down

0 comments on commit 7ff3b8d

Please sign in to comment.