From 7e85e1341a5c4a883c1358c851b6411aa371c4bd Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Sat, 9 Dec 2023 14:57:33 +0100 Subject: [PATCH 01/11] fix(Adapters/Process) back-compat for create_new_console --- .../Symfony/Component/Process/Process.php | 43 +++++++++++-------- src/ManagedProcess/ChromeDriver.php | 2 +- src/ManagedProcess/PhpBuiltInServer.php | 2 +- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/Adapters/Symfony/Component/Process/Process.php b/src/Adapters/Symfony/Component/Process/Process.php index ce3a18790..1ebae185c 100644 --- a/src/Adapters/Symfony/Component/Process/Process.php +++ b/src/Adapters/Symfony/Component/Process/Process.php @@ -3,14 +3,16 @@ namespace lucatume\WPBrowser\Adapters\Symfony\Component\Process; use Symfony\Component\Process\Exception\LogicException; +use Symfony\Component\Process\Pipes\PipesInterface; use Symfony\Component\Process\Process as SymfonyProcess; class Process extends SymfonyProcess { /** - * @var array + * @var bool */ - private $options = []; + private $createNewConsole = false; + /** * @param string[] $command * @param array|null $env @@ -50,28 +52,31 @@ public function getStartTime(): float return $startTime; } - /** - * @param string $name - * @param array $arguments - * @return void - */ - public function __call(string $name, array $arguments) + public function __destruct() { - if ($name === 'setOptions') { - $this->options = $arguments[0] ?? []; + if ($this->createNewConsole) { + $processPipesProperty = new \ReflectionProperty(SymfonyProcess::class, 'processPipes'); + $processPipesProperty->setAccessible(true); + /** @var PipesInterface $processPipes */ + $processPipes = $processPipesProperty->getValue($this); + $processPipes->close(); + + return; } - return; + + $this->stop(0); } - public function __destruct() + public function createNewConsole(): void { - if (($this->options['create_new_console'] ?? false) || method_exists($this, 'setOptions')) { - parent::__destruct(); - return; - } + $this->createNewConsole = true; - $closeMethodReflection = new \ReflectionMethod(SymfonyProcess::class, 'close'); - $closeMethodReflection->setAccessible(true); - $closeMethodReflection->invoke($this); + $optionsReflectionProperty = new \ReflectionProperty(SymfonyProcess::class, 'options'); + $optionsReflectionProperty->setAccessible(true); + $options = $optionsReflectionProperty->getValue($this); + $options = is_array($options) ? $options : []; + $options['create_new_console'] = true; + $options['bypass_shell'] = true; + $optionsReflectionProperty->setValue($this, $options); } } diff --git a/src/ManagedProcess/ChromeDriver.php b/src/ManagedProcess/ChromeDriver.php index 5055b1ceb..e4e174c84 100644 --- a/src/ManagedProcess/ChromeDriver.php +++ b/src/ManagedProcess/ChromeDriver.php @@ -48,7 +48,7 @@ public function doStart(): void { $command = [$this->chromeDriverBinary, '--port=' . $this->port, ...$this->arguments]; $process = new Process($command); - $process->setOptions(['create_new_console' => true]); + $process->createNewConsole(); $process->start(); $this->confirmStart($process); $this->pid = $process->getPid(); diff --git a/src/ManagedProcess/PhpBuiltInServer.php b/src/ManagedProcess/PhpBuiltInServer.php index 516629731..1f24f631c 100644 --- a/src/ManagedProcess/PhpBuiltInServer.php +++ b/src/ManagedProcess/PhpBuiltInServer.php @@ -71,7 +71,7 @@ public function doStart(): void $this->docRoot, $this->env ); - $process->setOptions(['create_new_console' => true]); + $process->createNewConsole(); $process->start(); if (!$this->confirmServerRunningOnPort($process)) { $error = new RuntimeException( From 2b9b78e050ba457dda7975ea33e2390cfc59d87c Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Sat, 9 Dec 2023 18:42:03 +0100 Subject: [PATCH 02/11] fix(Adapaters/Process) shim fromShellCommandline method --- .../Symfony/Component/Process/Process.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Adapters/Symfony/Component/Process/Process.php b/src/Adapters/Symfony/Component/Process/Process.php index 1ebae185c..05bdcb45e 100644 --- a/src/Adapters/Symfony/Component/Process/Process.php +++ b/src/Adapters/Symfony/Component/Process/Process.php @@ -79,4 +79,22 @@ public function createNewConsole(): void $options['bypass_shell'] = true; $optionsReflectionProperty->setValue($this, $options); } + + /** + * @param array $arguments + */ + public static function __callStatic(string $name, array $arguments):mixed + { + if ($name === 'fromShellCommandline') { + $command = array_shift($arguments); + $process = new self([], ...$arguments); // @phpstan-ignore-line + $processCommandLineProperty = new \ReflectionProperty(SymfonyProcess::class, 'commandline'); + $processCommandLineProperty->setAccessible(true); + $processCommandLineProperty->setValue($process, $command); + + return $process; + } + + return null; + } } From 5c6ece9897c695210d5bcbcada2741b176ab3428 Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Mon, 11 Dec 2023 09:00:43 +0100 Subject: [PATCH 03/11] test(wploadersuite) suppress wpdb errors to work around older WC activation issues --- tests/wploadersuite/AjaxTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/wploadersuite/AjaxTest.php b/tests/wploadersuite/AjaxTest.php index 9e01c78a1..67774a377 100644 --- a/tests/wploadersuite/AjaxTest.php +++ b/tests/wploadersuite/AjaxTest.php @@ -26,11 +26,15 @@ public function testAjaxCallbackWillFailIfNumberNotOnlyOnceIsInvalid(): void { $response = null; try { + global $wpdb; + $wpdb->suppress_errors = true; // Due to a WooCommerce activation issue in older versions. $this->_handleAjax('test_ajax_action'); } catch (\WPAjaxDieContinueException) { $response = json_decode($this->_last_response); } + $wpdb->suppress_errors = false; + $this->assertNotNull($response); $this->assertFalse($response->success); $this->assertEquals('Number not only once is invalid', $response->data); From ff87df622052bd372c033df97cd00ec0dd1069e7 Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Mon, 11 Dec 2023 09:31:30 +0100 Subject: [PATCH 04/11] test(Issue) remove dud suite --- tests/Issue/BlogArchiveCest.php | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 tests/Issue/BlogArchiveCest.php diff --git a/tests/Issue/BlogArchiveCest.php b/tests/Issue/BlogArchiveCest.php deleted file mode 100644 index b723c08a5..000000000 --- a/tests/Issue/BlogArchiveCest.php +++ /dev/null @@ -1,6 +0,0 @@ - Date: Thu, 14 Dec 2023 08:30:37 +0100 Subject: [PATCH 05/11] doc(CHANGELOG.md) add missing entry --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6561f60ad..4d1b0653d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [unreleased] Unreleased +### Fixed + +- Improve router script to speed up localhost server. + ## [4.0.16] 2023-12-07; ### Changed From 4dedb841d5aeb56884069c917e193818887f60ca Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Thu, 14 Dec 2023 09:11:23 +0100 Subject: [PATCH 06/11] build(.github) add v3.5 automated build workflow --- .github/workflows/build-35.yml | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/build-35.yml diff --git a/.github/workflows/build-35.yml b/.github/workflows/build-35.yml new file mode 100644 index 000000000..56ce6c633 --- /dev/null +++ b/.github/workflows/build-35.yml @@ -0,0 +1,44 @@ +name: Automated v3.5 build + +on: + workflow_dispatch: # yamllint disable-line rule:truthy + +jobs: + build_v3_5: + name: v3.5 Build + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "8.2" + coverage: "none" + - name: Validate Composer configuration + run: composer validate --no-interaction --strict + - name: Install dependencies + uses: ramsey/composer-install@v2 + - name: "Check PSR-4 mapping" + run: "composer dump-autoload --no-interaction --optimize --strict-psr" + - name: "Require rector" + run: "composer require --dev rector/rector" + - name: Build v3.5 + run: | + vendor/bin/rector --config=config/rector-35.php + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + base: "v3.5" + token: ${{ secrets.V35_BUILD_TOKEN }} + commit-message: "v3.5 automated build change" + committer: "lucatume " + branch: "v3.5-automated-build" + delete-branch: true + title: "v3.5 automated build" + body: "v3.5 automated build changes created by the v3.5 automated build workflow" + assignees: "lucatume" + add-paths: | + includes/*.php + src/*.php + tests/*.php From cdeeb8f57b4b930bdf512802d5a96ec48531037d Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Thu, 14 Dec 2023 09:17:28 +0100 Subject: [PATCH 07/11] test(unit) remove use of PHPUnit functions from WPLoaderTest --- .../WPBrowser/Events/Module/WPLoaderTest.php | 321 +++++++++--------- 1 file changed, 157 insertions(+), 164 deletions(-) diff --git a/tests/unit/lucatume/WPBrowser/Events/Module/WPLoaderTest.php b/tests/unit/lucatume/WPBrowser/Events/Module/WPLoaderTest.php index 5ac694ea1..090902dfb 100644 --- a/tests/unit/lucatume/WPBrowser/Events/Module/WPLoaderTest.php +++ b/tests/unit/lucatume/WPBrowser/Events/Module/WPLoaderTest.php @@ -28,20 +28,13 @@ use lucatume\WPBrowser\WordPress\InstallationException; use lucatume\WPBrowser\WordPress\InstallationState\InstallationStateInterface; use lucatume\WPBrowser\WordPress\InstallationState\Scaffolded; -use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestResult; use stdClass; use tad\Codeception\SnapshotAssertions\SnapshotAssertions; use UnitTester; use WP_Theme; -use function PHPUnit\Framework\assertEquals; -use function PHPUnit\Framework\assertFalse; -use function PHPUnit\Framework\assertFileExists; -use function PHPUnit\Framework\assertInstanceOf; -use function PHPUnit\Framework\assertNotEquals; -use function PHPUnit\Framework\assertTrue; - use const ABSPATH; use const WP_DEBUG; @@ -204,8 +197,8 @@ public function should_allow_specifying_the_wp_root_folder_as_a_relative_path_to $this->assertInIsolation(static function () use ($rootDir, $wpLoader1) { chdir($rootDir); $wpLoader1->_initialize(); - assertEquals($rootDir . '/test/wordpress/', $wpLoader1->_getConfig('wpRootFolder')); - assertEquals($rootDir . '/test/wordpress/', $wpLoader1->getWpRootFolder()); + Assert::assertEquals($rootDir . '/test/wordpress/', $wpLoader1->_getConfig('wpRootFolder')); + Assert::assertEquals($rootDir . '/test/wordpress/', $wpLoader1->getWpRootFolder()); }, $rootDir); $this->config = [ @@ -221,8 +214,8 @@ public function should_allow_specifying_the_wp_root_folder_as_a_relative_path_to $this->assertInIsolation(static function () use ($rootDir, $wpLoader2) { chdir($rootDir); $wpLoader2->_initialize(); - assertEquals($rootDir . '/test/wordpress/', $wpLoader2->_getConfig('wpRootFolder')); - assertEquals($rootDir . '/test/wordpress/', $wpLoader2->getWpRootFolder()); + Assert::assertEquals($rootDir . '/test/wordpress/', $wpLoader2->_getConfig('wpRootFolder')); + Assert::assertEquals($rootDir . '/test/wordpress/', $wpLoader2->getWpRootFolder()); }, $rootDir); } @@ -251,8 +244,8 @@ public function should_allow_specifying_the_wp_root_folder_including_the_home_sy $_SERVER['HOME'] = $homeDir; $wpLoader->_initialize(); - assertEquals($homeDir . '/projects/work/acme/wordpress/', $wpLoader->_getConfig('wpRootFolder')); - assertEquals($homeDir . '/projects/work/acme/wordpress/', $wpLoader->getWpRootFolder()); + Assert::assertEquals($homeDir . '/projects/work/acme/wordpress/', $wpLoader->_getConfig('wpRootFolder')); + Assert::assertEquals($homeDir . '/projects/work/acme/wordpress/', $wpLoader->getWpRootFolder()); }); } @@ -278,8 +271,8 @@ public function should_allow_specifying_the_wp_root_folder_as_an_absolute_path() $this->assertInIsolation(static function () use ($wpRootDir, $wpLoader) { $wpLoader->_initialize(); - assertEquals($wpRootDir . '/', $wpLoader->_getConfig('wpRootFolder')); - assertEquals($wpRootDir . '/', $wpLoader->getWpRootFolder()); + Assert::assertEquals($wpRootDir . '/', $wpLoader->_getConfig('wpRootFolder')); + Assert::assertEquals($wpRootDir . '/', $wpLoader->getWpRootFolder()); }); } @@ -305,8 +298,8 @@ public function should_allow_specifying_the_wp_root_folder_as_absolute_path_with $this->assertInIsolation(static function () use ($wpRootDir, $wpLoader) { $wpLoader->_initialize(); - assertEquals($wpRootDir . '/Word Press/', $wpLoader->_getConfig('wpRootFolder')); - assertEquals($wpRootDir . '/Word Press/', $wpLoader->getWpRootFolder()); + Assert::assertEquals($wpRootDir . '/Word Press/', $wpLoader->_getConfig('wpRootFolder')); + Assert::assertEquals($wpRootDir . '/Word Press/', $wpLoader->getWpRootFolder()); }); } @@ -331,7 +324,7 @@ public function should_scaffold_the_installation_if_the_wp_root_folder_is_empty( $this->assertInIsolation(static function () use ($wpLoader) { $wpLoader->_initialize(); - assertInstanceOf(Scaffolded::class, $wpLoader->getInstallation()->getState()); + Assert::assertInstanceOf(Scaffolded::class, $wpLoader->getInstallation()->getState()); }); } @@ -363,14 +356,14 @@ public function should_read_salts_from_configured_installation(): void $wpLoader->_initialize(); $installation = $wpLoader->getInstallation(); - assertEquals($installation->getAuthKey(), $wpLoader->_getConfig('AUTH_KEY')); - assertEquals($installation->getSecureAuthKey(), $wpLoader->_getConfig('SECURE_AUTH_KEY')); - assertEquals($installation->getLoggedInKey(), $wpLoader->_getConfig('LOGGED_IN_KEY')); - assertEquals($installation->getNonceKey(), $wpLoader->_getConfig('NONCE_KEY')); - assertEquals($installation->getAuthSalt(), $wpLoader->_getConfig('AUTH_SALT')); - assertEquals($installation->getSecureAuthSalt(), $wpLoader->_getConfig('SECURE_AUTH_SALT')); - assertEquals($installation->getLoggedInSalt(), $wpLoader->_getConfig('LOGGED_IN_SALT')); - assertEquals($installation->getNonceSalt(), $wpLoader->_getConfig('NONCE_SALT')); + Assert::assertEquals($installation->getAuthKey(), $wpLoader->_getConfig('AUTH_KEY')); + Assert::assertEquals($installation->getSecureAuthKey(), $wpLoader->_getConfig('SECURE_AUTH_KEY')); + Assert::assertEquals($installation->getLoggedInKey(), $wpLoader->_getConfig('LOGGED_IN_KEY')); + Assert::assertEquals($installation->getNonceKey(), $wpLoader->_getConfig('NONCE_KEY')); + Assert::assertEquals($installation->getAuthSalt(), $wpLoader->_getConfig('AUTH_SALT')); + Assert::assertEquals($installation->getSecureAuthSalt(), $wpLoader->_getConfig('SECURE_AUTH_SALT')); + Assert::assertEquals($installation->getLoggedInSalt(), $wpLoader->_getConfig('LOGGED_IN_SALT')); + Assert::assertEquals($installation->getNonceSalt(), $wpLoader->_getConfig('NONCE_SALT')); }); } @@ -396,9 +389,9 @@ public function should_allow_getting_paths_from_the_wp_root_folder(): void $this->assertInIsolation(static function () use ($wpRootDir, $wpLoader) { $wpLoader->_initialize(); - assertEquals($wpRootDir . '/foo-bar', $wpLoader->getWpRootFolder('foo-bar')); - assertEquals($wpRootDir . '/foo-bar/baz', $wpLoader->getWpRootFolder('foo-bar/baz')); - assertEquals($wpRootDir . '/wp-config.php', $wpLoader->getWpRootFolder('wp-config.php')); + Assert::assertEquals($wpRootDir . '/foo-bar', $wpLoader->getWpRootFolder('foo-bar')); + Assert::assertEquals($wpRootDir . '/foo-bar/baz', $wpLoader->getWpRootFolder('foo-bar/baz')); + Assert::assertEquals($wpRootDir . '/wp-config.php', $wpLoader->getWpRootFolder('wp-config.php')); }); } @@ -435,9 +428,9 @@ public function should_set_some_default_values_for_salt_keys(): void ]; foreach ($var as $i => $key) { if ($i > 0) { - assertNotEquals($var[$i - 1], $wpLoader->_getConfig($key)); + Assert::assertNotEquals($var[$i - 1], $wpLoader->_getConfig($key)); } - assertEquals(64, strlen($wpLoader->_getConfig($key))); + Assert::assertEquals(64, strlen($wpLoader->_getConfig($key))); } }); } @@ -463,7 +456,7 @@ public function should_load_config_files_if_set(): void $this->assertInIsolation(static function () use ($wpLoader) { $wpLoader->_initialize(); - assertEquals('test_file_001.php', getenv('LOADED')); + Assert::assertEquals('test_file_001.php', getenv('LOADED')); }); $this->config = [ @@ -483,8 +476,8 @@ public function should_load_config_files_if_set(): void $this->assertInIsolation(static function () use ($wpLoader) { $wpLoader->_initialize(); - assertEquals(getenv('LOADED_2'), 'test_file_002.php'); - assertEquals(getenv('LOADED_3'), 'test_file_003.php'); + Assert::assertEquals(getenv('LOADED_2'), 'test_file_002.php'); + Assert::assertEquals(getenv('LOADED_3'), 'test_file_003.php'); }); } @@ -512,10 +505,10 @@ public function should_throw_if_config_files_do_not_exist(): void try { $wpLoader->_initialize(); } catch (Exception $e) { - assertInstanceOf(ModuleConfigException::class, $e); + Assert::assertInstanceOf(ModuleConfigException::class, $e); $captured = true; } - assertTrue($captured); + Assert::assertTrue($captured); }); $this->config = [ @@ -700,8 +693,8 @@ public function should_load_word_press_before_suite_if_load_only_w_config_files( $this->assertInIsolation(static function () use ($wpRootDir, $wpLoader) { $wpLoader->_initialize(); - assertEquals('', getenv('LOADED_2')); - assertFalse(defined('ABSPATH')); + Assert::assertEquals('', getenv('LOADED_2')); + Assert::assertFalse(defined('ABSPATH')); $actions = []; Dispatcher::addListener(WPLoader::EVENT_BEFORE_LOADONLY, static function () use (&$actions) { @@ -713,13 +706,13 @@ public function should_load_word_press_before_suite_if_load_only_w_config_files( Dispatcher::dispatch(Events::SUITE_BEFORE); - assertEquals('test_file_002.php', getenv('LOADED_2')); - assertEquals($wpRootDir . '/', ABSPATH); - assertEquals([ + Assert::assertEquals('test_file_002.php', getenv('LOADED_2')); + Assert::assertEquals($wpRootDir . '/', ABSPATH); + Assert::assertEquals([ WPLoader::EVENT_BEFORE_LOADONLY, WPLoader::EVENT_AFTER_LOADONLY, ], $actions); - assertInstanceOf(FactoryStore::class, $wpLoader->factory()); + Assert::assertInstanceOf(FactoryStore::class, $wpLoader->factory()); }); } @@ -803,7 +796,7 @@ public function should_not_throw_when_load_only_true_and_using_db_module( Dispatcher::dispatch(Events::SUITE_BEFORE); - assertEquals($wpRootDir . '/', ABSPATH); + Assert::assertEquals($wpRootDir . '/', ABSPATH); }); } @@ -944,11 +937,11 @@ public function should_should_install_and_bootstrap_single_site_using_constants_ $this->assertInIsolation(static function () use ($wpLoader, $wpRootDir) { $wpLoader->_initialize(); - assertEquals('test_file_001.php', getenv('LOADED')); - assertEquals('test_file_002.php', getenv('LOADED_2')); - assertEquals($wpRootDir . '/', ABSPATH); - assertTrue(defined('WP_DEBUG')); - assertTrue(WP_DEBUG); + Assert::assertEquals('test_file_001.php', getenv('LOADED')); + Assert::assertEquals('test_file_002.php', getenv('LOADED_2')); + Assert::assertEquals($wpRootDir . '/', ABSPATH); + Assert::assertTrue(defined('WP_DEBUG')); + Assert::assertTrue(WP_DEBUG); }); } @@ -1038,31 +1031,31 @@ public function should_install_and_bootstrap_single_installation(): void if (PHP_VERSION >= 7.4) { $expectedActivePlugins[] = 'woocommerce/woocommerce.php'; } - assertEquals($expectedActivePlugins, get_option('active_plugins')); - assertEquals([ + Assert::assertEquals($expectedActivePlugins, get_option('active_plugins')); + Assert::assertEquals([ 'before_install', 'after_install', ], $actions); - assertEquals('twentytwenty', get_option('template')); - assertEquals('twentytwenty', get_option('stylesheet')); - assertEquals('test_file_001.php', getenv('LOADED')); - assertEquals('test_file_002.php', getenv('LOADED_2')); - assertEquals($wpRootDir . '/', ABSPATH); - assertTrue(defined('WP_DEBUG')); - assertTrue(WP_DEBUG); - assertInstanceOf(\wpdb::class, $GLOBALS['wpdb']); - assertFalse(is_multisite()); - assertEquals($wpRootDir . '/wp-content/', $wpLoader->getContentFolder()); - assertEquals($wpRootDir . '/wp-content/some/path', $wpLoader->getContentFolder('some/path')); - assertEquals( + Assert::assertEquals('twentytwenty', get_option('template')); + Assert::assertEquals('twentytwenty', get_option('stylesheet')); + Assert::assertEquals('test_file_001.php', getenv('LOADED')); + Assert::assertEquals('test_file_002.php', getenv('LOADED_2')); + Assert::assertEquals($wpRootDir . '/', ABSPATH); + Assert::assertTrue(defined('WP_DEBUG')); + Assert::assertTrue(WP_DEBUG); + Assert::assertInstanceOf(\wpdb::class, $GLOBALS['wpdb']); + Assert::assertFalse(is_multisite()); + Assert::assertEquals($wpRootDir . '/wp-content/', $wpLoader->getContentFolder()); + Assert::assertEquals($wpRootDir . '/wp-content/some/path', $wpLoader->getContentFolder('some/path')); + Assert::assertEquals( $wpRootDir . '/wp-content/some/path/some-file.php', $wpLoader->getContentFolder('some/path/some-file.php') ); - assertEquals( + Assert::assertEquals( $wpRootDir . '/wp-content/plugins/some-file.php', $wpLoader->getPluginsFolder('/some-file.php') ); - assertEquals( + Assert::assertEquals( $wpRootDir . '/wp-content/themes/some-file.php', $wpLoader->getThemesFolder('/some-file.php') ); @@ -1129,32 +1122,32 @@ public function should_install_and_bootstrap_multisite_installation(): void if (PHP_VERSION >= 7.4) { $expectedActivePlugins[] = 'woocommerce/woocommerce.php'; } - assertEquals($expectedActivePlugins, array_keys(get_site_option('active_sitewide_plugins'))); - assertEquals([ + Assert::assertEquals($expectedActivePlugins, array_keys(get_site_option('active_sitewide_plugins'))); + Assert::assertEquals([ 'before_install', 'after_install', ], $actions); - assertEquals('twentytwenty', get_option('template')); - assertEquals('twentytwenty', get_option('stylesheet')); - assertEquals(['twentytwenty' => true], WP_Theme::get_allowed()); - assertEquals('test_file_001.php', getenv('LOADED')); - assertEquals('test_file_002.php', getenv('LOADED_2')); - assertEquals($wpRootDir . '/', ABSPATH); - assertTrue(defined('WP_DEBUG')); - assertTrue(WP_DEBUG); - assertInstanceOf(\wpdb::class, $GLOBALS['wpdb']); - assertTrue(is_multisite()); - assertEquals($wpRootDir . '/wp-content/', $wpLoader->getContentFolder()); - assertEquals($wpRootDir . '/wp-content/some/path', $wpLoader->getContentFolder('some/path')); - assertEquals( + Assert::assertEquals('twentytwenty', get_option('template')); + Assert::assertEquals('twentytwenty', get_option('stylesheet')); + Assert::assertEquals(['twentytwenty' => true], WP_Theme::get_allowed()); + Assert::assertEquals('test_file_001.php', getenv('LOADED')); + Assert::assertEquals('test_file_002.php', getenv('LOADED_2')); + Assert::assertEquals($wpRootDir . '/', ABSPATH); + Assert::assertTrue(defined('WP_DEBUG')); + Assert::assertTrue(WP_DEBUG); + Assert::assertInstanceOf(\wpdb::class, $GLOBALS['wpdb']); + Assert::assertTrue(is_multisite()); + Assert::assertEquals($wpRootDir . '/wp-content/', $wpLoader->getContentFolder()); + Assert::assertEquals($wpRootDir . '/wp-content/some/path', $wpLoader->getContentFolder('some/path')); + Assert::assertEquals( $wpRootDir . '/wp-content/some/path/some-file.php', $wpLoader->getContentFolder('some/path/some-file.php') ); - assertEquals( + Assert::assertEquals( $wpRootDir . '/wp-content/plugins/some-file.php', $wpLoader->getPluginsFolder('/some-file.php') ); - assertEquals( + Assert::assertEquals( $wpRootDir . '/wp-content/themes/some-file.php', $wpLoader->getThemesFolder('/some-file.php') ); @@ -1420,8 +1413,8 @@ public function should_correctly_activate_child_theme_in_single_installation(): $installationOutput = $this->assertInIsolation(static function () use ($wpLoader, $wpRootDir) { $wpLoader->_initialize(); - assertEquals('twentytwenty', get_option('template')); - assertEquals('some-child-theme', get_option('stylesheet')); + Assert::assertEquals('twentytwenty', get_option('template')); + Assert::assertEquals('some-child-theme', get_option('stylesheet')); return [ 'bootstrapOutput' => $wpLoader->_getBootstrapOutput(), @@ -1488,8 +1481,8 @@ public function should_correctly_activate_child_theme_in_multisite_installation( $installationOutput = $this->assertInIsolation(static function () use ($wpLoader, $wpRootDir) { $wpLoader->_initialize(); - assertEquals('twentytwenty', get_option('template')); - assertEquals('twentytwenty-child', get_option('stylesheet')); + Assert::assertEquals('twentytwenty', get_option('template')); + Assert::assertEquals('twentytwenty-child', get_option('stylesheet')); return [ 'bootstrapOutput' => $wpLoader->_getBootstrapOutput(), @@ -1620,7 +1613,7 @@ public function should_allow_loading_a_database_dump_before_tests(): void $this->assertInIsolation(static function () use ($wpLoader) { $wpLoader->_initialize(); - assertEquals('value_1', get_option('option_1')); + Assert::assertEquals('value_1', get_option('option_1')); }); } @@ -1655,9 +1648,9 @@ public function should_allow_loading_multiple_database_dumps_before_the_tests(): $this->assertInIsolation(static function () use ($wpLoader) { $wpLoader->_initialize(); - assertEquals('value_1', get_option('option_1')); - assertEquals('value_2', get_option('option_2')); - assertEquals('value_3', get_option('option_3')); + Assert::assertEquals('value_1', get_option('option_1')); + Assert::assertEquals('value_2', get_option('option_2')); + Assert::assertEquals('value_3', get_option('option_3')); }); } @@ -1723,7 +1716,7 @@ public function should_place_sq_lite_dropin_if_using_sq_lite_database_for_tests( $this->assertInIsolation(static function () use ($wpRootDir, $wpLoader) { $wpLoader->_initialize(); - assertFileExists($wpRootDir . '/wp-content/db.php'); + Assert::assertFileExists($wpRootDir . '/wp-content/db.php'); }); } @@ -1750,8 +1743,8 @@ public function should_initialize_correctly_with_sqlite_database(): void $this->assertInIsolation(static function () use ($wpLoader) { $wpLoader->_initialize(); - assertTrue(function_exists('do_action')); - assertInstanceOf(\WP_User::class, wp_get_current_user()); + Assert::assertTrue(function_exists('do_action')); + Assert::assertInstanceOf(\WP_User::class, wp_get_current_user()); }); } @@ -1788,8 +1781,8 @@ public function should_initialize_correctly_with_sqlite_database_in_load_only_mo $wpLoader->_initialize(); Dispatcher::dispatch(Events::SUITE_BEFORE); - assertTrue(function_exists('do_action')); - assertInstanceOf(\WP_User::class, wp_get_current_user()); + Assert::assertTrue(function_exists('do_action')); + Assert::assertInstanceOf(\WP_User::class, wp_get_current_user()); }); } @@ -1861,12 +1854,12 @@ function plugin_2_canary() {} $this->assertInIsolation(static function () use ($wpLoader) { $wpLoader->_initialize(); - assertTrue(function_exists('do_action')); - assertTrue(function_exists('plugin_1_canary')); - assertTrue(is_plugin_active('plugin-1/plugin.php')); - assertTrue(function_exists('plugin_2_canary')); - assertTrue(is_plugin_active('plugin-2/plugin.php')); - assertEquals('theme-1', wp_get_theme()->get_stylesheet()); + Assert::assertTrue(function_exists('do_action')); + Assert::assertTrue(function_exists('plugin_1_canary')); + Assert::assertTrue(is_plugin_active('plugin-1/plugin.php')); + Assert::assertTrue(function_exists('plugin_2_canary')); + Assert::assertTrue(is_plugin_active('plugin-2/plugin.php')); + Assert::assertEquals('theme-1', wp_get_theme()->get_stylesheet()); }); } @@ -1917,8 +1910,8 @@ public function should_correctly_load_with_different_database_names(string $dbNa $this->assertInIsolation(static function () use ($wpLoader) { $wpLoader->_initialize(); - assertTrue(function_exists('do_action')); - assertInstanceOf(\WP_User::class, wp_get_current_user()); + Assert::assertTrue(function_exists('do_action')); + Assert::assertInstanceOf(\WP_User::class, wp_get_current_user()); return $wpLoader->getInstallation()->getDb()->getDbName(); }) @@ -1962,7 +1955,7 @@ public function should_allow_controlling_the_backup_of_global_variables_in_the_w $this->assertInIsolation(static function () use ($wpLoader, $testcaseFile) { $wpLoader->_initialize(); - assertTrue(function_exists('do_action')); + Assert::assertTrue(function_exists('do_action')); require_once $testcaseFile; @@ -1970,7 +1963,7 @@ public function should_allow_controlling_the_backup_of_global_variables_in_the_w /** @var TestResult $result */ $result = $testCase->run(); - assertTrue($result->wasSuccessful()); + Assert::assertTrue($result->wasSuccessful()); }); // Set `WPLoader.backupGlobals` to `true`. @@ -1984,7 +1977,7 @@ public function should_allow_controlling_the_backup_of_global_variables_in_the_w $this->assertInIsolation(static function () use ($wpLoader, $testcaseFile) { $wpLoader->_initialize(); - assertTrue(function_exists('do_action')); + Assert::assertTrue(function_exists('do_action')); require_once $testcaseFile; @@ -1992,7 +1985,7 @@ public function should_allow_controlling_the_backup_of_global_variables_in_the_w /** @var TestResult $result */ $result = $testCase->run(); - assertTrue($result->wasSuccessful()); + Assert::assertTrue($result->wasSuccessful()); }); // Do not set `WPLoader.backupGlobals`, but use the default value. @@ -2006,7 +1999,7 @@ public function should_allow_controlling_the_backup_of_global_variables_in_the_w $this->assertInIsolation(static function () use ($wpLoader, $testcaseFile) { $wpLoader->_initialize(); - assertTrue(function_exists('do_action')); + Assert::assertTrue(function_exists('do_action')); require_once $testcaseFile; @@ -2014,7 +2007,7 @@ public function should_allow_controlling_the_backup_of_global_variables_in_the_w /** @var TestResult $result */ $result = $testCase->run(); - assertTrue($result->wasSuccessful()); + Assert::assertTrue($result->wasSuccessful()); }); // Set `WPLoader.backupGlobals` to `true`, but use a use-case that sets it explicitly to `false`. @@ -2028,7 +2021,7 @@ public function should_allow_controlling_the_backup_of_global_variables_in_the_w $this->assertInIsolation(static function () use ($wpLoader, $overridingTestCaseFile) { $wpLoader->_initialize(); - assertTrue(function_exists('do_action')); + Assert::assertTrue(function_exists('do_action')); require_once $overridingTestCaseFile; @@ -2036,7 +2029,7 @@ public function should_allow_controlling_the_backup_of_global_variables_in_the_w /** @var TestResult $result */ $result = $testCase->run(); - assertTrue($result->wasSuccessful()); + Assert::assertTrue($result->wasSuccessful()); }); $this->config = [ @@ -2049,7 +2042,7 @@ public function should_allow_controlling_the_backup_of_global_variables_in_the_w $this->assertInIsolation(static function () use ($wpLoader, $testcaseFile) { $wpLoader->_initialize(); - assertTrue(function_exists('do_action')); + Assert::assertTrue(function_exists('do_action')); // Set the initial value of the global variable. global $_wpbrowser_test_global_var; @@ -2061,10 +2054,10 @@ public function should_allow_controlling_the_backup_of_global_variables_in_the_w /** @var TestResult $result */ $result = $testCase->run(); - assertTrue($result->wasSuccessful()); + Assert::assertTrue($result->wasSuccessful()); // Check that the value of the global variable has been updated. - assertEquals('initial_value', $_wpbrowser_test_global_var); + Assert::assertEquals('initial_value', $_wpbrowser_test_global_var); }); $this->config = [ @@ -2078,7 +2071,7 @@ public function should_allow_controlling_the_backup_of_global_variables_in_the_w $this->assertInIsolation(static function () use ($wpLoader, $testcaseFile) { $wpLoader->_initialize(); - assertTrue(function_exists('do_action')); + Assert::assertTrue(function_exists('do_action')); // Set the initial value of the global variable. global $_wpbrowser_test_global_var; @@ -2090,10 +2083,10 @@ public function should_allow_controlling_the_backup_of_global_variables_in_the_w /** @var TestResult $result */ $result = $testCase->run(); - assertTrue($result->wasSuccessful()); + Assert::assertTrue($result->wasSuccessful()); // Check that the value of the global variable has been updated. - assertEquals('updated_value', $_wpbrowser_test_global_var); + Assert::assertEquals('updated_value', $_wpbrowser_test_global_var); }); } @@ -2134,7 +2127,7 @@ public function should_allow_controlling_the_backup_of_static_attributes_in_the_ $this->assertInIsolation(static function () use ($wpLoader, $testcaseFile) { $wpLoader->_initialize(); - assertTrue(function_exists('do_action')); + Assert::assertTrue(function_exists('do_action')); require_once $testcaseFile; @@ -2142,9 +2135,9 @@ public function should_allow_controlling_the_backup_of_static_attributes_in_the_ /** @var TestResult $result */ $result = $testCase->run(); - assertTrue($result->wasSuccessful()); + Assert::assertTrue($result->wasSuccessful()); - assertEquals('updated_value', \BackupControlTestCaseStore::$staticAttribute); + Assert::assertEquals('updated_value', \BackupControlTestCaseStore::$staticAttribute); }); // Don't set`WPLoader.backupStaticAttributes`, it should be `true` by default. @@ -2157,7 +2150,7 @@ public function should_allow_controlling_the_backup_of_static_attributes_in_the_ $this->assertInIsolation(static function () use ($wpLoader, $testcaseFile) { $wpLoader->_initialize(); - assertTrue(function_exists('do_action')); + Assert::assertTrue(function_exists('do_action')); require_once $testcaseFile; @@ -2165,9 +2158,9 @@ public function should_allow_controlling_the_backup_of_static_attributes_in_the_ /** @var TestResult $result */ $result = $testCase->run(); - assertTrue($result->wasSuccessful()); + Assert::assertTrue($result->wasSuccessful()); - assertEquals('initial_value', \BackupControlTestCaseStore::$staticAttribute); + Assert::assertEquals('initial_value', \BackupControlTestCaseStore::$staticAttribute); }); // Set the value of `WPLoader.backupStaticAttributes` to `true`, but use a use-case that sets it explicitly to `false`. @@ -2181,7 +2174,7 @@ public function should_allow_controlling_the_backup_of_static_attributes_in_the_ $this->assertInIsolation(static function () use ($wpLoader, $overridingTestCaseFile) { $wpLoader->_initialize(); - assertTrue(function_exists('do_action')); + Assert::assertTrue(function_exists('do_action')); require_once $overridingTestCaseFile; @@ -2189,9 +2182,9 @@ public function should_allow_controlling_the_backup_of_static_attributes_in_the_ /** @var TestResult $result */ $result = $testCase->run(); - assertTrue($result->wasSuccessful()); + Assert::assertTrue($result->wasSuccessful()); - assertEquals('updated_value', \BackupControlTestCaseOverridingStore::$staticAttribute); + Assert::assertEquals('updated_value', \BackupControlTestCaseOverridingStore::$staticAttribute); }); // Set the value of the `WPLoader.backupStaticAttributesExcludeList` to not back up the static attribute. @@ -2209,7 +2202,7 @@ public function should_allow_controlling_the_backup_of_static_attributes_in_the_ static function () use ($wpLoader, $testcaseFile) { $wpLoader->_initialize(); - assertTrue(function_exists('do_action')); + Assert::assertTrue(function_exists('do_action')); require_once $testcaseFile; @@ -2217,16 +2210,16 @@ static function () use ($wpLoader, $testcaseFile) { /** @var TestResult $result */ $result = $testCase->run(); - assertTrue($result->wasSuccessful()); + Assert::assertTrue($result->wasSuccessful()); - assertEquals('updated_value', \BackupControlTestCaseStore::$staticAttribute); - assertEquals('initial_value', \BackupControlTestCaseStore::$staticAttributeTwo); - assertEquals('updated_value', \BackupControlTestCaseStore::$staticAttributeThree); - assertEquals('initial_value', \BackupControlTestCaseStore::$staticAttributeFour); - assertEquals('initial_value', \BackupControlTestCaseStoreTwo::$staticAttribute); - assertEquals('initial_value', \BackupControlTestCaseStoreTwo::$staticAttributeTwo); - assertEquals('initial_value', \BackupControlTestCaseStoreTwo::$staticAttributeThree); - assertEquals('updated_value', \BackupControlTestCaseStoreTwo::$staticAttributeFour); + Assert::assertEquals('updated_value', \BackupControlTestCaseStore::$staticAttribute); + Assert::assertEquals('initial_value', \BackupControlTestCaseStore::$staticAttributeTwo); + Assert::assertEquals('updated_value', \BackupControlTestCaseStore::$staticAttributeThree); + Assert::assertEquals('initial_value', \BackupControlTestCaseStore::$staticAttributeFour); + Assert::assertEquals('initial_value', \BackupControlTestCaseStoreTwo::$staticAttribute); + Assert::assertEquals('initial_value', \BackupControlTestCaseStoreTwo::$staticAttributeTwo); + Assert::assertEquals('initial_value', \BackupControlTestCaseStoreTwo::$staticAttributeThree); + Assert::assertEquals('updated_value', \BackupControlTestCaseStoreTwo::$staticAttributeFour); } ); } @@ -2431,14 +2424,14 @@ static function () use ($wpLoader, $moduleSplObjectHash) { $activePlugins = $wpdb->get_var( "SELECT option_value FROM {$wpdb->options} WHERE option_name = 'active_plugins'" ); - assertEquals(['woocommerce/woocommerce.php'], unserialize($activePlugins)); - assertNotEquals('1', getenv('WP_TESTS_SKIP_INSTALL')); - assertTrue(function_exists('do_action')); - assertTrue($beforeInstallCalled); - assertTrue($afterInstallCalled); - assertTrue($afterBootstrapCalled); - assertTrue(function_exists('wc_get_product')); - assertEquals('twentytwenty', wp_get_theme()->get_stylesheet()); + Assert::assertEquals(['woocommerce/woocommerce.php'], unserialize($activePlugins)); + Assert::assertNotEquals('1', getenv('WP_TESTS_SKIP_INSTALL')); + Assert::assertTrue(function_exists('do_action')); + Assert::assertTrue($beforeInstallCalled); + Assert::assertTrue($afterInstallCalled); + Assert::assertTrue($afterBootstrapCalled); + Assert::assertTrue(function_exists('wc_get_product')); + Assert::assertEquals('twentytwenty', wp_get_theme()->get_stylesheet()); // Set a canary value. update_option('canary', $moduleSplObjectHash); @@ -2478,15 +2471,15 @@ static function () use ($moduleSplObjectHash, $wpLoader) { $activePlugins = $wpdb->get_var( "SELECT option_value FROM {$wpdb->options} WHERE option_name = 'active_plugins'" ); - assertEquals(['woocommerce/woocommerce.php'], unserialize($activePlugins)); - assertEquals('1', getenv('WP_TESTS_SKIP_INSTALL')); - assertTrue(function_exists('do_action')); - assertTrue($beforeInstallCalled); - assertTrue($afterInstallCalled); - assertTrue($afterBootstrapCalled); - assertTrue(function_exists('wc_get_product')); - assertEquals('twentytwenty', wp_get_theme()->get_stylesheet()); - assertEquals($moduleSplObjectHash, get_option('canary')); + Assert::assertEquals(['woocommerce/woocommerce.php'], unserialize($activePlugins)); + Assert::assertEquals('1', getenv('WP_TESTS_SKIP_INSTALL')); + Assert::assertTrue(function_exists('do_action')); + Assert::assertTrue($beforeInstallCalled); + Assert::assertTrue($afterInstallCalled); + Assert::assertTrue($afterBootstrapCalled); + Assert::assertTrue(function_exists('wc_get_product')); + Assert::assertEquals('twentytwenty', wp_get_theme()->get_stylesheet()); + Assert::assertEquals($moduleSplObjectHash, get_option('canary')); } ); @@ -2515,15 +2508,15 @@ static function () use ($wpLoader) { $activePlugins = $wpdb->get_var( "SELECT option_value FROM {$wpdb->options} WHERE option_name = 'active_plugins'" ); - assertEquals(['woocommerce/woocommerce.php'], unserialize($activePlugins)); - assertNotEquals('1', getenv('WP_TESTS_SKIP_INSTALL')); - assertTrue(function_exists('do_action')); - assertTrue($beforeInstallCalled); - assertTrue($afterInstallCalled); - assertTrue($afterBootstrapCalled); - assertTrue(function_exists('wc_get_product')); - assertEquals('twentytwenty', wp_get_theme()->get_stylesheet()); - assertEquals( + Assert::assertEquals(['woocommerce/woocommerce.php'], unserialize($activePlugins)); + Assert::assertNotEquals('1', getenv('WP_TESTS_SKIP_INSTALL')); + Assert::assertTrue(function_exists('do_action')); + Assert::assertTrue($beforeInstallCalled); + Assert::assertTrue($afterInstallCalled); + Assert::assertTrue($afterBootstrapCalled); + Assert::assertTrue(function_exists('wc_get_product')); + Assert::assertEquals('twentytwenty', wp_get_theme()->get_stylesheet()); + Assert::assertEquals( '', get_option('canary'), 'The value set in the previous installation should be gone.' @@ -2683,8 +2676,8 @@ function activate_my_plugin(){ static function () use ($wpLoader) { $wpLoader->_initialize(); - assertEquals('', get_option('my_plugin_activated')); - assertEquals('__loaded__', get_option('my_plugin_loaded')); + Assert::assertEquals('', get_option('my_plugin_activated')); + Assert::assertEquals('__loaded__', get_option('my_plugin_loaded')); } ); } From 1445935e6beee1b0552d0d0c463081254a193ac7 Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Fri, 15 Dec 2023 11:28:04 +0100 Subject: [PATCH 08/11] build(.github) iterate on v3.5 automated build workflow --- .github/workflows/build-35.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-35.yml b/.github/workflows/build-35.yml index 56ce6c633..0f14d25ff 100644 --- a/.github/workflows/build-35.yml +++ b/.github/workflows/build-35.yml @@ -19,13 +19,22 @@ jobs: run: composer validate --no-interaction --strict - name: Install dependencies uses: ramsey/composer-install@v2 - - name: "Check PSR-4 mapping" - run: "composer dump-autoload --no-interaction --optimize --strict-psr" - - name: "Require rector" - run: "composer require --dev rector/rector" + - name: Check PSR-4 mapping" + run: composer dump-autoload --no-interaction --optimize --strict-psr + - name: Require rector + run: composer require --dev rector/rector + - name: Get changed files + id: changed-files + uses: yumemi-inc/changed-files@v3 + with: + separator: " " + patterns: | + src/**/*.php + includes/**/*.php + tests/**/*.php - name: Build v3.5 run: | - vendor/bin/rector --config=config/rector-35.php + vendor/bin/rector process --config=config/rector-35.php -- ${{ steps.changed-files.outputs.files }} - name: Create Pull Request uses: peter-evans/create-pull-request@v5 with: From e6e19ea8d2dda45b51a11b4076f4b96f4d7281ec Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Fri, 15 Dec 2023 17:09:37 +0100 Subject: [PATCH 09/11] build(composer.json) remove rector/rector from dev dependencies --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 9aaf3c445..a206a7fb3 100644 --- a/composer.json +++ b/composer.json @@ -46,8 +46,7 @@ "phpstan/phpstan": "*", "phpstan/extension-installer": "^1.3", "phpstan/phpstan-symfony": "^1.3", - "squizlabs/php_codesniffer": "^3.7", - "rector/rector": "^0.18.5" + "squizlabs/php_codesniffer": "^3.7" }, "autoload": { "psr-4": { From f1e27984ea01401303023811b99f8024db21d8e0 Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Fri, 15 Dec 2023 17:10:16 +0100 Subject: [PATCH 10/11] doc(Adapters/Process) suppress __destruct method notice --- src/Adapters/Symfony/Component/Process/Process.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Adapters/Symfony/Component/Process/Process.php b/src/Adapters/Symfony/Component/Process/Process.php index 05bdcb45e..06d2cc26f 100644 --- a/src/Adapters/Symfony/Component/Process/Process.php +++ b/src/Adapters/Symfony/Component/Process/Process.php @@ -52,6 +52,7 @@ public function getStartTime(): float return $startTime; } + /** @noinspection MagicMethodsValidityInspection */ public function __destruct() { if ($this->createNewConsole) { From 05c98b40960cdeb391d4735eaecfe4a73f2306e4 Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Fri, 15 Dec 2023 17:30:12 +0100 Subject: [PATCH 11/11] build(.github) use GitHub CLI in PR flow --- .github/workflows/build-35.yml | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build-35.yml b/.github/workflows/build-35.yml index 0f14d25ff..15fa9c1f7 100644 --- a/.github/workflows/build-35.yml +++ b/.github/workflows/build-35.yml @@ -35,19 +35,20 @@ jobs: - name: Build v3.5 run: | vendor/bin/rector process --config=config/rector-35.php -- ${{ steps.changed-files.outputs.files }} - - name: Create Pull Request - uses: peter-evans/create-pull-request@v5 - with: - base: "v3.5" - token: ${{ secrets.V35_BUILD_TOKEN }} - commit-message: "v3.5 automated build change" - committer: "lucatume " - branch: "v3.5-automated-build" - delete-branch: true - title: "v3.5 automated build" - body: "v3.5 automated build changes created by the v3.5 automated build workflow" - assignees: "lucatume" - add-paths: | - includes/*.php - src/*.php - tests/*.php + - name: Create Pull Request on v3.5 + run: | + git reset HEAD + git status + git add 'src/*.php' + git add 'includes/*.php' + git add 'tests/*.php' + gh pr create \ + --assignee lucatume \ + --base v3.5 \ + --draft \ + --title "v3.5 automated build" \ + --body "v3.5 automated build changes" \ + --label "auto-build" \ + --label "v3.5" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}