Skip to content

Commit ec84f57

Browse files
committed
Updating ControllerTaskTest so it runs in a TestSuite context.
1 parent e64a187 commit ec84f57

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

cake/tests/cases/console/libs/tasks/controller.test.php

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,14 @@ public function endTest() {
113113
/**
114114
* test ListAll
115115
*
116-
* @fixme this one has problems with test suites
117116
* @return void
118117
*/
119118
public function testListAll() {
119+
$count = count($this->Task->listAll('test_suite'));
120+
if ($count != count($this->fixtures)) {
121+
$this->markTestSkipped('Additional tables detected.');
122+
}
123+
120124
$this->Task->connection = 'test_suite';
121125
$this->Task->interactive = true;
122126
$this->Task->expects($this->at(1))->method('out')->with('1. BakeArticles');
@@ -138,17 +142,21 @@ public function testListAll() {
138142
/**
139143
* Test that getName interacts with the user and returns the controller name.
140144
*
141-
* @fixme this one has problems with test suites
142145
* @return void
143146
*/
144147
public function testGetNameValidIndex() {
148+
$count = count($this->Task->listAll('test_suite'));
149+
if ($count != count($this->fixtures)) {
150+
$this->markTestSkipped('Additional tables detected.');
151+
}
145152
$this->Task->interactive = true;
146153
$this->Task->expects($this->at(5))->method('in')->will($this->returnValue(3));
154+
$this->Task->expects($this->at(7))->method('in')->will($this->returnValue(1));
155+
147156
$result = $this->Task->getName('test_suite');
148157
$expected = 'BakeComments';
149158
$this->assertEqual($result, $expected);
150-
151-
$this->Task->expects($this->at(7))->method('in')->will($this->returnValue(1));
159+
152160
$result = $this->Task->getName('test_suite');
153161
$expected = 'BakeArticles';
154162
$this->assertEqual($result, $expected);
@@ -157,13 +165,13 @@ public function testGetNameValidIndex() {
157165
/**
158166
* test getting invalid indexes.
159167
*
160-
* @fixme this one has problems with test suites
161168
* @return void
162169
*/
163170
function testGetNameInvalidIndex() {
164171
$this->Task->interactive = true;
165-
$this->Task->expects($this->at(5))->method('in')->will($this->returnValue(10));
166-
$this->Task->expects($this->at(7))->method('in')->will($this->returnValue('q'));
172+
$this->Task->expects($this->any())->method('in')
173+
->will($this->onConsecutiveCalls(50, 'q'));
174+
167175
$this->Task->expects($this->once())->method('err');
168176
$this->Task->expects($this->once())->method('_stop');
169177

@@ -421,10 +429,14 @@ public function testBakeTest() {
421429
/**
422430
* test Interactive mode.
423431
*
424-
* @fixme this one has problems with test suites
425432
* @return void
426433
*/
427434
public function testInteractive() {
435+
$count = count($this->Task->listAll('test_suite'));
436+
if ($count != count($this->fixtures)) {
437+
$this->markTestSkipped('Additional tables detected.');
438+
}
439+
428440
$this->Task->connection = 'test_suite';
429441
$this->Task->path = '/my/path/';
430442

@@ -452,10 +464,14 @@ public function testInteractive() {
452464
/**
453465
* test Interactive mode.
454466
*
455-
* @fixme this one has problems with test suites
456467
* @return void
457468
*/
458469
function testInteractiveAdminMethodsNotInteractive() {
470+
$count = count($this->Task->listAll('test_suite'));
471+
if ($count != count($this->fixtures)) {
472+
$this->markTestSkipped('Additional tables detected.');
473+
}
474+
459475
$this->Task->connection = 'test_suite';
460476
$this->Task->interactive = true;
461477
$this->Task->path = '/my/path/';

0 commit comments

Comments
 (0)