diff --git a/features/behat-steps.feature b/features/behat-steps.feature index 1620e011..e6bcea87 100644 --- a/features/behat-steps.feature +++ b/features/behat-steps.feature @@ -462,6 +462,78 @@ Feature: Test that WP-CLI Behat steps work as expected 404 Not Found """ + Scenario: Test "a PHP built-in web server" step without an index.php does not use the server-command router + Given an empty directory + And a vendor/wp-cli/server-command/router.php file: + """ + get_php_server_router(); + // The router sends every request for a missing file to index.php, so it is + // only used when the directory has one. Without a router, PHP's built-in + // web server serves the directory as-is, which is what a plain directory of + // static files needs, and a missing file is a 404. Passing a router path + // that does not exist would make every request fail with a fatal error. + $router = is_file( $dir . 'index.php' ) ? $this->get_php_server_router() : null; if ( null !== $router ) { $cmd .= ' ' . escapeshellarg( $router ); }