-
Notifications
You must be signed in to change notification settings - Fork 178
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
[tests] port the test system to phpunit #286
Comments
https://github.com/connorhu/symfony1/blob/feature/phpunit/tests/controller/sfWebControllerTest.php#L37-L51
:
If we look at the test writer intent, then all numeric arguments must be converted to real numbers. |
A copy from issue #285 PHPUnit brings up the errors nicely. The first assert fails because of an
Description of I guess the implementation should something like this:
The symfony1/test/unit/command/sfCommandOptionTest.php Lines 89 to 90 in d9a1684
What should we do with bugs like this? Fix it in 1.5.x or we wait for 1.6.x and after I finish the integration of phpunit we fix it and backport to 1.5.x? |
Another "who made a mistake?" memo
Test message says: "->findRoute() returns null on non-matching route" The symfony1/lib/routing/sfPatternRouting.class.php Lines 368 to 411 in 2826410
symfony1/lib/routing/sfPatternRouting.class.php Lines 474 to 487 in 2826410
The IMHO the test is wrong because the return annotation of |
IMHO annotation is just a comment and comments can lie. The only things that do not lie is the code behaviour. The question is what kind of assertion is done with |
During porting, I change the |
IMHO good idea, but it tends to complexity this migration. So in this context, the source of truth is the production code. On this example: Like you said. The test code is good, but the test message is misleading. |
Another "who made a mistake? / where is the bug?" memo
$request->languages = null;
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = '';
$this->is($request->getLanguages(), [], '->getLanguages() returns an empty array if the client send an empty ACCEPT_LANGUAGE header'); Test message says: symfony1/lib/request/sfWebRequest.class.php Lines 433 to 441 in 2826410
Now the |
Another "who made a mistake? / where is the bug?" memo
Test message says: symfony1/lib/i18n/sfI18N.class.php Lines 316 to 322 in 2826410
I guess there is an implementation bug and we should return An extra typo is that the phpdoc return type is not only an array but also null. |
$acceptLanguage = '0';
empty($acceptLanguage) // true Does a string "0" is an empty ACCEPT_LANGUAGE header ? |
sfViewCacheManager::has() method with null return symfony1/lib/view/sfViewCacheManager.class.php Lines 384 to 391 in 2826410
|
An empty array is fine when client send |
Side note: we should deprecate and totally remove pear support (plugin component). PEAR is a deprecation hell and not working with composer. |
This is an issue to track the progression.
Branch: https://github.com/connorhu/symfony1/tree/feature/phpunit
Target php version: php7.4
Components:
The text was updated successfully, but these errors were encountered: