<?php use Behat\Gherkin\Node\PyStringNode, Behat\Gherkin\Node\TableNode, WP_CLI\Process; $steps->Given('/^an empty directory$/', function ($world) { $world->create_run_dir(); }); $steps->Given('/^an empty cache/', function ($world) { $world->variables['SUITE_CACHE_DIR'] = FeatureContext::create_cache_dir(); }); $steps->Given('/^an? ([^\\s]+) file:$/', function ($world, $path, PyStringNode $content) { $content = (string) $content . "\n"; $full_path = $world->variables['RUN_DIR'] . "/{$path}"; Process::create(\WP_CLI\utils\esc_cmd('mkdir -p %s', dirname($full_path)))->run_check(); file_put_contents($full_path, $content); }); $steps->Given('/^WP files$/', function ($world) { $world->download_wp(); }); $steps->Given('/^wp-config\\.php$/', function ($world) { $world->create_config(); }); $steps->Given('/^a database$/', function ($world) { $world->create_db(); }); $steps->Given('/^a WP install$/', function ($world) { $world->install_wp(); }); $steps->Given("/^a WP install in '([^\\s]+)'\$/", function ($world, $subdir) { $world->install_wp($subdir); }); $steps->Given('/^a WP multisite (subdirectory|subdomain)?\\s?install$/', function ($world, $type = 'subdirectory') {