diff --git a/bin/setup-wp.php b/bin/setup-wp.php index 2c389586c..62fa0f39a 100644 --- a/bin/setup-wp.php +++ b/bin/setup-wp.php @@ -9,7 +9,6 @@ use lucatume\WPBrowser\WordPress\InstallationState\EmptyDir; use lucatume\WPBrowser\WordPress\InstallationState\InstallationStateInterface; use lucatume\WPBrowser\WordPress\InstallationState\Scaffolded; - $dockerComposeEnvFile = escapeshellarg(dirname(__DIR__) . '/tests/.env'); `docker compose --env-file $dockerComposeEnvFile up --wait`; diff --git a/src/Template/Wpbrowser.php b/src/Template/Wpbrowser.php index 693411849..84dfafcd9 100644 --- a/src/Template/Wpbrowser.php +++ b/src/Template/Wpbrowser.php @@ -127,11 +127,12 @@ private function createIntegrationSuite(ProjectInterface $project): void { $plugins = ''; if ($project instanceof PluginProject) { - $plugins = "'{$project->getActivationString()}'"; + $basename = basename($project->getActivationString()); + $plugins = "'." . DIRECTORY_SEPARATOR . "{$basename}'"; } $theme = ''; if ($project instanceof ThemeProject) { - $theme = $project->getActivationString(); + $theme = '.'; } $suiteConfig = << [ 'style.css' => "/*\nTheme Name: Theme 23\n*/", + 'functions.php' => <<< PHP + '', 'composer.json' => $composerFileCode, 'vendor' => [ 'bin' => [ @@ -392,9 +401,18 @@ public function should_scaffold_for_child_theme_correctly(): void 'style.css' => <<< EOT /* Theme Name: Theme 23 -Template: twentytwenty +Template: twentytwentyfour */ EOT, + 'functions.php' => <<< PHP + '', 'composer.json' => $composerFileCode, 'vendor' => [ 'bin' => [ @@ -464,6 +482,15 @@ public function should_scaffold_for_theme_custom_correctly(): void Theme Name: Theme 23 */ EOT, + 'functions.php' => <<< PHP + '', 'composer.json' => $composerFileCode, 'vendor' => [ 'bin' => [ diff --git a/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_child_theme_correctly__0.snapshot b/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_child_theme_correctly__0.snapshot index 2a777b596..d3065ab51 100644 --- a/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_child_theme_correctly__0.snapshot +++ b/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_child_theme_correctly__0.snapshot @@ -1,3 +1,16 @@ +>>> /functions.php >>> +>> /index.php >>> + +<<< /index.php <<< + >>> /tests/EndToEnd.suite.yml >>> # Integration suite configuration # @@ -125,7 +138,7 @@ modules: adminEmail: 'admin@%WORDPRESS_DOMAIN%' title: 'Integration Tests' plugins: [] - theme: 'theme_23' + theme: '.' <<< /tests/Integration.suite.yml <<< >>> /tests/Support/IntegrationTester.php >>> @@ -257,8 +270,8 @@ TEST_TABLE_PREFIX=test_ WORDPRESS_TABLE_PREFIX=wp_ # The URL and domain of the WordPress site used in end-to-end tests. -WORDPRESS_URL=http://localhost:39249 -WORDPRESS_DOMAIN=localhost:39249 +WORDPRESS_URL=http://localhost:59860 +WORDPRESS_DOMAIN=localhost:59860 WORDPRESS_ADMIN_PATH=/wp-admin # The username and password of the administrator user of the WordPress site used in end-to-end tests. @@ -267,10 +280,10 @@ WORDPRESS_ADMIN_PASSWORD=password # The host and port of the ChromeDriver server that will be used in end-to-end tests. CHROMEDRIVER_HOST=localhost -CHROMEDRIVER_PORT=43995 +CHROMEDRIVER_PORT=21551 # The port on which the PHP built-in server will serve the WordPress installation. -BUILTIN_SERVER_PORT=39249 +BUILTIN_SERVER_PORT=59860 <<< /tests/.env <<< @@ -328,7 +341,7 @@ extensions: >>> /style.css >>> /* Theme Name: Theme 23 -Template: twentytwenty +Template: twentytwentyfour */ <<< /style.css <<< diff --git a/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_plugin_with_non_plugin_php_file__0.snapshot b/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_plugin_with_non_plugin_php_file__0.snapshot index 94aa0c6c0..4e155a908 100644 --- a/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_plugin_with_non_plugin_php_file__0.snapshot +++ b/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_plugin_with_non_plugin_php_file__0.snapshot @@ -124,7 +124,7 @@ modules: domain: '%WORDPRESS_DOMAIN%' adminEmail: 'admin@%WORDPRESS_DOMAIN%' title: 'Integration Tests' - plugins: ['plugin_89/main-file.php'] + plugins: ['./main-file.php'] theme: '' <<< /tests/Integration.suite.yml <<< @@ -265,8 +265,8 @@ TEST_TABLE_PREFIX=test_ WORDPRESS_TABLE_PREFIX=wp_ # The URL and domain of the WordPress site used in end-to-end tests. -WORDPRESS_URL=http://localhost:53890 -WORDPRESS_DOMAIN=localhost:53890 +WORDPRESS_URL=http://localhost:43626 +WORDPRESS_DOMAIN=localhost:43626 WORDPRESS_ADMIN_PATH=/wp-admin # The username and password of the administrator user of the WordPress site used in end-to-end tests. @@ -275,10 +275,10 @@ WORDPRESS_ADMIN_PASSWORD=password # The host and port of the ChromeDriver server that will be used in end-to-end tests. CHROMEDRIVER_HOST=localhost -CHROMEDRIVER_PORT=27014 +CHROMEDRIVER_PORT=35449 # The port on which the PHP built-in server will serve the WordPress installation. -BUILTIN_SERVER_PORT=53890 +BUILTIN_SERVER_PORT=43626 <<< /tests/.env <<< diff --git a/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_plugin_with_non_plugin_php_file_custom__0.snapshot b/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_plugin_with_non_plugin_php_file_custom__0.snapshot index 8f0699f8f..77f9d15dd 100644 --- a/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_plugin_with_non_plugin_php_file_custom__0.snapshot +++ b/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_plugin_with_non_plugin_php_file_custom__0.snapshot @@ -89,7 +89,7 @@ modules: domain: '%WORDPRESS_DOMAIN%' adminEmail: 'admin@%WORDPRESS_DOMAIN%' title: 'Integration Tests' - plugins: ['plugin_89/main.php'] + plugins: ['./main.php'] theme: '' <<< /tests/Integration.suite.yml <<< diff --git a/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_plugin_with_plugin_php_file__0.snapshot b/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_plugin_with_plugin_php_file__0.snapshot index 56be82bd8..28262e513 100644 --- a/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_plugin_with_plugin_php_file__0.snapshot +++ b/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_plugin_with_plugin_php_file__0.snapshot @@ -129,7 +129,7 @@ modules: domain: '%WORDPRESS_DOMAIN%' adminEmail: 'admin@%WORDPRESS_DOMAIN%' title: 'Integration Tests' - plugins: ['plugin_89/plugin.php'] + plugins: ['./plugin.php'] theme: '' <<< /tests/Integration.suite.yml <<< @@ -270,8 +270,8 @@ TEST_TABLE_PREFIX=test_ WORDPRESS_TABLE_PREFIX=wp_ # The URL and domain of the WordPress site used in end-to-end tests. -WORDPRESS_URL=http://localhost:19501 -WORDPRESS_DOMAIN=localhost:19501 +WORDPRESS_URL=http://localhost:14326 +WORDPRESS_DOMAIN=localhost:14326 WORDPRESS_ADMIN_PATH=/wp-admin # The username and password of the administrator user of the WordPress site used in end-to-end tests. @@ -280,10 +280,10 @@ WORDPRESS_ADMIN_PASSWORD=password # The host and port of the ChromeDriver server that will be used in end-to-end tests. CHROMEDRIVER_HOST=localhost -CHROMEDRIVER_PORT=13899 +CHROMEDRIVER_PORT=34581 # The port on which the PHP built-in server will serve the WordPress installation. -BUILTIN_SERVER_PORT=19501 +BUILTIN_SERVER_PORT=14326 <<< /tests/.env <<< diff --git a/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_plugin_with_plugin_php_file_custom__0.snapshot b/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_plugin_with_plugin_php_file_custom__0.snapshot index 3eb25f223..0734db2f2 100644 --- a/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_plugin_with_plugin_php_file_custom__0.snapshot +++ b/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_plugin_with_plugin_php_file_custom__0.snapshot @@ -89,7 +89,7 @@ modules: domain: '%WORDPRESS_DOMAIN%' adminEmail: 'admin@%WORDPRESS_DOMAIN%' title: 'Integration Tests' - plugins: ['plugin_89/plugin.php'] + plugins: ['./plugin.php'] theme: '' <<< /tests/Integration.suite.yml <<< diff --git a/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_theme_correctly__0.snapshot b/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_theme_correctly__0.snapshot index 82c54f0aa..7e4d61fd6 100644 --- a/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_theme_correctly__0.snapshot +++ b/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_theme_correctly__0.snapshot @@ -1,3 +1,16 @@ +>>> /functions.php >>> +>> /index.php >>> + +<<< /index.php <<< + >>> /tests/EndToEnd.suite.yml >>> # Integration suite configuration # @@ -125,7 +138,7 @@ modules: adminEmail: 'admin@%WORDPRESS_DOMAIN%' title: 'Integration Tests' plugins: [] - theme: 'theme_23' + theme: '.' <<< /tests/Integration.suite.yml <<< >>> /tests/Support/IntegrationTester.php >>> @@ -257,8 +270,8 @@ TEST_TABLE_PREFIX=test_ WORDPRESS_TABLE_PREFIX=wp_ # The URL and domain of the WordPress site used in end-to-end tests. -WORDPRESS_URL=http://localhost:61144 -WORDPRESS_DOMAIN=localhost:61144 +WORDPRESS_URL=http://localhost:8431 +WORDPRESS_DOMAIN=localhost:8431 WORDPRESS_ADMIN_PATH=/wp-admin # The username and password of the administrator user of the WordPress site used in end-to-end tests. @@ -267,10 +280,10 @@ WORDPRESS_ADMIN_PASSWORD=password # The host and port of the ChromeDriver server that will be used in end-to-end tests. CHROMEDRIVER_HOST=localhost -CHROMEDRIVER_PORT=17476 +CHROMEDRIVER_PORT=44085 # The port on which the PHP built-in server will serve the WordPress installation. -BUILTIN_SERVER_PORT=61144 +BUILTIN_SERVER_PORT=8431 <<< /tests/.env <<< diff --git a/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_theme_custom_correctly__0.snapshot b/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_theme_custom_correctly__0.snapshot index 6e8c18c1f..6cee5d442 100644 --- a/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_theme_custom_correctly__0.snapshot +++ b/tests/unit/Codeception/Template/__snapshots__/WpbrowserTest__should_scaffold_for_theme_custom_correctly__0.snapshot @@ -1,3 +1,16 @@ +>>> /functions.php >>> +>> /index.php >>> + +<<< /index.php <<< + >>> /composer >>> #!/bin/sh touch composer.lock @@ -92,7 +105,7 @@ modules: adminEmail: 'admin@%WORDPRESS_DOMAIN%' title: 'Integration Tests' plugins: [] - theme: 'theme_23' + theme: '.' <<< /tests/Integration.suite.yml <<< >>> /tests/Support/IntegrationTester.php >>>