-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
LegacyDBTest testDecimal is actually failing on sqlite database #34880
Comments
In PHPUnit v5 and v6 Since https://github.com/sebastianbergmann/comparator/pull/58/files , if both things to be compared are strings, a strict string comparison is done. Strings that are different but "look like the same number" are now actually seen as different and will fail Other related discussion of this PHPUnit7 behavior change (improvement IMHO) sebastianbergmann/phpunit#3185 This has revealed this difference in database behavior, which the unit test did not previously "notice". In mySQL you put "1234567890" into a field of decimal(12,2) and when you query the database you get back "1234567890.00" - which is the test expectation. In sqlite you put "1234567890" into a field of decimal(12,2) and when you query the database you get back "1234567890" - it does not put the 2 fractional digits or decimal point when the number is an exact integer. Similar happens in sqlite if you put "1234567890.00" into a field of decimal(12,2) - when you query the database you get back "1234567890" |
Do we care about this difference? If yes, then it needs to be "fixed" in some database abstraction layer to "hide" the underlying database difference. If no, then we can adjust the unit test to not be so strict about the exact output that it expects. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions. |
Steps to reproduce
make test-php-unit TEST_DATABASE=sqlite TEST_PHP_SUITE=tests/lib/DB/LegacyDBTest.php
Expected behaviour
Test passes
Actual behaviour
Server configuration
git core master clone and run unit tests
The text was updated successfully, but these errors were encountered: