|
|
@@ -2,25 +2,9 @@
|
|
|
namespace Tools\Test\TestCase\Shell;
|
|
|
|
|
|
use Tools\Shell\InflectShell;
|
|
|
+use Tools\TestSuite\ConsoleOutput;
|
|
|
use Cake\Console\ConsoleIo;
|
|
|
-use Cake\Console\ConsoleOutput;
|
|
|
-use Cake\Console\Shell;
|
|
|
-use Cake\Core\Plugin;
|
|
|
-use Cake\TestSuite\TestCase;
|
|
|
-
|
|
|
-/**
|
|
|
- * Class TestCompletionStringOutput
|
|
|
- *
|
|
|
- */
|
|
|
-class TestInflectOutput extends ConsoleOutput {
|
|
|
-
|
|
|
- public $output = '';
|
|
|
-
|
|
|
- protected function _write($message) {
|
|
|
- $this->output .= $message;
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+use Tools\TestSuite\TestCase;
|
|
|
|
|
|
/**
|
|
|
*/
|
|
|
@@ -34,12 +18,13 @@ class InflectShellTest extends TestCase {
|
|
|
public function setUp() {
|
|
|
parent::setUp();
|
|
|
|
|
|
- $this->out = new TestInflectOutput();
|
|
|
- $io = new ConsoleIo($this->out);
|
|
|
+ $this->out = new ConsoleOutput();
|
|
|
+ $this->err = new ConsoleOutput();
|
|
|
+ $io = new ConsoleIo($this->out, $this->err);
|
|
|
|
|
|
$this->Shell = $this->getMock(
|
|
|
'Tools\Shell\InflectShell',
|
|
|
- ['in', 'err', '_stop'],
|
|
|
+ ['in', '_stop'],
|
|
|
[$io]
|
|
|
);
|
|
|
}
|
|
|
@@ -64,27 +49,27 @@ class InflectShellTest extends TestCase {
|
|
|
->will($this->returnValue('FooBar'));
|
|
|
|
|
|
$this->Shell->runCommand(['pluralize']);
|
|
|
- $output = $this->out->output;
|
|
|
+ $output = $this->out->output();
|
|
|
$expected = 'FooBars';
|
|
|
$this->assertContains($expected, $output);
|
|
|
|
|
|
$this->Shell->runCommand(['underscore']);
|
|
|
- $output = $this->out->output;
|
|
|
+ $output = $this->out->output();
|
|
|
$expected = 'foo_bar';
|
|
|
$this->assertContains($expected, $output);
|
|
|
|
|
|
$this->Shell->runCommand(['dasherize']);
|
|
|
- $output = $this->out->output;
|
|
|
+ $output = $this->out->output();
|
|
|
$expected = 'foo-bar';
|
|
|
$this->assertContains($expected, $output);
|
|
|
|
|
|
$this->Shell->runCommand(['slug']);
|
|
|
- $output = $this->out->output;
|
|
|
+ $output = $this->out->output();
|
|
|
$expected = 'foo-bar';
|
|
|
$this->assertContains($expected, $output);
|
|
|
|
|
|
$this->Shell->runCommand(['tableize']);
|
|
|
- $output = $this->out->output;
|
|
|
+ $output = $this->out->output();
|
|
|
$expected = 'foo_bar';
|
|
|
$this->assertContains($expected, $output);
|
|
|
}
|