Skip to content

Commit

Permalink
feat(setup) remove symlink step from setup
Browse files Browse the repository at this point in the history
  • Loading branch information
lucatume committed May 24, 2024
1 parent 385b7fb commit 39f4dc0
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 28 deletions.
1 change: 0 additions & 1 deletion bin/setup-wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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`;

Expand Down
5 changes: 3 additions & 2 deletions src/Template/Wpbrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <<<EOF
Expand Down
29 changes: 28 additions & 1 deletion tests/unit/Codeception/Template/WpbrowserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,15 @@ public function should_scaffold_for_theme_correctly(): void
$projectDir = FS::tmpDir('setup_', [
'theme_23' => [
'style.css' => "/*\nTheme Name: Theme 23\n*/",
'functions.php' => <<< PHP
<?php
function theme_23_some_function() {
return 'test-test-test';
}
add_action('after_setup_theme', 'theme_23_some_function');
PHP,
'index.php' => '<?php // This file is required for the theme to work. ?>',
'composer.json' => $composerFileCode,
'vendor' => [
'bin' => [
Expand Down Expand Up @@ -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
<?php
function theme_23_some_function() {
return 'test-test-test';
}
add_action('after_setup_theme', 'theme_23_some_function');
PHP,
'index.php' => '<?php // This file is required for the theme to work. ?>',
'composer.json' => $composerFileCode,
'vendor' => [
'bin' => [
Expand Down Expand Up @@ -464,6 +482,15 @@ public function should_scaffold_for_theme_custom_correctly(): void
Theme Name: Theme 23
*/
EOT,
'functions.php' => <<< PHP
<?php
function theme_23_some_function() {
return 'test-test-test';
}
add_action('after_setup_theme', 'theme_23_some_function');
PHP,
'index.php' => '<?php // This file is required for the theme to work. ?>',
'composer.json' => $composerFileCode,
'vendor' => [
'bin' => [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
>>> /functions.php >>>
<?php
function theme_23_some_function() {
return 'test-test-test';
}

add_action('after_setup_theme', 'theme_23_some_function');
<<< /functions.php <<<

>>> /index.php >>>
<?php // This file is required for the theme to work. ?>
<<< /index.php <<<

>>> /tests/EndToEnd.suite.yml >>>
# Integration suite configuration
#
Expand Down Expand Up @@ -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 >>>
Expand Down Expand Up @@ -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.
Expand All @@ -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 <<<

Expand Down Expand Up @@ -328,7 +341,7 @@ extensions:
>>> /style.css >>>
/*
Theme Name: Theme 23
Template: twentytwenty
Template: twentytwentyfour
*/
<<< /style.css <<<

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<<

Expand Down Expand Up @@ -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.
Expand All @@ -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 <<<

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<<

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<<

Expand Down Expand Up @@ -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.
Expand All @@ -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 <<<

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<<

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
>>> /functions.php >>>
<?php
function theme_23_some_function() {
return 'test-test-test';
}

add_action('after_setup_theme', 'theme_23_some_function');
<<< /functions.php <<<

>>> /index.php >>>
<?php // This file is required for the theme to work. ?>
<<< /index.php <<<

>>> /tests/EndToEnd.suite.yml >>>
# Integration suite configuration
#
Expand Down Expand Up @@ -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 >>>
Expand Down Expand Up @@ -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.
Expand All @@ -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 <<<

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
>>> /functions.php >>>
<?php
function theme_23_some_function() {
return 'test-test-test';
}

add_action('after_setup_theme', 'theme_23_some_function');
<<< /functions.php <<<

>>> /index.php >>>
<?php // This file is required for the theme to work. ?>
<<< /index.php <<<

>>> /composer >>>
#!/bin/sh
touch composer.lock
Expand Down Expand Up @@ -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 >>>
Expand Down

0 comments on commit 39f4dc0

Please sign in to comment.