mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-06 19:42:41 +00:00
Adding test case for getName
This commit is contained in:
parent
9b9b1fbf21
commit
68a858b39a
2 changed files with 31 additions and 6 deletions
|
@ -119,5 +119,32 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
$expected = array('articles', 'articles_tags', 'comments', 'tags');
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that getName interacts with the user and returns the controller name.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function testGetName() {
|
||||
$this->Task->setReturnValue('in', 1);
|
||||
|
||||
$this->Task->setReturnValueAt(0, 'in', 'q');
|
||||
$this->Task->expectOnce('_stop');
|
||||
$this->Task->getName('test_suite');
|
||||
|
||||
$this->Task->setReturnValueAt(1, 'in', 1);
|
||||
$result = $this->Task->getName('test_suite');
|
||||
$expected = 'Articles';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->Task->setReturnValueAt(2, 'in', 3);
|
||||
$result = $this->Task->getName('test_suite');
|
||||
$expected = 'Comments';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->Task->setReturnValueAt(3, 'in', 10);
|
||||
$result = $this->Task->getName('test_suite');
|
||||
$this->Task->expectOnce('err');
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue