src/Codeception/Module/WPCLI.php
public function cli($userCommand = 'core version')
    {
        // Set an environment variable to let client code know the request is coming from the host machine.
        putenv('WPBROWSER_HOST_REQUEST=1');

        $this->initPaths();

        $command = $this->buildCommand($userCommand);

        $output = [];
        $this->debugSection('command', $command);
        $status = $this->executor->exec($command, $output);
        $this->debugSection('output', implode("\n", $output));

        $this->evaluateStatus($output, $status);

        return $status;
    }
public function cli($userCommand = 'core version')
    {
        // Set an environment variable to let client code know the request is coming from the host machine.
        putenv('WPBROWSER_HOST_REQUEST=1');

        $this->initPaths();

        $command = $this->buildCommand($userCommand);

        $output = [];
        $this->debugSection('command', $command);
        $status = $this->executor->exec($command, $output);
        $this->debugSection('output', implode("\n", $output));

        $this->evaluateStatus($output, $status);

        return $status;
    }
public function cli ( $ userCommand = 'core version' ) { // Set an environment variable to let client code know the request is coming from the host machine. putenv ( 'WPBROWSER_HOST_REQUEST=1' ) ; $ this -> initPaths ( ) ; $ command = $ this -> buildCommand ( $ userCommand ) ; $ output = [ ] ; $ this -> debugSection ( 'command' , $ command ) ; $ status = $ this -> executor -> exec ( $ command , $ output ) ; $ this -> debugSection ( 'output' , implode ( "\n" , $ output ) ) ; $ this -> evaluateStatus ( $ output , $ status ) ; return $ status ; }
Executes a wp-cli command targeting the test WordPress installation.

@example
```php
// Activate a plugin via wp-cli in the test WordPress site.
$I->cli('plugin activate my-plugin');
// Change a user password.
$I->cli('user update luca --user_pass=newpassword');
```

@param string $userCommand The string of command and parameters as it would be passed to wp-cli minus `wp`.

@return int The command exit value; `0` usually means success.

@throws \Codeception\Exception\ModuleException If the status evaluates to non-zero and the `throw` configuration
parameter is set to `true`.
Executes a wp - cli command targeting the test WordPress installation .