From 5e473379138e06c4c45a5e6616f2d77e9d0723a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lys=C3=BD?= Date: Tue, 4 Mar 2025 20:26:29 +0100 Subject: [PATCH] Add PHP 8.3 fixes for Codeception in tests env [MAILPOET-6297] --- tests_env/composer.json | 6 +- tests_env/tasks/fix-php83-codeception.php | 68 +++++++++++++++++++++++ 2 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 tests_env/tasks/fix-php83-codeception.php diff --git a/tests_env/composer.json b/tests_env/composer.json index 7e0ed8960c..62ee29e4e2 100644 --- a/tests_env/composer.json +++ b/tests_env/composer.json @@ -20,10 +20,12 @@ }, "scripts": { "post-install-cmd": [ - "php ./tasks/fix-php82-codeception.php" + "php ./tasks/fix-php82-codeception.php", + "php ./tasks/fix-php83-codeception.php" ], "post-update-cmd": [ - "php ./tasks/fix-php82-codeception.php" + "php ./tasks/fix-php82-codeception.php", + "php ./tasks/fix-php83-codeception.php" ] } } diff --git a/tests_env/tasks/fix-php83-codeception.php b/tests_env/tasks/fix-php83-codeception.php new file mode 100644 index 0000000000..3477a8c14c --- /dev/null +++ b/tests_env/tasks/fix-php83-codeception.php @@ -0,0 +1,68 @@ + __DIR__ . '/../vendor/codeception/codeception/src/Codeception/Lib/Generator/Actions.php', + 'find' => [ + $codeceptionActionsFind + ], + 'replace' => [ + $codeceptionActionsReplacement, + ], + ], + [ + 'file' => __DIR__ . '/../vendor/codeception/codeception/src/Codeception/Lib/Generator/Actor.php', + 'find' => [ + $codeceptionActorFind + ], + 'replace' => [ + $codeceptionActorReplacement, + ], + ], +]; + +// Apply replacements +foreach ($replacements as $singleFile) { + $data = file_get_contents($singleFile['file']); + $data = str_replace($singleFile['find'], $singleFile['replace'], $data); + file_put_contents($singleFile['file'], $data); +}