Class ConsoleInput
Stub class used by the console integration harness.
This class enables input to be stubbed and have exceptions raised when no answer is available.
Properties summary
- $_canReadline protected
bool
Can this instance use readline? Two conditions must be met:
- Readline support must be enabled.
- $_input protected
resource
Input value.
- $currentIndex protected
int
Current message index
- $replies protected
string[]
Reply values for ask() and askChoice()
Method Summary
Method Detail
__construct() public
__construct(array $replies)
Constructor
Parameters
-
string[]
$replies A list of replies for read()
dataAvailable() public
dataAvailable(mixed $timeout)
Check if data is available on stdin
Parameters
-
int
$timeout optional An optional time to wait for data
Returns
bool
True for data available, false otherwise
read() public
read()
Read a reply
Returns
string
The value of the reply
Property Detail
$_canReadline protected
Can this instance use readline? Two conditions must be met:
- Readline support must be enabled.
- Handle we are attached to must be stdin. Allows rich editing with arrow keys and history when inputting a string.
Type
bool
$_input protected
Input value.
Type
resource
$currentIndex protected
Current message index
Type
int
$replies protected
Reply values for ask() and askChoice()
Type
string[]
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.1/class-Cake.TestSuite.Stub.ConsoleInput.html