Skip to content

Commit

Permalink
build(codeception.dist.yml) udpate to use MySQLServerController
Browse files Browse the repository at this point in the history
  • Loading branch information
lucatume committed Sep 13, 2024
1 parent efa9861 commit 264573b
Show file tree
Hide file tree
Showing 3 changed files with 1,358 additions and 701 deletions.
13 changes: 10 additions & 3 deletions bin/setup-wp.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Codeception\Configuration;
use lucatume\WPBrowser\ManagedProcess\MysqlServer;
use lucatume\WPBrowser\Utils\Filesystem;
use lucatume\WPBrowser\WordPress\ConfigurationData;
use lucatume\WPBrowser\WordPress\Database\MysqlDatabase;
Expand All @@ -10,9 +11,6 @@
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`;

require_once dirname(__DIR__) . '/vendor/autoload.php';

global $_composer_autoload_path, $_composer_bin_dir;
Expand All @@ -24,6 +22,15 @@
$dotenv = Dotenv\Dotenv::createImmutable(dirname(__DIR__) . '/tests');
$env = $dotenv->load();

$mysqlServer = new MysqlServer(
codecept_output_dir('_mysql_server'),
$_ENV['WORDPRESS_DB_LOCALHOST_PORT'],
$_ENV['WORDPRESS_DB_NAME'],
$_ENV['WORDPRESS_DB_USER'],
$_ENV['WORDPRESS_DB_PASSWORD']
);
$mysqlServer->start();

$wpRootDir = $env['WORDPRESS_ROOT_DIR'];

echo "Checking WordPress directory $wpRootDir ...\n";
Expand Down
7 changes: 6 additions & 1 deletion codeception.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extensions:
- "lucatume\\WPBrowser\\Extension\\EventDispatcherBridge"
- "lucatume\\WPBrowser\\Extension\\BuiltInServerController"
- "lucatume\\WPBrowser\\Extension\\ChromeDriverController"
- "lucatume\\WPBrowser\\Extension\\DockerComposeController"
- "lucatume\\WPBrowser\\Extension\\MysqlServerController"
- "lucatume\\WPBrowser\\Extension\\IsolationSupport"
config:
"lucatume\\WPBrowser\\Extension\\BuiltInServerController":
Expand All @@ -35,6 +35,11 @@ extensions:
"lucatume\\WPBrowser\\Extension\\DockerComposeController":
compose-file: docker-compose.yml
env-file: tests/.env
"lucatume\\WPBrowser\\Extension\\MysqlServerController":
port: '%WORDPRESS_DB_LOCALHOST_PORT%'
database: '%WORDPRESS_DB_NAME%'
user: '%WORDPRESS_DB_USER%'
password: '%WORDPRESS_DB_PASSWORD%'
commands:
- "lucatume\\WPBrowser\\Command\\RunOriginal"
- "lucatume\\WPBrowser\\Command\\RunAll"
Expand Down
Loading

0 comments on commit 264573b

Please sign in to comment.