Fixing failing tests and group test situational fails in console tests. Adding console tests to all tests.

This commit is contained in:
mark_story 2010-09-20 23:42:35 -04:00
parent 0bb23095f3
commit 94d738e834
4 changed files with 29 additions and 32 deletions

View file

@ -344,7 +344,7 @@ class ViewTask extends BakeTask {
$this->hr(); $this->hr();
$looksGood = $this->in(__('Look okay?'), array('y','n'), 'y'); $looksGood = $this->in(__('Look okay?'), array('y','n'), 'y');
if (strtolower($looksGood) == 'y') { if (strtolower($looksGood) == 'y') {
$this->bake($action); $this->bake($action, ' ');
$this->_stop(); $this->_stop();
} else { } else {
$this->out(__('Bake Aborted.')); $this->out(__('Bake Aborted.'));

View file

@ -72,11 +72,11 @@ class ControllerTaskTest extends CakeTestCase {
public $fixtures = array('core.bake_article', 'core.bake_articles_bake_tag', 'core.bake_comment', 'core.bake_tag'); public $fixtures = array('core.bake_article', 'core.bake_articles_bake_tag', 'core.bake_comment', 'core.bake_tag');
/** /**
* startTest method * setUp method
* *
* @return void * @return void
*/ */
public function startTest() { public function setUp() {
$this->Dispatcher = $this->getMock('ShellDispatcher', array( $this->Dispatcher = $this->getMock('ShellDispatcher', array(
'getInput', 'stdout', 'stderr', '_stop', '_initEnvironment', 'clear' 'getInput', 'stdout', 'stderr', '_stop', '_initEnvironment', 'clear'
)); ));
@ -101,11 +101,11 @@ class ControllerTaskTest extends CakeTestCase {
} }
/** /**
* endTest method * teardown method
* *
* @return void * @return void
*/ */
public function endTest() { public function teardown() {
unset($this->Task, $this->Dispatcher); unset($this->Task, $this->Dispatcher);
ClassRegistry::flush(); ClassRegistry::flush();
} }
@ -150,8 +150,9 @@ class ControllerTaskTest extends CakeTestCase {
$this->markTestSkipped('Additional tables detected.'); $this->markTestSkipped('Additional tables detected.');
} }
$this->Task->interactive = true; $this->Task->interactive = true;
$this->Task->expects($this->at(5))->method('in')->will($this->returnValue(3)); $this->Task->expects($this->any())->method('in')->will(
$this->Task->expects($this->at(7))->method('in')->will($this->returnValue(1)); $this->onConsecutiveCalls(3, 1)
);
$result = $this->Task->getName('test'); $result = $this->Task->getName('test');
$expected = 'BakeComments'; $expected = 'BakeComments';
@ -511,10 +512,12 @@ class ControllerTaskTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testExecuteIntoAll() { public function testExecuteIntoAll() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), $count = count($this->Task->listAll('test'));
'Execute into all could not be run as an Article, Tag or Comment model was already loaded. %s'); if ($count != count($this->fixtures)) {
if ($skip) { $this->markTestSkipped('Additional tables detected.');
return; }
if (!defined('ARTICLE_MODEL_CREATED')) {
$this->markTestSkipped('Execute into all could not be run as an Article, Tag or Comment model was already loaded.');
} }
$this->Task->connection = 'test'; $this->Task->connection = 'test';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';
@ -538,10 +541,8 @@ class ControllerTaskTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testExecuteWithController() { public function testExecuteWithController() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), if (!defined('ARTICLE_MODEL_CREATED')) {
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s'); $this->markTestSkipped('Execute with scaffold param requires no Article, Tag or Comment model to be defined');
if ($skip) {
return;
} }
$this->Task->connection = 'test'; $this->Task->connection = 'test';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';
@ -574,10 +575,8 @@ class ControllerTaskTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testExecuteWithControllerNameVariations($name) { public function testExecuteWithControllerNameVariations($name) {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), if (!defined('ARTICLE_MODEL_CREATED')) {
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s'); $this->markTestSkipped('Execute with scaffold param requires no Article, Tag or Comment model to be defined.');
if ($skip) {
return;
} }
$this->Task->connection = 'test'; $this->Task->connection = 'test';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';
@ -596,10 +595,8 @@ class ControllerTaskTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testExecuteWithPublicParam() { public function testExecuteWithPublicParam() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), if (!defined('ARTICLE_MODEL_CREATED')) {
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s'); $this->markTestSkipped('Execute with public param requires no Article, Tag or Comment model to be defined.');
if ($skip) {
return;
} }
$this->Task->connection = 'test'; $this->Task->connection = 'test';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';
@ -619,10 +616,8 @@ class ControllerTaskTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testExecuteWithControllerAndBoth() { public function testExecuteWithControllerAndBoth() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), if (!defined('ARTICLE_MODEL_CREATED')) {
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s'); $this->markTestSkipped('Execute with controller and both requires no Article, Tag or Comment model to be defined.');
if ($skip) {
return;
} }
$this->Task->Project->expects($this->any())->method('getPrefix')->will($this->returnValue('admin_')); $this->Task->Project->expects($this->any())->method('getPrefix')->will($this->returnValue('admin_'));
$this->Task->connection = 'test'; $this->Task->connection = 'test';
@ -642,10 +637,8 @@ class ControllerTaskTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testExecuteWithControllerAndAdmin() { public function testExecuteWithControllerAndAdmin() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), if (!defined('ARTICLE_MODEL_CREATED')) {
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s'); $this->markTestSkipped('Execute with controller and admin requires no Article, Tag or Comment model to be defined.');
if ($skip) {
return;
} }
$this->Task->Project->expects($this->any())->method('getPrefix')->will($this->returnValue('admin_')); $this->Task->Project->expects($this->any())->method('getPrefix')->will($this->returnValue('admin_'));
$this->Task->connection = 'test'; $this->Task->connection = 'test';

View file

@ -389,7 +389,7 @@ class ViewTaskTest extends CakeTestCase {
$this->Task->controllerName = 'ViewTaskComments'; $this->Task->controllerName = 'ViewTaskComments';
$this->Task->controllerPath = 'view_task_comments'; $this->Task->controllerPath = 'view_task_comments';
$this->Task->expectNever('createFile'); $this->Task->expects($this->never())->method('createFile');
$this->Task->bake('delete', true); $this->Task->bake('delete', true);
} }

View file

@ -36,6 +36,10 @@ class AllTests extends PHPUnit_Framework_TestSuite {
$suite = new PHPUnit_Framework_TestSuite('All Tests'); $suite = new PHPUnit_Framework_TestSuite('All Tests');
$path = CORE_TEST_CASES . DS . 'libs' . DS; $path = CORE_TEST_CASES . DS . 'libs' . DS;
$console = CORE_TEST_CASES . DS . 'console' . DS;
$suite->addTestFile($console . 'all_shells.test.php');
$suite->addTestFile($console . 'libs' . DS . 'all_bake_tasks.test.php');
$suite->addTestFile($path . 'all_behaviors.test.php'); $suite->addTestFile($path . 'all_behaviors.test.php');
$suite->addTestFile($path . 'all_cache_engines.test.php'); $suite->addTestFile($path . 'all_cache_engines.test.php');