Skip to content
Permalink
Browse files

Update test case Console folder

  • Loading branch information...
jrbasso committed May 25, 2012
1 parent a24b036 commit c031164b149b5a6e4c1c31af41db71da8a045c3b
Showing with 498 additions and 495 deletions.
  1. +5 −3 lib/Cake/Test/TestCase/Console/AllConsoleLibsTest.php
  2. +4 −2 lib/Cake/Test/TestCase/Console/AllConsoleTest.php
  3. +4 −2 lib/Cake/Test/TestCase/Console/AllShellsTest.php
  4. +4 −2 lib/Cake/Test/TestCase/Console/AllTasksTest.php
  5. +12 −9 lib/Cake/Test/TestCase/Console/Command/AclShellTest.php
  6. +7 −8 lib/Cake/Test/TestCase/Console/Command/ApiShellTest.php
  7. +16 −22 lib/Cake/Test/TestCase/Console/Command/BakeShellTest.php
  8. +13 −12 lib/Cake/Test/TestCase/Console/Command/CommandListShellTest.php
  9. +35 −34 lib/Cake/Test/TestCase/Console/Command/SchemaShellTest.php
  10. +28 −57 lib/Cake/Test/TestCase/Console/Command/Task/ControllerTaskTest.php
  11. +10 −13 lib/Cake/Test/TestCase/Console/Command/Task/DbConfigTaskTest.php
  12. +39 −38 lib/Cake/Test/TestCase/Console/Command/Task/ExtractTaskTest.php
  13. +17 −18 lib/Cake/Test/TestCase/Console/Command/Task/FixtureTaskTest.php
  14. +42 −42 lib/Cake/Test/TestCase/Console/Command/Task/ModelTaskTest.php
  15. +17 −20 lib/Cake/Test/TestCase/Console/Command/Task/PluginTaskTest.php
  16. +19 −21 lib/Cake/Test/TestCase/Console/Command/Task/ProjectTaskTest.php
  17. +11 −12 lib/Cake/Test/TestCase/Console/Command/Task/TemplateTaskTest.php
  18. +26 −24 lib/Cake/Test/TestCase/Console/Command/Task/TestTaskTest.php
  19. +33 −23 lib/Cake/Test/TestCase/Console/Command/Task/ViewTaskTest.php
  20. +24 −24 lib/Cake/Test/TestCase/Console/Command/TestShellTest.php
  21. +14 −12 lib/Cake/Test/TestCase/Console/ConsoleErrorHandlerTest.php
  22. +15 −11 lib/Cake/Test/TestCase/Console/ConsoleOptionParserTest.php
  23. +5 −4 lib/Cake/Test/TestCase/Console/ConsoleOutputTest.php
  24. +6 −4 lib/Cake/Test/TestCase/Console/HelpFormatterTest.php
  25. +27 −22 lib/Cake/Test/TestCase/Console/ShellDispatcherTest.php
  26. +45 −38 lib/Cake/Test/TestCase/Console/ShellTest.php
  27. +20 −18 lib/Cake/Test/TestCase/Console/TaskCollectionTest.php
@@ -16,6 +16,8 @@
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace Cake\Test\TestCase\Console;
use Cake\TestSuite\TestSuite;
/**
* AllConsoleLibsTest class
@@ -24,17 +26,17 @@
*
* @package Cake.Test.Case.Console
*/
class AllConsoleLibsTest extends PHPUnit_Framework_TestSuite {
class AllConsoleLibsTest extends \PHPUnit_Framework_TestSuite {
/**
* suite method, defines tests for this suite.
*
* @return void
*/
public static function suite() {
$suite = new CakeTestSuite('All console lib classes');
$suite = new TestSuite('All console lib classes');
foreach (new DirectoryIterator(dirname(__FILE__)) as $file) {
foreach (new \DirectoryIterator(dirname(__FILE__)) as $file) {
if (!$file->isFile() || strpos($file, 'All') === 0) {
continue;
}
@@ -16,6 +16,8 @@
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace Cake\Test\TestCase\Console;
use Cake\TestSuite\TestSuite;
/**
* AllConsoleTest class
@@ -24,15 +26,15 @@
*
* @package Cake.Test.Case.Console
*/
class AllConsoleTest extends PHPUnit_Framework_TestSuite {
class AllConsoleTest extends \PHPUnit_Framework_TestSuite {
/**
* suite method, defines tests for this suite.
*
* @return void
*/
public static function suite() {
$suite = new CakeTestSuite('All console classes');
$suite = new TestSuite('All console classes');
$path = CORE_TEST_CASES . DS . 'Console' . DS;
@@ -16,6 +16,8 @@
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace Cake\Test\TestCase\Console;
use Cake\TestSuite\TestSuite;
/**
* AllShellsTest class
@@ -24,15 +26,15 @@
*
* @package Cake.Test.Case.Console
*/
class AllShellsTest extends PHPUnit_Framework_TestSuite {
class AllShellsTest extends \PHPUnit_Framework_TestSuite {
/**
* suite method, defines tests for this suite.
*
* @return void
*/
public static function suite() {
$suite = new CakeTestSuite('All shell classes');
$suite = new TestSuite('All shell classes');
$path = CORE_TEST_CASES . DS . 'Console' . DS . 'Command' . DS;
@@ -16,6 +16,8 @@
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace Cake\Test\TestCase\Console;
use Cake\TestSuite\TestSuite;
/**
* AllTasksTest class
@@ -24,15 +26,15 @@
*
* @package Cake.Test.Case.Console
*/
class AllTasksTest extends PHPUnit_Framework_TestSuite {
class AllTasksTest extends \PHPUnit_Framework_TestSuite {
/**
* suite method, defines tests for this suite.
*
* @return void
*/
public static function suite() {
$suite = new CakeTestSuite('All Tasks tests');
$suite = new TestSuite('All Tasks tests');
$path = CORE_TEST_CASES . DS . 'Console' . DS . 'Command' . DS . 'Task' . DS;
$suite->addTestDirectory($path);
@@ -16,18 +16,21 @@
* @since CakePHP v 1.2.0.7726
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace Cake\Test\TestCase\Console\Command;
App::uses('ShellDispatcher', 'Console');
App::uses('Shell', 'Console');
App::uses('AclShell', 'Console/Command');
App::uses('ComponentCollection', 'Controller');
use Cake\TestSuite\TestCase,
Cake\Console\Command\AclShell,
Cake\Controller\Component\AclComponent,
Cake\Controller\ComponentCollection,
Cake\Core\Configure,
Cake\Utility\ClassRegistry;
/**
* AclShellTest class
*
* @package Cake.Test.Case.Console.Command
*/
class AclShellTest extends CakeTestCase {
class AclShellTest extends TestCase {
/**
* Fixtures
@@ -44,13 +47,13 @@ class AclShellTest extends CakeTestCase {
public function setUp() {
parent::setUp();
Configure::write('Acl.database', 'test');
Configure::write('Acl.classname', 'DbAcl');
Configure::write('Acl.classname', 'Cake\Controller\Component\Acl\DbAcl');
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
$out = $this->getMock('Cake\Console\ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('Cake\Console\ConsoleInput', array(), array(), '', false);
$this->Task = $this->getMock(
'AclShell',
'Cake\Console\Command\AclShell',
array('in', 'out', 'hr', 'createFile', 'error', 'err', 'clear', 'dispatchShell'),
array($out, $out, $in)
);
@@ -16,17 +16,16 @@
* @since CakePHP v 1.2.0.7726
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('ShellDispatcher', 'Console');
App::uses('Shell', 'Console');
App::uses('ApiShell', 'Console/Command');
namespace Cake\Test\TestCase\Console\Command;
use Cake\TestSuite\TestCase,
Cake\Console\Command\ApiShellShell;
/**
* ApiShellTest class
*
* @package Cake.Test.Case.Console.Command
*/
class ApiShellTest extends CakeTestCase {
class ApiShellTest extends TestCase {
/**
* setUp method
@@ -35,11 +34,11 @@ class ApiShellTest extends CakeTestCase {
*/
public function setUp() {
parent::setUp();
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
$out = $this->getMock('Cake\Console\ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('Cake\Console\ConsoleInput', array(), array(), '', false);
$this->Shell = $this->getMock(
'ApiShell',
'Cake\Console\Command\ApiShell',
array('in', 'out', 'createFile', 'hr', '_stop'),
array( $out, $out, $in)
);
@@ -17,24 +17,19 @@
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace Cake\Test\TestCase\Console\Command;
use Cake\TestSuite\TestCase,
Cake\Console\Command\BakeShellShell,
Cake\Controller\Controller,
Cake\Core\App;
App::uses('ShellDispatcher', 'Console');
App::uses('Shell', 'Console');
App::uses('BakeShell', 'Console/Command');
App::uses('ModelTask', 'Console/Command/Task');
App::uses('ControllerTask', 'Console/Command/Task');
App::uses('DbConfigTask', 'Console/Command/Task');
App::uses('Controller', 'Controller');
class UsersController extends Controller {
if (!class_exists('UsersController')) {
class UsersController extends Controller {
public $name = 'Users';
public $name = 'Users';
}
}
class BakeShellTest extends CakeTestCase {
class BakeShellTest extends TestCase {
/**
* fixtures
@@ -50,11 +45,11 @@ class BakeShellTest extends CakeTestCase {
*/
public function setUp() {
parent::setUp();
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
$out = $this->getMock('Cake\Console\ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('Cake\Console\ConsoleInput', array(), array(), '', false);
$this->Shell = $this->getMock(
'BakeShell',
'Cake\Console\Command\BakeShell',
array('in', 'out', 'hr', 'err', 'createFile', '_stop', '_checkUnitTest'),
array($out, $out, $in)
);
@@ -76,14 +71,13 @@ public function tearDown() {
* @return void
*/
public function testAllWithModelName() {
App::uses('User', 'Model');
$userExists = class_exists('User');
$userExists = App::classname('User', 'Model');
$this->skipIf($userExists, 'User class exists, cannot test `bake all [param]`.');
$this->Shell->Model = $this->getMock('ModelTask', array(), array(&$this->Dispatcher));
$this->Shell->Controller = $this->getMock('ControllerTask', array(), array(&$this->Dispatcher));
$this->Shell->View = $this->getMock('ModelTask', array(), array(&$this->Dispatcher));
$this->Shell->DbConfig = $this->getMock('DbConfigTask', array(), array(&$this->Dispatcher));
$this->Shell->Model = $this->getMock('Cake\Console\Command\Task\ModelTask', array(), array(&$this->Dispatcher));
$this->Shell->Controller = $this->getMock('Cake\Console\Command\Task\ControllerTask', array(), array(&$this->Dispatcher));
$this->Shell->View = $this->getMock('Cake\Console\Command\Task\ModelTask', array(), array(&$this->Dispatcher));
$this->Shell->DbConfig = $this->getMock('Cake\Console\Command\Task\DbConfigTask', array(), array(&$this->Dispatcher));
$this->Shell->DbConfig->expects($this->once())
->method('getConfig')
@@ -16,11 +16,12 @@
* @since CakePHP v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('CommandListShell', 'Console/Command');
App::uses('ConsoleOutput', 'Console');
App::uses('ConsoleInput', 'Console');
App::uses('Shell', 'Console');
namespace Cake\Test\TestCase\Console\Command;
use Cake\TestSuite\TestCase,
Cake\Console\Command\CommandListShell,
Cake\Console\ConsoleOutput,
Cake\Core\App,
Cake\Core\Plugin;
class TestStringOutput extends ConsoleOutput {
@@ -33,7 +34,7 @@ protected function _write($message) {
}
class CommandListShellTest extends CakeTestCase {
class CommandListShellTest extends TestCase {
/**
* setUp method
@@ -44,19 +45,19 @@ public function setUp() {
parent::setUp();
App::build(array(
'Plugin' => array(
CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS
CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS
),
'Console/Command' => array(
CAKE . 'Test' . DS . 'test_app' . DS . 'Console' . DS . 'Command' . DS
CAKE . 'Test' . DS . 'TestApp' . DS . 'Console' . DS . 'Command' . DS
)
), App::RESET);
CakePlugin::load(array('TestPlugin', 'TestPluginTwo'));
Plugin::load(array('TestPlugin', 'TestPluginTwo'));
$out = new TestStringOutput();
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
$in = $this->getMock('Cake\Console\ConsoleInput', array(), array(), '', false);
$this->Shell = $this->getMock(
'CommandListShell',
'Cake\Console\Command\CommandListShell',
array('in', '_stop', 'clear'),
array($out, $out, $in)
);
@@ -70,7 +71,7 @@ public function setUp() {
public function tearDown() {
parent::tearDown();
unset($this->Shell);
CakePlugin::unload();
Plugin::unload();
}
/**
Oops, something went wrong.

0 comments on commit c031164

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