Uh oh!
There was an error while loading. Please reload this page.
refactor: update PHPUnit to 10 - #8069
Conversation
kenjis
commented
Oct 20, 2023
@paulbalandan Any plan to release |
paulbalandan
commented
Oct 21, 2023
Is it ready but lacking integration tests. I'll try to finish this weekend. Thanks for reminding me. |
kenjis
commented
Oct 21, 2023
https://github.com/codeigniter4/CodeIgniter4/actions/runs/6593809502/job/17916840733?pr=8069 |
kenjis
commented
Oct 21, 2023
https://github.com/codeigniter4/CodeIgniter4/actions/runs/6593809497/job/17916881103?pr=8069 |
paulbalandan
commented
Oct 21, 2023
The first warning is easy. Just change the name to AbstractHandlerTestCase. Abstract tests need to be suffixed with TestCase. For the static issues, just run the rule |
kenjis
commented
Oct 21, 2023
Unfortunately php-cs-fixer was not able to refactor the dataProviders because of |
paulbalandan
commented
Oct 21, 2023
Ah yes. The rule is risky because of uses of |
9a41574 to
54e6c4dComparekenjis
commented
Oct 21, 2023
Why does this test fail? $ vendor/bin/phpunit tests/system/Validation/StrictRules/ValidationTest.php PHPUnit 10.4.1 by Sebastian Bergmann and contributors.Runtime: PHP 8.1.24Configuration: /Users/kenji/work/codeigniter/official/CodeIgniter4/phpunit.xml.................................................................................................... 100 / 121 ( 82%)...........F......... 121 / 121 (100%)Time: 00:00.930, Memory: 16.00 MB...--There was 1 failure:1) CodeIgniter\Validation\StrictRules\ValidationTest::testPlaceholderReplacementTestFailsFailed asserting that exception message 'Failed asserting that 'filter[{id}]' [ASCII](length: 12) does not contain "{id}" [ASCII](length: 4).' contains 'Failed asserting that 'filter[{id}]' does not contain "{id}".'.FAILURES!Tests: 121, Assertions: 173, Failures: 1, Warnings: 1. |
kenjis
commented
Oct 21, 2023
I got the reason. The error message of PHPUnit has been changed. |
9a6d208 to
7b1d446CompareThere was a problem hiding this comment.
We will want to update DevKit as well - not sure when the appropriate time to do that is though, maybe when we actually drop 8.0? I know @paulbalandan is working on Tachycardia comparability - that would be great to include.
Edit: oops! I missed the existing conversation. All good.
paulbalandan
commented
Oct 26, 2023
|
2052f1a to
a524abcComparekenjis
commented
Oct 27, 2023
I don't know why, but only in PHP 8.3, the $ vendor/bin/phpunit tests/system/Autoloader/AutoloaderTest.php PHPUnit 10.4.2 by Sebastian Bergmann and contributors.Runtime: PHP 8.3.0-devConfiguration: /Users/kenji/work/codeigniter/official/CodeIgniter4/phpunit.xml..........................E 27 / 27 (100%)Time: 00:00.486, Memory: 16.00 MBThere was 1 error:1) CodeIgniter\Autoloader\AutoloaderTest::testLoadHelpersPHPUnit\Framework\Exception: PHP Fatal error: Uncaught CodeIgniter\Format\Exceptions\FormatException: Failed to parse JSON string. Error: Type is not supported in /Users/kenji/work/codeigniter/official/CodeIgniter4/system/Format/JSONFormatter.php:44Stack trace:#0 /Users/kenji/work/codeigniter/official/CodeIgniter4/system/Format/JSONFormatter.php(44): CodeIgniter\Format\Exceptions\FormatException::forInvalidJSON('Type is not sup...')#1 /Users/kenji/work/codeigniter/official/CodeIgniter4/system/API/ResponseTrait.php(345): CodeIgniter\Format\JSONFormatter->format(Array)#2 /Users/kenji/work/codeigniter/official/CodeIgniter4/system/API/ResponseTrait.php(98): CodeIgniter\Debug\ExceptionHandler->format(Array)#3 /Users/kenji/work/codeigniter/official/CodeIgniter4/system/Debug/ExceptionHandler.php(81): CodeIgniter\Debug\ExceptionHandler->respond(Array, 500)#4 /Users/kenji/work/codeigniter/official/CodeIgniter4/system/Debug/Exceptions.php(148): CodeIgniter\Debug\ExceptionHandler->handle(Object(PHPUnit\Event\Code\NoTestCaseObjectOnCallStackException), Object(CodeIgniter\HTTP\IncomingRequest), Object(CodeIgniter\HTTP\Response), 500, 1)#5 [internal function]: CodeIgniter\Debug\Exceptions->exceptionHandler(Object(PHPUnit\Event\Code\NoTestCaseObjectOnCallStackException))#6 {main} thrown in /Users/kenji/work/codeigniter/official/CodeIgniter4/system/Format/JSONFormatter.php on line 44ERRORS!Tests: 27, Assertions: 45, Errors: 1. |
kenjis
commented
Oct 27, 2023
--- a/system/Format/JSONFormatter.php+++ b/system/Format/JSONFormatter.php@@ -37,6 +37,7 @@ class JSONFormatter implements FormatterInterface
$options = ENVIRONMENT === 'production' ? $options : $options | JSON_PRETTY_PRINT;
+ log_message('debug', var_export($data, true));
$result = json_encode($data, $options, 512);
if (! in_array(json_last_error(), [JSON_ERROR_NONE, JSON_ERROR_RECURSION], true)) { |
This comment was marked as outdated.
This comment was marked as outdated.
a524abc to
2f23a6fCompare2f23a6f to
69bcbbbCompare
This comment was marked as outdated.
This comment was marked as outdated.
69bcbbb to
1829df8Comparekenjis
commented
Nov 30, 2023
No good. Tests on PHP 8.3 fails. https://github.com/codeigniter4/CodeIgniter4/actions/runs/7043858533/job/19170759175?pr=8069 |
5b2f18f to
47bf62eComparevendor/bin/phpunit --migrate-configuration -c phpunit.xml.dist
Message: file_put_contents(/home/runner/work/CodeIgniter4/CodeIgniter4/build/coverage/text/coverage.txt): Failed to open stream: No such file or directory Location: /home/runner/work/CodeIgniter4/CodeIgniter4/vendor/phpunit/phpunit/src/Runner/CodeCoverage.php:317 Script done. Error: Process completed with exit code 255.
1) CodeIgniter\Database\DatabaseTestCase\DatabaseTestCaseMigrationOnce1Test::testMigrationDone TypeError: json_encode(): Argument #2 ($flags) must be of type int, bool given /home/runner/work/CodeIgniter4/CodeIgniter4/system/Test/Constraints/SeeInDatabase.php:118 /home/runner/work/CodeIgniter4/CodeIgniter4/system/Test/DatabaseTestTrait.php:282 /home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce1Test.php:86
There was 1 error: 1) CodeIgniter\Security\SecurityCSRFSessionRandomizeTokenTest::testCSRFVerifyPostInvalidToken PHPUnit\Framework\Exception: PHP Warning: hex2bin(): Hexadecimal input string must have an even length in /home/runner/work/CodeIgniter4/CodeIgniter4/system/Security/Security.php on line 378 PHP Warning: hex2bin(): Hexadecimal input string must have an even length in /home/runner/work/CodeIgniter4/CodeIgniter4/system/Security/Security.php on line 378
There was 1 error: 1) CodeIgniter\CommonFunctionsTest::testTraceWithCSP Test was run in child process and ended unexpectedly
kenjis
commented
Apr 7, 2024
Rebased to resolve the conflict. |
MGatner
commented
Apr 10, 2024
Happy to see this one launched! |
kenjis
commented
Apr 10, 2024
But we still need |
Important
This PR will be merged just prior to the release of v4.5.0.
Description
PHPUnit requires PHP 8.1 or later.
https://packagist.org/packages/phpunit/phpunit#10.4.1
https://phpunit.de/announcements/phpunit-10.html
TODO
nexusphp/tachycardiaChecklist: