CommandExecutorTestCase
Shell command test case
Tags
Table of Contents
Properties
- $commandExecutor : CommandExecutor|MockInterface|null
Methods
- receiveAsyncCommand() : void
- Receives an async command
- receiveCommand() : void
- Receives a command
- receiveCommandExist() : void
- Receives a command existence check
- setUp() : void
- Sets up the test environment
- setUpCommandExecutor() : void
- Sets up the command executor for test environment
- tearDown() : void
- Cleanups the test environment
- checkCommandExecutor() : void
- Checks the command executor mock
Properties
$commandExecutor
protected
CommandExecutor|MockInterface|null
$commandExecutor
= null
Mocked command executor
Methods
receiveAsyncCommand()
Receives an async command
protected
receiveAsyncCommand(callable(Array $type, string $buffer): void $callback, string $command[, bool|null $needSudo = null ][, int|null $timeout = null ][, resource|string|Traversable|null $input = null ][, int|null $count = 1 ]) : void
Parameters
- $callback : callable(Array $type, string $buffer): void
-
Command's callback
- $command : string
-
Command
- $needSudo : bool|null = null
-
Is sudo needed?
- $timeout : int|null = null
-
Command's timeout
- $input : resource|string|Traversable|null = null
-
Command's input
- $count : int|null = 1
-
Number of command calls
receiveCommand()
Receives a command
protected
receiveCommand(string $command[, bool|null $needSudo = null ][, int|null $timeout = null ][, resource|string|Traversable|null $input = null ][, string $stdout = '' ][, string $stderr = '' ][, int $exitCode = 0 ][, int|null $count = 1 ]) : void
Parameters
- $command : string
-
Command
- $needSudo : bool|null = null
-
Is sudo needed?
- $timeout : int|null = null
-
Command's timeout
- $input : resource|string|Traversable|null = null
-
Command's input
- $stdout : string = ''
-
Command's standard output
- $stderr : string = ''
-
Command's standard error output
- $exitCode : int = 0
-
Command's exit code
- $count : int|null = 1
-
Number of command calls
receiveCommandExist()
Receives a command existence check
protected
receiveCommandExist(string $command, bool $output[, int|null $count = 1 ]) : void
Parameters
- $command : string
-
Command
- $output : bool
-
Is the command exist?
- $count : int|null = 1
-
Number of command calls
setUp()
Sets up the test environment
protected
setUp() : void
setUpCommandExecutor()
Sets up the command executor for test environment
protected
setUpCommandExecutor() : void
tearDown()
Cleanups the test environment
protected
tearDown() : void
checkCommandExecutor()
Checks the command executor mock
private
checkCommandExecutor() : void