Skip to content
Permalink
Browse files

Remove use of TestCase::getMock() from "Shell" namepace tests.

  • Loading branch information...
ADmad committed Jun 5, 2016
1 parent 893358f commit b4b4d3d20cd2188604bdd046de366f4a17bc3ddd
@@ -40,17 +40,15 @@ public function setUp()
$this->out = new ConsoleOutput();
$io = new ConsoleIo($this->out);
$this->Shell = $this->getMock(
'Cake\Shell\CommandListShell',
['in', 'err', '_stop', 'clear'],
[$io]
);
$this->Shell->Command = $this->getMock(
'Cake\Shell\Task\CommandTask',
['in', '_stop', 'err', 'clear'],
[$io]
);
$this->Shell = $this->getMockBuilder('Cake\Shell\CommandListShell')
->setMethods(['in', 'err', '_stop', 'clear'])
->setConstructorArgs([$io])
->getMock();
$this->Shell->Command = $this->getMockBuilder('Cake\Shell\Task\CommandTask')
->setMethods(['in', '_stop', 'err', 'clear'])
->setConstructorArgs([$io])
->getMock();
}
/**
@@ -55,17 +55,15 @@ public function setUp()
$this->out = new TestCompletionStringOutput();
$io = new ConsoleIo($this->out);
$this->Shell = $this->getMock(
'Cake\Shell\CompletionShell',
['in', '_stop', 'clear'],
[$io]
);
$this->Shell->Command = $this->getMock(
'Cake\Shell\Task\CommandTask',
['in', '_stop', 'clear'],
[$io]
);
$this->Shell = $this->getMockBuilder('Cake\Shell\CompletionShell')
->setMethods(['in', '_stop', 'clear'])
->setConstructorArgs([$io])
->getMock();
$this->Shell->Command = $this->getMockBuilder('Cake\Shell\Task\CommandTask')
->setMethods(['in', '_stop', 'clear'])
->setConstructorArgs([$io])
->getMock();
}
/**
@@ -33,8 +33,12 @@ class RoutesShellTest extends TestCase
public function setUp()
{
parent::setUp();
$this->io = $this->getMock('Cake\Console\ConsoleIo', ['helper', 'out', 'err']);
$this->table = $this->getMock('Cake\Shell\Helper\TableHelper', [], [$this->io]);
$this->io = $this->getMockBuilder('Cake\Console\ConsoleIo')
->setMethods(['helper', 'out', 'err'])
->getMock();
$this->table = $this->getMockBuilder('Cake\Shell\Helper\TableHelper')
->setConstructorArgs([$this->io])
->getMock();
$this->io->expects($this->any())
->method('helper')
->with('table')
@@ -14,7 +14,6 @@
*/
namespace Cake\Test\TestCase\Shell\Task;
use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\Filesystem\Folder;
use Cake\TestSuite\TestCase;
@@ -40,13 +39,14 @@ public function setUp()
'Skip AssetsTask tests on windows to prevent side effects for UrlHelper tests on AppVeyor.'
);
$this->io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false);
$this->io = $this->getMockBuilder('Cake\Console\ConsoleIo')
->disableOriginalConstructor()
->getMock();
$this->Task = $this->getMock(
'Cake\Shell\Task\AssetsTask',
['in', 'out', 'err', '_stop'],
[$this->io]
);
$this->Task = $this->getMockBuilder('Cake\Shell\Task\AssetsTask')
->setMethods(['in', 'out', 'err', '_stop'])
->setConstructorArgs([$this->io])
->getMock();
}
/**
@@ -129,11 +129,10 @@ public function testSymlinkWhenTargetAlreadyExits()
{
Plugin::load('TestTheme');
$shell = $this->getMock(
'Cake\Shell\Task\AssetsTask',
['in', 'out', 'err', '_stop', '_createSymlink', '_copyDirectory'],
[$this->io]
);
$shell = $this->getMockBuilder('Cake\Shell\Task\AssetsTask')
->setMethods(['in', 'out', 'err', '_stop', '_createSymlink', '_copyDirectory'])
->setConstructorArgs([$this->io])
->getMock();
$this->assertTrue(is_dir(WWW_ROOT . 'test_theme'));
@@ -34,16 +34,19 @@ class ExtractTaskTest extends TestCase
public function setUp()
{
parent::setUp();
$this->io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false);
$progress = $this->getMock('Cake\Shell\Helper\ProgressHelper', [], [$this->io]);
$this->io = $this->getMockBuilder('Cake\Console\ConsoleIo')
->disableOriginalConstructor()
->getMock();
$progress = $this->getMockBuilder('Cake\Shell\Helper\ProgressHelper')
->setConstructorArgs([$this->io])
->getMock();
$this->io->method('helper')
->will($this->returnValue($progress));
$this->Task = $this->getMock(
'Cake\Shell\Task\ExtractTask',
['in', 'out', 'err', '_stop'],
[$this->io]
);
$this->Task = $this->getMockBuilder('Cake\Shell\Task\ExtractTask')
->setMethods(['in', 'out', 'err', '_stop'])
->setConstructorArgs([$this->io])
->getMock();
$this->path = TMP . 'tests/extract_task_test';
new Folder($this->path . DS . 'locale', true);
}
@@ -242,11 +245,10 @@ public function testExtractMultiplePaths()
public function testExtractExcludePlugins()
{
Configure::write('App.namespace', 'TestApp');
$this->Task = $this->getMock(
'Cake\Shell\Task\ExtractTask',
['_isExtractingApp', 'in', 'out', 'err', 'clear', '_stop'],
[$this->io]
);
$this->Task = $this->getMockBuilder('Cake\Shell\Task\ExtractTask')
->setMethods(['_isExtractingApp', 'in', 'out', 'err', 'clear', '_stop'])
->setConstructorArgs([$this->io])
->getMock();
$this->Task->expects($this->exactly(1))
->method('_isExtractingApp')
->will($this->returnValue(true));
@@ -269,11 +271,10 @@ public function testExtractPlugin()
{
Configure::write('App.namespace', 'TestApp');
$this->Task = $this->getMock(
'Cake\Shell\Task\ExtractTask',
['_isExtractingApp', 'in', 'out', 'err', 'clear', '_stop'],
[$this->io]
);
$this->Task = $this->getMockBuilder('Cake\Shell\Task\ExtractTask')
->setMethods(['_isExtractingApp', 'in', 'out', 'err', 'clear', '_stop'])
->setConstructorArgs([$this->io])
->getMock();
$this->Task->params['output'] = $this->path . DS;
$this->Task->params['plugin'] = 'TestPlugin';
@@ -294,11 +295,10 @@ public function testExtractVendoredPlugin()
{
Configure::write('App.namespace', 'TestApp');
$this->Task = $this->getMock(
'Cake\Shell\Task\ExtractTask',
['_isExtractingApp', 'in', 'out', 'err', 'clear', '_stop'],
[$this->io]
);
$this->Task = $this->getMockBuilder('Cake\Shell\Task\ExtractTask')
->setMethods(['_isExtractingApp', 'in', 'out', 'err', 'clear', '_stop'])
->setConstructorArgs([$this->io])
->getMock();
$this->Task->params['output'] = $this->path . DS;
$this->Task->params['plugin'] = 'Company/TestPluginThree';
@@ -33,9 +33,14 @@ public function setUp()
{
parent::setUp();
$this->io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false);
$this->Task = $this->getMock('Cake\Shell\Task\LoadTask', ['in', 'out', 'err', '_stop'], [$this->io]);
$this->io = $this->getMockBuilder('Cake\Console\ConsoleIo')
->disableOriginalConstructor()
->getMock();
$this->Task = $this->getMockBuilder('Cake\Shell\Task\LoadTask')
->setMethods(['in', 'out', 'err', '_stop'])
->setConstructorArgs([$this->io])
->getMock();
$this->bootstrap = ROOT . DS . 'config' . DS . 'bootstrap.php';
@@ -33,9 +33,14 @@ public function setUp()
{
parent::setUp();
$this->io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false);
$this->Task = $this->getMock('Cake\Shell\Task\UnloadTask', ['in', 'out', 'err', '_stop'], [$this->io]);
$this->io = $this->getMockBuilder('Cake\Console\ConsoleIo')
->disableOriginalConstructor()
->getMock();
$this->Task = $this->getMockBuilder('Cake\Shell\Task\UnloadTask')
->setMethods(['in', 'out', 'err', '_stop'])
->setConstructorArgs([$this->io])
->getMock();
$this->bootstrap = ROOT . DS . 'config' . DS . 'bootstrap.php';

0 comments on commit b4b4d3d

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