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

View file

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

View file

@ -36,6 +36,10 @@ class AllTests extends PHPUnit_Framework_TestSuite {
$suite = new PHPUnit_Framework_TestSuite('All Tests');
$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_cache_engines.test.php');