Skip to content

Commit

Permalink
Updating ControllerTaskTest so it runs in a TestSuite context.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jul 10, 2010
1 parent e64a187 commit ec84f57
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions cake/tests/cases/console/libs/tasks/controller.test.php
Expand Up @@ -113,10 +113,14 @@ public function endTest() {
/**
* test ListAll
*
* @fixme this one has problems with test suites
* @return void
*/
public function testListAll() {
$count = count($this->Task->listAll('test_suite'));
if ($count != count($this->fixtures)) {
$this->markTestSkipped('Additional tables detected.');
}

$this->Task->connection = 'test_suite';
$this->Task->interactive = true;
$this->Task->expects($this->at(1))->method('out')->with('1. BakeArticles');
Expand All @@ -138,17 +142,21 @@ public function testListAll() {
/**
* Test that getName interacts with the user and returns the controller name.
*
* @fixme this one has problems with test suites
* @return void
*/
public function testGetNameValidIndex() {
$count = count($this->Task->listAll('test_suite'));
if ($count != count($this->fixtures)) {
$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));

$result = $this->Task->getName('test_suite');
$expected = 'BakeComments';
$this->assertEqual($result, $expected);

$this->Task->expects($this->at(7))->method('in')->will($this->returnValue(1));

$result = $this->Task->getName('test_suite');
$expected = 'BakeArticles';
$this->assertEqual($result, $expected);
Expand All @@ -157,13 +165,13 @@ public function testGetNameValidIndex() {
/**
* test getting invalid indexes.
*
* @fixme this one has problems with test suites
* @return void
*/
function testGetNameInvalidIndex() {
$this->Task->interactive = true;
$this->Task->expects($this->at(5))->method('in')->will($this->returnValue(10));
$this->Task->expects($this->at(7))->method('in')->will($this->returnValue('q'));
$this->Task->expects($this->any())->method('in')
->will($this->onConsecutiveCalls(50, 'q'));

$this->Task->expects($this->once())->method('err');
$this->Task->expects($this->once())->method('_stop');

Expand Down Expand Up @@ -421,10 +429,14 @@ public function testBakeTest() {
/**
* test Interactive mode.
*
* @fixme this one has problems with test suites
* @return void
*/
public function testInteractive() {
$count = count($this->Task->listAll('test_suite'));
if ($count != count($this->fixtures)) {
$this->markTestSkipped('Additional tables detected.');
}

$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';

Expand Down Expand Up @@ -452,10 +464,14 @@ public function testInteractive() {
/**
* test Interactive mode.
*
* @fixme this one has problems with test suites
* @return void
*/
function testInteractiveAdminMethodsNotInteractive() {
$count = count($this->Task->listAll('test_suite'));
if ($count != count($this->fixtures)) {
$this->markTestSkipped('Additional tables detected.');
}

$this->Task->connection = 'test_suite';
$this->Task->interactive = true;
$this->Task->path = '/my/path/';
Expand Down

0 comments on commit ec84f57

Please sign in to comment.