Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[FrameworkBundle] KernelTestCase: deprecate not using KERNEL_CLASS#22675
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[FrameworkBundle] KernelTestCase: deprecate not using KERNEL_CLASS#22675
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| // Can't continue | ||
| if (null ===$dir) { | ||
| thrownew \RuntimeException('Unable to guess theKernel directory.'); | ||
| thrownew \RuntimeException('Unable to guess thePHPUnit xml directory.'); |
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.
I guess this method could be kept for BC and might somehow be useful. So I just update the exceptions messages rather than deprecating it too (same forgetPhpUnitCliConfigArgument).
But what would be a proper exception message for:
if (!isset($_SERVER['argv']) ||false ===strpos($_SERVER['argv'][0],'phpunit')) {thrownew \RuntimeException('You must override the KernelTestCase::createKernel() method.');}
some lines above (L.45) ?
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.
XML instead of xml
UPGRADE-3.4.md Outdated
| * Using`KERNEL_DIR` or the automatic guessing based on the`phpunit.xml` file | ||
| location is deprecated since 3.4. Either set`KERNEL_CLASS` in your`phpunit.xml` | ||
| to he fully-qualified class name of your Kernel or override the`KernelTestCase::createKernel()` |
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.
Typo:he =>the.
| 3.4.0 | ||
| ----- | ||
| * Deprecated not using the new`KERNEL_CLASS` server var with`KernelTestCase`. |
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.
Deprecated ``KERNEL_DIR`` ... ?
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.
Not only. What is deprecated is the whole current method implementation, i.eKERNEL_DIR and the auto-detection based onphpunit.xml dir location. <=> Not usingKERNEL_CLASS (it's better explained in theUPGRADE-3.4.md file. I believe it should stay short here)
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.
If you overrideKernelTestCase::createKernel(), you (probably) don't useKERNEL_CLASS but you don't get a deprecation notice, this should be mentioned here as well. As this would make the sentence longer, I think@ro0NL's suggestions makes even more sense.
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.
Fair enough. 😃
UPGRADE-3.4.md Outdated
| * Using`KERNEL_DIR` or the automatic guessing based on the`phpunit.xml` file | ||
| location is deprecated since 3.4. Either set`KERNEL_CLASS` in your`phpunit.xml` | ||
| to the fully-qualified class name of your Kernel or override the`KernelTestCase::createKernel()` | ||
| method. Not setting`KERNEL_CLASS` will throw an exception on 4.0. |
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.
can't we also overwritegetKernelClass() only ?
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.
Yes indeed. I mean not settingKERNEL_CLASS when using theKernelTestCase::createKernel() base implementation. Of course if you overwrite it your on your own (and it's already suggested).
I don't know how to rephrase it better if the current version is not enough. I'll take any other suggestion.
EDIT: Sorry I misred your comment.
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.
What about:
Using`KERNEL_DIR` or the automatic guessing based on the`phpunit.xml` filelocation is deprecated since 3.4. Set`KERNEL_CLASS` to the fully-qualifiedclass name of your Kernel instead. Not setting`KERNEL_CLASS` will throw anexception on 4.0 unless you override`KernelTestCase::createKernel()` or`KernelTestCase::getKernelClass()` method.
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.
I'll take this. Thank you@julienfalque
ogizanagi commentedMay 10, 2017
I changed my mind about |
UPGRADE-4.0.md Outdated
| class instead. | ||
| * The usage of`KERNEL_DIR` and the automatic guessing based on the`phpunit.xml` | ||
| file location has been removed from`KernelTestCase::getKernelClass()` implementation. |
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.
have been?
UPGRADE-3.4.md Outdated
| FrameworkBundle | ||
| --------------- | ||
| * Using`KERNEL_DIR` or the automatic guessing based on the`phpunit.xml` file |
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.
phpunit.xml/phpunit.xml.dist?
UPGRADE-3.4.md Outdated
| exception on 4.0 unless you override`KernelTestCase::createKernel()` or | ||
| `KernelTestCase::getKernelClass()` method. | ||
| * Methods`KernelTestCase::getPhpUnitXmlDir()` and`KernelTestCase::getPhpUnitCliConfigArgument()` |
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.
The methods [...]
| */ | ||
| privatestaticfunctiongetPhpUnitCliConfigArgument() | ||
| { | ||
| @trigger_error(sprintf('Method %s() is deprecated since 3.4 and will be removed in 4.0.',__METHOD__),E_USER_DEPRECATED); |
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.
The %s() method [...]
| return$class; | ||
| }else { | ||
| @trigger_error(sprintf('Using KERNEL_DIR or the automatic guessing based on the phpunit.xml file location is deprecated since 3.4. Set KERNEL_CLASS to the fully-qualified class name of your Kernel instead. Not setting KERNEL_CLASS will throw an exception on 4.0 unless you override %1$::createKernel() or %1$::getKernelClass() method.',static::class),E_USER_DEPRECATED); |
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.
Using the KERNEL_DIR environment variable [...]
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.
Set the KERNEL_CLASS environment variable [...]
| */ | ||
| protectedstaticfunctiongetPhpUnitXmlDir() | ||
| { | ||
| @trigger_error(sprintf('Method %s() is deprecated since 3.4 and will be removed in 4.0.',__METHOD__),E_USER_DEPRECATED); |
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.
The %s() method [...]
| 3.4.0 | ||
| ----- | ||
| * Deprecated using`KERNEL_DIR` server var with`KernelTestCase::getKernelClass()`. |
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.
Deprecated using theKERNEL_DIR environment variable [...]
| ----- | ||
| * Deprecated using`KERNEL_DIR` server var with`KernelTestCase::getKernelClass()`. | ||
| * Deprecated`KernelTestCase::getPhpUnitXmlDir()` and`KernelTestCase::getPhpUnitCliConfigArgument()` methods. |
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.
Deprecated the [...]
UPGRADE-4.0.md Outdated
| override`KernelTestCase::createKernel()` or`KernelTestCase::getKernelClass()` | ||
| method instead. | ||
| * Methods`KernelTestCase::getPhpUnitXmlDir()` and`KernelTestCase::getPhpUnitCliConfigArgument()` |
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.
The methods [...]
ogizanagi commentedMay 12, 2017
Thanks for all the suggested improvements@xabbuh! |
fabpot commentedJun 9, 2017
Thank you@ogizanagi. |
…KERNEL_CLASS (ogizanagi)This PR was merged into the 3.4 branch.Discussion----------[FrameworkBundle] KernelTestCase: deprecate not using KERNEL_CLASS| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | yes| Tests pass? | yes| Fixed tickets |#22668 (comment)| License | MIT| Doc PR | N/ACommits-------d102fc0 [FrameworkBundle] KernelTestCase: deprecate not using KERNEL_CLASS
…e (ogizanagi)This PR was merged into the 4.0-dev branch.Discussion----------[FrameworkBundle] Remove KernelTestCase deprecated code| Q | A| ------------- | ---| Branch? | master <!-- see comment below -->| Bug fix? | no| New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files -->| BC breaks? | yes| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->| Tests pass? | yes| Fixed tickets |#22675| License | MIT| Doc PR | N/A(failures unrelated)Commits-------6d28c43 [FrameworkBundle] Remove KernelTestCase deprecated code
Uh oh!
There was an error while loading.Please reload this page.