-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Small fixes for tests in favor of PHP 8.0 compat #77
Conversation
The failing test for php 5.4:
is either flaky or the change to resolve this is in some other PR. |
43625fd
to
adf04ac
Compare
The logFormatter was also discussed here: |
ZF-11344 only affected PHP7.0 and was therefore reenabled for all other versions.
In a lot of cases with PHP8 Type and ValueErrors are thrown instead of warnings emitted. The error handling in tests needed to be modifed accordingly.
Where in PHP <8 we would expect exceptions PHP8 now throws errors. Luckily we can just add extra catch statements without ruining the compatibility to older versions.
Tests for PHP 8.0 are now also run via Github Actions and failure for 8.0 has been disallowed on Travis.
if (PHP_VERSION_ID >= 50400) { | ||
if (PHP_VERSION_ID >= 70000 && PHP_VERSION_ID < 70100) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any chance that changes in this file could affect the failing Logger test on PHP 5.4? 🙈
} catch (Throwable $e) { | ||
$this->assertTrue($e instanceof ValueError, | ||
'Expecting object of type Zend_Db_Statement_Exception, got '.get_class($e)); | ||
$this->assertRegExp('#must be a bitmask#i', $e->getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and other Throwable, ValueError fixes to tests are wrong in this PR. Code must be adjusted to keep previous behavior, even if it's wrong behavior.
For example, outer code expects Zend_Db_Statement_Exception to be thrown, but instead, ValueError is thrown, and the whole application breaks. Even old PHPUnit breaks because \Error is not a subclass of \Exception.
My version of the problem fix:
These adjustments are no longer necessary. (covered by other PRs) Thanks! |
Extracted changes made by @Megatherium from #32