Skip to content
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

Show a warning when users don't run the correct PHPUnit version #71

Closed
matthiasnoback opened this issue Mar 8, 2017 · 13 comments
Closed

Comments

@matthiasnoback
Copy link
Collaborator

See #70. Since we can't enforce a specific PHPUnit version using standard Composer techniques (e.g. in the require section), we need to warn the users about incompatible usage in another way.

@xabbuh
Copy link
Member

xabbuh commented Mar 8, 2017

One solution that could work might be to check for a class that was not present before PHPUnit 6 inside the setUp() method of the base test case class and skip the test otherwise.

@OskarStark
Copy link

@xabbuh that sounds good, but why not require it directly and IF someone like to use a .phar or a global installed version, it should work too, shouldn't it?

@matthiasnoback
Copy link
Collaborator Author

@OskarStark Alas, if we require it directly, it will install the library as a project dependency.

@matthiasnoback
Copy link
Collaborator Author

@xabbuh I'll see if there is something like a Version class, etc.

@lucasvanlierop
Copy link

I guess this this error has to do with this?

PHPUnit 5.7.12 by Sebastian Bergmann and contributors.

PHP Fatal error:  Class 'PHPUnit\Framework\Constraint\Constraint' not found in /var/www/html/vendor/matthiasnoback/symfony-dependency-injection-test/PhpUnit/ContainerHasParameterConstraint.php on line 9

@matthiasnoback
Copy link
Collaborator Author

@lucasvanlierop It most likely does ;)

@lucasvanlierop
Copy link

:-) Which version do you recommend?

@matthiasnoback
Copy link
Collaborator Author

@lucasvanlierop You could either use PHPUnit ^6.0 or switch to a previous major version of this library, e.g. 1.1.0.

@lucasvanlierop
Copy link

Just did the latter thanks for confirming! Btw thanks for still maintaining this package! Used it a lot at Ibuildings and now I'm using it again for my new project ;-)

@matthiasnoback
Copy link
Collaborator Author

Cool, happy to hear that!

@matthiasnoback
Copy link
Collaborator Author

I've been thinking about this, but I can't come up with a good point to verify that the PHPUnit version used to run tests is the right one. The problem here is: I'd love to add this check to a setUp() method of some sorts, but the test runner crashes before it reaches this method, since it can't find the TestCase and related classes.
Anybody got another suggestion for this?

@lucasvanlierop
Copy link

It would be nice if composer could check if a class is present (autoloadable) on install the same way it can check the presence of a php extension

@matthiasnoback
Copy link
Collaborator Author

Closing this as I don't think there will be a solution. I'm sure with this item in the issue archive people will quickly figure out what's wrong when they encounter this situation :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants