PHP Class PAGI\Node\MockedNode

Author: Marcelo Gornstein ([email protected])
Inheritance: extends Node
Datei anzeigen Open project: marcelog/pagi

Public Methods

Method Description
assertCancelled ( ) : MockedNode Assert that this node is in state cancel after run().
assertComplete ( ) : MockedNode Assert that this node is in state complete after run().
assertMaxInputAttemptsReached ( ) : MockedNode Assert that this node is in state of max input attempts reached after run().
assertSayDateTime ( $time, $format, integer $totalTimes ) : MockedNode Configures this node to expect the given datetime to be played n number of times with the given format.
assertSayDigits ( integer $digits, integer $totalTimes ) : MockedNode Configures this node to expect the given digits to be played n number of times.
assertSayNumber ( $number, integer $totalTimes ) : MockedNode Configures this node to expect the given number to be played n number of times.
assertSaySound ( string $filename, integer $totalTimes ) : MockedNode Configures this node to expect a given filename to be played n number of times.
doBeforeFailedInput ( Closure $callback ) : MockedNode Execute a callback before invoking the real callback for failed input.
doBeforeValidInput ( Closure $callback ) : MockedNode Execute a callback before invoking the real callback for valid input.
run ( ) (non-PHPdoc)
runWithInput ( string $digits ) : MockedNode Configure this node to mimic these digits as user input.

Protected Methods

Method Description
assertSay ( string $what, integer $totalTimes, string[] $arguments = [] ) : MockedNode Generic method to expect prompt messages played.
beforeOnInputFailed ( ) (non-PHPdoc)
beforeOnValidInput ( ) (non-PHPdoc)
callClientMethods ( $methods, $stopWhen = null ) (non-PHPdoc)
recordDoneSay ( string $what, string[] $arguments = [] ) : void Records a played prompt message with its arguments.
sayInterruptable ( string $what, array $arguments ) : void Used to mimic the user input per prompt message.

Method Details

assertCancelled() public method

Assert that this node is in state cancel after run().
public assertCancelled ( ) : MockedNode
return MockedNode

assertComplete() public method

Assert that this node is in state complete after run().
public assertComplete ( ) : MockedNode
return MockedNode

assertMaxInputAttemptsReached() public method

Assert that this node is in state of max input attempts reached after run().
public assertMaxInputAttemptsReached ( ) : MockedNode
return MockedNode

assertSay() protected method

Generic method to expect prompt messages played.
protected assertSay ( string $what, integer $totalTimes, string[] $arguments = [] ) : MockedNode
$what string The pagi method name to expect.
$totalTimes integer Total times to expect this call
$arguments string[] The arguments to assert.
return MockedNode

assertSayDateTime() public method

Configures this node to expect the given datetime to be played n number of times with the given format.
public assertSayDateTime ( $time, $format, integer $totalTimes ) : MockedNode
$totalTimes integer
return MockedNode

assertSayDigits() public method

Configures this node to expect the given digits to be played n number of times.
public assertSayDigits ( integer $digits, integer $totalTimes ) : MockedNode
$digits integer
$totalTimes integer
return MockedNode

assertSayNumber() public method

Configures this node to expect the given number to be played n number of times.
public assertSayNumber ( $number, integer $totalTimes ) : MockedNode
$totalTimes integer
return MockedNode

assertSaySound() public method

Configures this node to expect a given filename to be played n number of times.
public assertSaySound ( string $filename, integer $totalTimes ) : MockedNode
$filename string
$totalTimes integer
return MockedNode

beforeOnInputFailed() protected method

(non-PHPdoc)
protected beforeOnInputFailed ( )

beforeOnValidInput() protected method

(non-PHPdoc)
protected beforeOnValidInput ( )

callClientMethods() protected method

(non-PHPdoc)
protected callClientMethods ( $methods, $stopWhen = null )

doBeforeFailedInput() public method

Execute a callback before invoking the real callback for failed input.
public doBeforeFailedInput ( Closure $callback ) : MockedNode
$callback Closure
return MockedNode

doBeforeValidInput() public method

Execute a callback before invoking the real callback for valid input.
public doBeforeValidInput ( Closure $callback ) : MockedNode
$callback Closure
return MockedNode

recordDoneSay() protected method

Records a played prompt message with its arguments.
protected recordDoneSay ( string $what, string[] $arguments = [] ) : void
$what string The pagi method name called.
$arguments string[] The arguments used, without the interrupt digits.
return void

run() public method

(non-PHPdoc)
public run ( )

runWithInput() public method

Configure this node to mimic these digits as user input.
public runWithInput ( string $digits ) : MockedNode
$digits string
return MockedNode

sayInterruptable() protected method

Used to mimic the user input per prompt message.
protected sayInterruptable ( string $what, array $arguments ) : void
$what string
$arguments array
return void