| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| - | ||
| class: PHPStan\Type\PHPUnit\Assert\AssertMethodTypeSpecifyingExtension | ||
| arguments: | ||
| classWithAssertionMethods: PHPUnit\Framework\TestCase |
There was a problem hiding this comment.
I've retained the class used in https://github.com/phpstan/phpstan-phpunit/pull/65/files#diff-afc1ebcbfd95543266d01a244f0e43deL27, but shouldn't this be PHPUnit\Framework\Assert too?
Sorry, something went wrong.
|
Hi, I don't know anything about Codeception. Do you typically use assert* methods from PHPUnit in conjunction with Codeception methods, or do you use either PHPUnit or Codeception? Anyway, we could register everything by default (there's no downside) and just mention in the README that this extension works well with Codeception out of the box. WDYT? |
Sorry, something went wrong.
|
It was my wish from the beginning, but it not feasible. Codeception ships with 2 different types of test, the Unit one which is a subclass of PHPUnit\Framework\TestCase and already works out of the box, and the Functional/Acceptance ones. In a nutshell, Functional/Acceptance tests gather multiple classes and their methods, copy-paste their signatures into a giant class, and proxy all the calls to the original ones. This allows the user to choose which module to use in the tests (i.e. Filesystem, Redis, Symfony, FTP...) and call all the available assertions/helper-methods under the $this hat. The Assertion module is one of them and is a proxy to the PHPUnit one. What's the blocking? The giant class created lies under the project folder tree, and of course to be correctly autoloaded it must have the project's namespace, not a generic one. |
Sorry, something went wrong.
|
I feel like this is related to #103 I don't exactly see the benefit to parametrize the assertion class instead of just fixing the FQCN. But I'm not familiar at all with codeception. Can you provide a link to that Acceptance class (or other relevant code) is it extending Assert? I tried searching https://github.com/Codeception/phpunit-wrapper/tree/9.0/src but I didn't find it. |
Sorry, something went wrong.
I doesn't exist, Codeception doesn't work this way. There is no way phpstan/phpstan-phpunit can fix #34 with an hardcoded code change. |
Sorry, something went wrong.
|
The thing is making the class parametrizable will fix your use case by breaking PHP Unit analysis. I think a better approach would be to create another package dedicated to codeception, dependant on this one. This way you can have two instance of the extension working at the same time. |
Sorry, something went wrong.
May I ask you how this break would happen?
This PR already enable to have both PHPUnit and Codeception working in the same time, where do you see this isn't the case? |
Sorry, something went wrong.
|
🤦 You are right I didn't understand the PR correctly. I somehow thought you were just feeding the existing service with another default value. But you are in fact creating other instances with different parameters. This should work fine. 👍 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Resolves #34