mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Adding test coverage for inOptions.
This commit is contained in:
parent
d066a4a0d6
commit
6be70c3cfa
1 changed files with 20 additions and 0 deletions
|
@ -460,5 +460,25 @@ class ModelTaskTest extends CakeTestCase {
|
|||
$this->assertTrue(empty($result['hasMany']));
|
||||
$this->assertTrue(empty($result['hasOne']));
|
||||
}
|
||||
|
||||
/**
|
||||
* test that inOptions generates questions and only accepts a valid answer
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function testInOptions() {
|
||||
$options = array('one', 'two', 'three');
|
||||
$this->Task->expectAt(0, 'out', array('1. one'));
|
||||
$this->Task->expectAt(1, 'out', array('2. two'));
|
||||
$this->Task->expectAt(2, 'out', array('3. three'));
|
||||
$this->Task->setReturnValueAt(0, 'in', 10);
|
||||
|
||||
$this->Task->expectAt(3, 'out', array('1. one'));
|
||||
$this->Task->expectAt(4, 'out', array('2. two'));
|
||||
$this->Task->expectAt(5, 'out', array('3. three'));
|
||||
$this->Task->setReturnValueAt(1, 'in', 2);
|
||||
$result = $this->Task->inOptions($options, 'Pick a number');
|
||||
$this->assertEqual($result, 1);
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Reference in a new issue