Skip to content

Commit

Permalink
Created new shell to prevent breaking other tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyharris committed Jun 23, 2017
1 parent c845a31 commit 2f7def1
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 28 deletions.
4 changes: 2 additions & 2 deletions tests/TestCase/Shell/CompletionShellTest.php
Expand Up @@ -200,7 +200,7 @@ public function testSubCommandsAppPlugin()
$this->Shell->runCommand(['subcommands', 'app.sample']);
$output = $this->out->output;

$expected = "bridge derp load returnValue sample withAbort\n";
$expected = "derp load returnValue sample withAbort\n";
$this->assertTextEquals($expected, $output);
}

Expand Down Expand Up @@ -258,7 +258,7 @@ public function testSubCommandsAppDuplicatePluginNoDot()
$this->Shell->runCommand(['subcommands', 'sample']);
$output = $this->out->output;

$expected = "bridge derp load returnValue sample withAbort\n";
$expected = "derp load returnValue sample withAbort\n";
$this->assertTextEquals($expected, $output);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/TestSuite/ConsoleIntegrationTestCaseTest.php
Expand Up @@ -53,7 +53,7 @@ public function testExecCoreCommand()
*/
public function testExecWithInput()
{
$this->exec('sample bridge', ['javascript']);
$this->exec('integration bridge', ['javascript']);

$this->assertErrorContains('No!');
$this->assertExitCode(Shell::CODE_ERROR);
Expand All @@ -66,7 +66,7 @@ public function testExecWithInput()
*/
public function testExecWithMultipleInput()
{
$this->exec('sample bridge', ['cake', 'blue']);
$this->exec('integration bridge', ['cake', 'blue']);

$this->assertOutputContains('You may pass');
$this->assertExitCode(Shell::CODE_SUCCESS);
Expand Down
51 changes: 51 additions & 0 deletions tests/test_app/TestApp/Shell/IntegrationShell.php
@@ -0,0 +1,51 @@
<?php
/**
* IntegrationShell file
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 1.5.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/

/**
* IntegrationShell
*/
namespace TestApp\Shell;

use Cake\Console\Shell;

class IntegrationShell extends Shell
{

/**
* Bridge of Death question
*
* @return void
*/
public function bridge()
{
$name = $this->in('What is your name');

if ($name !== 'cake') {
$this->err('No!');
$this->_stop(Shell::CODE_ERROR);
}

$color = $this->in('What is your favorite color?');

if ($color !== 'blue') {
$this->err('Wrong! <blink>Aaaahh</blink>');
$this->_stop(Shell::CODE_ERROR);
}

$this->out('You may pass.');
}
}
24 changes: 0 additions & 24 deletions tests/test_app/TestApp/Shell/SampleShell.php
Expand Up @@ -56,28 +56,4 @@ public function returnValue()
{
return 99;
}

/**
* Bridge of Death question
*
* @return void
*/
public function bridge()
{
$name = $this->in('What is your name');

if ($name !== 'cake') {
$this->err('No!');
$this->_stop(Shell::CODE_ERROR);
}

$color = $this->in('What is your favorite color?');

if ($color !== 'blue') {
$this->err('Wrong! <blink>Aaaahh</blink>');
$this->_stop(Shell::CODE_ERROR);
}

$this->out('You may pass.');
}
}

0 comments on commit 2f7def1

Please sign in to comment.