public function it_should_generate_proper_command_class_with_arguments_and_parameters() { global $argv; $args = array('local', 'core', 'download', '--path=wordpress', '--force'); $argv = $args; \ViewOne\WPCLIEnvironment\Generator::generateCommandClass(); $test_class = file_get_contents(__DIR__ . '/../../template/CommandArgumentsParameters.php'); $this->shouldHaveGenerateFile($test_class); }
<?php if (!defined('WP_CLI')) { return; } require_once __DIR__ . '/src/ViewOne/WPCLIEnvironment/Environment.php'; require_once __DIR__ . '/src/ViewOne/WPCLIEnvironment/Command.php'; require_once __DIR__ . '/src/ViewOne/WPCLIEnvironment/Generator.php'; $dir = \ViewOne\WPCLIEnvironment\Generator::generateCommandClass(); $dir = \ViewOne\WPCLIEnvironment\Generator::getCachePath(); require_once $dir . '/wp-cli-environment/Command.php'; WP_CLI::add_command('local', 'Environment_Command'); WP_CLI::add_command('development', 'Environment_Command'); WP_CLI::add_command('production', 'Environment_Command'); WP_CLI::add_command('staging', 'Environment_Command'); WP_CLI::add_command('testing', 'Environment_Command');