mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Fixing Shell tests to use ConsoleInput.
This commit is contained in:
parent
e816a49a6f
commit
7921ef1282
2 changed files with 23 additions and 22 deletions
|
@ -155,6 +155,13 @@ class Shell extends Object {
|
||||||
*/
|
*/
|
||||||
public $stderr;
|
public $stderr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stdin object
|
||||||
|
*
|
||||||
|
* @var ConsoleInput
|
||||||
|
*/
|
||||||
|
public $stdin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this Shell instance.
|
* Constructs this Shell instance.
|
||||||
*
|
*
|
||||||
|
|
|
@ -110,7 +110,8 @@ class ShellTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$output = $this->getMock('ConsoleOutput');
|
$output = $this->getMock('ConsoleOutput');
|
||||||
$error = $this->getMock('ConsoleOutput');
|
$error = $this->getMock('ConsoleOutput');
|
||||||
$this->Shell =& new TestShell($this->Dispatcher, $output, $error);
|
$in = $this->getMock('ConsoleInput');
|
||||||
|
$this->Shell =& new TestShell($this->Dispatcher, $output, $error, $in);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -174,29 +175,24 @@ class ShellTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testIn() {
|
public function testIn() {
|
||||||
$this->Dispatcher->expects($this->at(0))
|
$this->Shell->stdin->expects($this->at(0))
|
||||||
->method('getInput')
|
->method('read')
|
||||||
->with('Just a test?', array('y', 'n'), 'n')
|
|
||||||
->will($this->returnValue('n'));
|
->will($this->returnValue('n'));
|
||||||
|
|
||||||
$this->Dispatcher->expects($this->at(1))
|
$this->Shell->stdin->expects($this->at(1))
|
||||||
->method('getInput')
|
->method('read')
|
||||||
->with('Just a test?', array('y', 'n'), 'n')
|
|
||||||
->will($this->returnValue('Y'));
|
->will($this->returnValue('Y'));
|
||||||
|
|
||||||
$this->Dispatcher->expects($this->at(2))
|
$this->Shell->stdin->expects($this->at(2))
|
||||||
->method('getInput')
|
->method('read')
|
||||||
->with('Just a test?', 'y,n', 'n')
|
|
||||||
->will($this->returnValue('y'));
|
->will($this->returnValue('y'));
|
||||||
|
|
||||||
$this->Dispatcher->expects($this->at(3))
|
$this->Shell->stdin->expects($this->at(3))
|
||||||
->method('getInput')
|
->method('read')
|
||||||
->with('Just a test?', 'y/n', 'n')
|
|
||||||
->will($this->returnValue('y'));
|
->will($this->returnValue('y'));
|
||||||
|
|
||||||
$this->Dispatcher->expects($this->at(4))
|
$this->Shell->stdin->expects($this->at(4))
|
||||||
->method('getInput')
|
->method('read')
|
||||||
->with('Just a test?', 'y', 'y')
|
|
||||||
->will($this->returnValue('y'));
|
->will($this->returnValue('y'));
|
||||||
|
|
||||||
$result = $this->Shell->in('Just a test?', array('y', 'n'), 'n');
|
$result = $this->Shell->in('Just a test?', array('y', 'n'), 'n');
|
||||||
|
@ -471,14 +467,12 @@ class ShellTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Shell->interactive = true;
|
$this->Shell->interactive = true;
|
||||||
|
|
||||||
$this->Shell->Dispatch->expects($this->at(5))
|
$this->Shell->stdin->expects($this->at(0))
|
||||||
->method('getInput')
|
->method('read')
|
||||||
->withAnyParameters()
|
|
||||||
->will($this->returnValue('n'));
|
->will($this->returnValue('n'));
|
||||||
|
|
||||||
$this->Shell->Dispatch->expects($this->at(9))
|
$this->Shell->stdin->expects($this->at(1))
|
||||||
->method('getInput')
|
->method('read')
|
||||||
->withAnyParameters()
|
|
||||||
->will($this->returnValue('y'));
|
->will($this->returnValue('y'));
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue