E2E_Extern_CliRunnerTest
extends CiviEndToEndTestCase
in package
Check that various CLI runners are able to bootstrap an environment with reasonable paths.
This test assumes that you have built with "civibuild" (or configured cv.json) to provide canonical/expected values.
It then executes the any supported CLI tools (cv, drush, wp) and checks if their output matches the expected value.
Tags
Table of Contents
Methods
- getRunners() : array<string|int, mixed>
- getRunnersAndPaths() : mixed
- setUpBeforeClass() : void
- testBasicPathUrl() : mixed
- testPathUrlMatch() : mixed
- For some URLs, we don't have a good environment variable for predicting the URL.
- testPermissionLookup() : void
- Perform permission-checks using "on-behalf-of" mechanics.
- testPipe() : mixed
- Use a CLI runner to start a bidirectional command pipe.
- callRunnerJson() : mixed
- callRunnerOk() : string
- findCommand() : mixed
- setUp() : void
Methods
getRunners()
public
getRunners() : array<string|int, mixed>
Return values
array<string|int, mixed> —Each case gives a name (eg "cv") and template for executing the command (eg "cv ev @PHP").
getRunnersAndPaths()
public
getRunnersAndPaths() : mixed
setUpBeforeClass()
public
static setUpBeforeClass() : void
testBasicPathUrl()
public
testBasicPathUrl(string $name, string $r) : mixed
Parameters
- $name : string
-
The name of the command we're testing with. Ex: 'cv'
- $r : string
-
Ex: 'cv ev @PHP'
Tags
testPathUrlMatch()
For some URLs, we don't have a good environment variable for predicting the URL.
public
testPathUrlMatch(string $name, string $r, string $fileExpr) : mixed
Instead, we'll just see if the generated URLs match the generated paths.
Parameters
- $name : string
-
The name of the command we're testing with. Ex: 'cv'
- $r : string
-
Ex: 'cv ev @PHP'
- $fileExpr : string
-
Ex: '[civicrm.root]/LICENSE'
Tags
testPermissionLookup()
Perform permission-checks using "on-behalf-of" mechanics.
public
testPermissionLookup() : void
testPipe()
Use a CLI runner to start a bidirectional command pipe.
public
testPipe(string $name, string $runner) : mixed
This ensures that there are no funny headers or constraints of bidirectional data-flow.
Parameters
- $name : string
-
The name of the command we're testing with. Ex: 'cv'
- $runner : string
-
Ex: 'cv ev @PHP'
Tags
callRunnerJson()
protected
callRunnerJson(string $runner, string $phpExpr[, string $vars = [] ]) : mixed
Parameters
- $runner : string
-
Ex: 'cv ev @PHP'
- $phpExpr : string
-
PHP expression to evaluate and return. (Encoded+decoded as JSON)
- $vars : string = []
-
Extra key-value pairs to include in command.
Return values
mixed —The result of running $phpExpr through the given $runner.
callRunnerOk()
protected
callRunnerOk(string $runner, string $phpStmt[, string $vars = [] ]) : string
Parameters
- $runner : string
-
Ex: 'cv ev @PHP'
- $phpStmt : string
-
PHP code to execute
- $vars : string = []
-
Extra key-value pairs to include in command.
Return values
string —The console output of running $phpStmt through the given $runner.
findCommand()
protected
findCommand(mixed $name) : mixed
Parameters
- $name : mixed
setUp()
protected
setUp() : void