From 43d5cc9b8689793b1cb5a65cd452a89409f7a3ac Mon Sep 17 00:00:00 2001 From: Matthew Batchelder Date: Tue, 26 May 2020 10:56:00 -0400 Subject: [PATCH] Generates a .htaccess file if missing in the WP root Sometimes the `.htaccess` file is missing. Sometimes it is empty. This adds two moments where we can generate the file. 1. When creating the WP directory. 2. Before executing the tests. --- src/commands/run.php | 2 ++ src/tric.php | 2 ++ src/wordpress.php | 33 +++++++++++++++++++++++++++++++++ tric | 1 + 4 files changed, 38 insertions(+) create mode 100644 src/wordpress.php diff --git a/src/commands/run.php b/src/commands/run.php index a23c213..d03bea8 100644 --- a/src/commands/run.php +++ b/src/commands/run.php @@ -31,6 +31,8 @@ setup_id(); +maybe_generate_htaccess(); + // Run the command in the Codeception container. $root = tric_plugins_dir( tric_target( true ) ); diff --git a/src/tric.php b/src/tric.php index 5dbb083..804ba4a 100644 --- a/src/tric.php +++ b/src/tric.php @@ -81,6 +81,8 @@ function setup_tric_env( $root_dir ) { exit( 1 ); } + maybe_generate_htaccess(); + $plugins_dir = getenv( 'TRIC_PLUGINS_DIR' ); if ( empty( $plugins_dir ) ) { $plugins_dir = root( '_plugins' ); diff --git a/src/wordpress.php b/src/wordpress.php new file mode 100644 index 0000000..15440e6 --- /dev/null +++ b/src/wordpress.php @@ -0,0 +1,33 @@ +