Skip to content
Permalink
Browse files

updating helper and component tests for controller task to use phpunit.

  • Loading branch information...
markstory committed May 27, 2010
1 parent e4ccaba commit 0dc627178abaa1576f7adb3cf8ba3fbbf838b4a7
Showing with 40 additions and 13 deletions.
  1. +40 −13 cake/tests/cases/console/libs/tasks/controller.test.php
@@ -172,19 +172,33 @@ function testGetNameInvalidIndex() {
*
* @return void
*/
public function xxtestDoHelpers() {
public function testDoHelpersNo() {
$this->Task->expects($this->any())->method('in')->will($this->returnValue('n'));
$result = $this->Task->doHelpers();
$this->assertEqual($result, array());
}
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue('y'));
$this->Task->expects($this->at(2))->method('in')->will($this->returnValue(' Javascript, Ajax, CustomOne '));
/**
* test getting helper values
*
* @return void
*/
function testDoHelpersTrailingSpace() {
$this->Task->expects($this->at(0))->method('in')->will($this->returnValue('y'));
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue(' Javascript, Ajax, CustomOne '));
$result = $this->Task->doHelpers();
$expected = array('Javascript', 'Ajax', 'CustomOne');
$this->assertEqual($result, $expected);
}
$this->Task->expects($this->at(3))->method('in')->will($this->returnValue('y'));
$this->Task->expects($this->at(4))->method('in')->will($this->returnValue(' Javascript, Ajax, CustomOne, , '));
/**
* test doHelpers with extra commas
*
* @return void
*/
function testDoHelpersTrailingCommas() {
$this->Task->expects($this->at(0))->method('in')->will($this->returnValue('y'));
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue(' Javascript, Ajax, CustomOne, , '));
$result = $this->Task->doHelpers();
$expected = array('Javascript', 'Ajax', 'CustomOne');
$this->assertEqual($result, $expected);
@@ -195,21 +209,34 @@ public function xxtestDoHelpers() {
*
* @return void
*/
public function xxtestDoComponents() {
public function testDoComponentsNo() {
$this->Task->expects($this->any())->method('in')->will($this->returnValue('n'));
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue('y'));
$this->Task->expects($this->at(2))->method('in')->will($this->returnValue(' RequestHandler, Security '));
$this->Task->expects($this->at(3))->method('in')->will($this->returnValue('y'));
$this->Task->expects($this->at(4))->method('in')->will($this->returnValue(' RequestHandler, Security, , '));
$result = $this->Task->doComponents();
$this->assertEqual($result, array());
}
/**
* test components with spaces
*
* @return void
*/
function testDoComponentsTrailingSpaces() {
$this->Task->expects($this->at(0))->method('in')->will($this->returnValue('y'));
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue(' RequestHandler, Security '));
$result = $this->Task->doComponents();
$expected = array('RequestHandler', 'Security');
$this->assertEqual($result, $expected);
}
/**
* test components with commas
*
* @return void
*/
function testDoComponentsTrailingCommas() {
$this->Task->expects($this->at(0))->method('in')->will($this->returnValue('y'));
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue(' RequestHandler, Security, , '));
$result = $this->Task->doComponents();
$expected = array('RequestHandler', 'Security');

0 comments on commit 0dc6271

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