PHP Класс Codeception\Module\WPCLI

Wraps calls to the wp-cli tool.
Наследование: extends Codeception\Module
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$bootPath string
$config array
$executor tad\WPBrowser\Environment\Executor
$options array
$prettyName string
$requiredFields {
$wpCliRoot string

Открытые методы

Метод Описание
__construct ( Codeception\Lib\ModuleContainer $moduleContainer, null | array $config, tad\WPBrowser\Environment\Executor $executor = null ) WPCLI constructor.
cli ( string $userCommand = 'core version', &$output = [] ) : integer Executes a wp-cli command.
cliToArray ( string $userCommand = 'post list --format=ids', callable $splitCallback = null ) : array Returns the output of a wp-cli command as an array.

Защищенные методы

Метод Описание
buildCommand ( $userCommand ) : string
debugSection ( string $title, string $message )
evaluateStatus ( &$output, $status )
initPaths ( )
initWpCliPaths ( ) Initializes the wp-cli root location.
mergeCommandOptions ( string $userCommand ) : string

Описание методов

__construct() публичный Метод

WPCLI constructor.
public __construct ( Codeception\Lib\ModuleContainer $moduleContainer, null | array $config, tad\WPBrowser\Environment\Executor $executor = null )
$moduleContainer Codeception\Lib\ModuleContainer
$config null | array
$executor tad\WPBrowser\Environment\Executor

buildCommand() защищенный Метод

protected buildCommand ( $userCommand ) : string
$userCommand
Результат string

cli() публичный Метод

The method is a wrapper around isolated calls to the wp-cli tool. The library will use its own wp-cli version to run the commands.
public cli ( string $userCommand = 'core version', &$output = [] ) : integer
$userCommand string The string of command and parameters as it would be passed to wp-cli e.g. a terminal call like `wp core version` becomes `core version` omitting the call to wp-cli script.
Результат integer wp-cli exit value for the command

cliToArray() публичный Метод

This method should be used in conjuction with wp-cli commands that will return lists. E.g. $inactiveThemes = $I->cliToArray('theme list --status=inactive --field=name'); The above command could return an array like ['twentyfourteen', 'twentyfifteen'] No check will be made on the command the user inserted for coherency with a split-able output.
public cliToArray ( string $userCommand = 'post list --format=ids', callable $splitCallback = null ) : array
$userCommand string
$splitCallback callable
Результат array An array containing the output of wp-cli split into single elements.

debugSection() защищенный Метод

protected debugSection ( string $title, string $message )
$title string
$message string

evaluateStatus() защищенный Метод

protected evaluateStatus ( &$output, $status )
$output
$status

initPaths() защищенный Метод

protected initPaths ( )

initWpCliPaths() защищенный Метод

The way the location works is an ugly hack that assumes the folder structure of the code to climb the tree and find the root folder.
protected initWpCliPaths ( )

mergeCommandOptions() защищенный Метод

protected mergeCommandOptions ( string $userCommand ) : string
$userCommand string
Результат string

Описание свойств

$bootPath защищенное свойство

protected string $bootPath
Результат string

$config защищенное свойство

protected array $config
Результат array

$executor защищенное свойство

protected Executor,tad\WPBrowser\Environment $executor
Результат tad\WPBrowser\Environment\Executor

$options защищенное свойство

protected array $options
Результат array

$prettyName защищенное свойство

protected string $prettyName
Результат string

$requiredFields защищенное свойство

{
protected $requiredFields

$wpCliRoot защищенное свойство

protected string $wpCliRoot
Результат string