-
-
Notifications
You must be signed in to change notification settings - Fork 43
Using phpunit from the vendors #197
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
Comments
Not sure if I understand the problem correctly... You want to include the phpunit dependency in the Adding it to composer would also improve autocompletion when writing new tests 👍 |
Yes you did!
Right now if I don't, phpunit can get confused when requiring a class. Should it autoload it from the phpunit phar, or from the project's vendors? This is why I can type The main argument against using the version from the vendors is that you add some more constraints that can hold you back, because phpunit has many dependencies. Let's have a look at that claim :
So yeah, phpunit has a lot of dependencies, but mainly to other testing libraries, so who cares? Plus, phpunit is actively maintained, and will very unlikely hold us back with its constraints. Look at the
Indeed, I miss it a lot too! |
Only interesting while development, but who cares? As long as a bundle user won't have to load it 👍 |
Exactly. So on the one hand, we have hypothetical problems about being held back by too many deps, and on the other hand, we have the painfully real problem (happened to me personally several times) that we lose hours debugging the very strange issues this can create. |
true |
Wrong issue @OskarStark? |
true ;-) |
This issue should solve your problem: sebastianbergmann/phpunit#2015 I have to take a look to you're PR because I already used If we can't do anything else, in this case yes we have to including it sebastianbergmann/phpunit#2015. But this should be an exception and temporary. Plus, you get more risk to require PHPunit locally or globally with composer than the .phar. Why? Simply because you will not get the dependencies versions used and tested for the .phar and take the risk to have a non-working binary. |
Maybe people already having PHPUnit installation? Plus what I said on #197 (comment). |
On which package? I think the results depends on several things : the existing tests, and the environment at least (I had the issue on 5.5 only).
I really don't think this is a big risk, as long as we use stable versions, compared to the strange things that happen with the phar right now. I agree that sebastianbergmann/phpunit#2015 would be best, but we don't have an ETA for that now, do we? So in the meantime, let's use another solution ok? This one has proved several times to cause problems. |
So? Any decision here? IMO we should require PHPUnit in every bundle, at least to tell the developers which PHPUnit API (4/5/6?) is used in our bundles right now. |
This would also solve #197 |
Circular reference detected |
Damn, looks like my Greasemonkey scripts are broken :/ |
@soullivaneuh : the build is broken on |
Keep the If we have very no choice for a special case, in this case we may consider it (after considering all the other options). I hope sebastianbergmann/phpunit#2015 will be solved soon. |
That's the problem IMO : the built version might be buggy, which was exactly the case recently. Being able to blacklist the last version, or rather, blacklist the last version of one dependency b/c it has a bug that affects us is important, even if the phpunit team is pretty quick at fixing bugs. |
Then report the issue and wait for the fix. I already experience this and when the bug is critical, the fix is released quite quickly. |
Having phpunit on requirement would produce more risk than the |
That's what happened, but it's not quick enough. Every PR is frozen in the meantime. Bug reported 12 days ago : sebastianbergmann/phpunit-mock-objects#321 |
9 days to have a fix, you think this is slow? Well, this is the open-source rules. If you think it's to slow, propose your own! 😉 |
I don't think it is slow, if you ask me it's a pretty quick fix. What I find long is the time during which we are frozen, with no option. One week without being able to merge any PR. Were we using phpunit from the vendors, it would be as simple as require-dev: {
"phpunit/phpunit-mock-objects": "!=3.2.4, !=3.2.5"
} How long do you think this takes to ship?
Zero activity on this thread since january, what gives you this hope?
By that I think you mean that there is some kind of integration test suite (BTW, do you know if there is actually one ?) that would shield us from defects. Well let's be honest, it didn't shield us from the nasty issue that is discussed here, and it prevents us from getting back to a version of |
By that, I just think if you have a build with locked dependencies you should use this to be sure to get it working well and properly report bugs if not.
This depends of another issue. And yes it's a hope. I didn't get the question. I hope to get this because with class prefixes, we will not have any dependencies conflicts anymore. BTW, if I understood well, the related issue is fixed and released. So no reason to discuss more about that. Let's keep .phar for proper build and use deps for very special case (with issue of when we can rollback.) Plus, you talk about to get stuck on one PR for 9 days. Well, I think we have a lot of PR on sonata to take care waiting this one, right? 😉 If the current issue is solved, let's close this one for now. |
This was just the biggest out of several issues. The last commit of #4029, sonata-project/SonataAdminBundle@bf3a2d0 makes #4029 work, but you disagree with it, right? I am going to remove it to show you the bug again. I will also rebase this PR on the tip of 3.x, you never know. Also, as @core23 mentioned, there is #159 . |
The question is : "What do you base your hope on?" Maybe you could link to that other issue b/c if this is solved tomorrow, then problem of #4029 solved. It would probably not help in case of a buggy release, but I guess if we end up in this kind of case, we can still rollback.
Did you notice that I managed to have #4029 pass (= work well), when it would have been impossible to do so with the locked dependencies?
What? How does not using the .phar prevent you from reporting bugs properly? |
I'm going to file a bug report to phpunit, maybe there is another solution… |
@soullivaneuh : this won't be fixed, occurs only on the Travis machine it seems… |
How could I have missed that blog post 🙀 I really need to check my feeds more often... "Set the SYMFONY_PHPUNIT_REMOVE env var to symfony/yaml if you need prophecy but not symfony/yaml." Nice 😊 |
@greg0ire Symfony is not talking about phpunit but In this case, maybe use this bridge? On in very last case, if really no solution, yes we can add phpunit as dep for failing project. But this should be rollback once sebastianbergmann/phpunit#2015 solved. Because the only issue is namespace conflict. |
I think they build their own version b/c they had a very similar namespace conflict problem with the Yaml component. I also think this should be reverted when and only when the phpunit runner code is separated from the code you extend in your tests, which you should be able to pick and choose. See this comment. So IMO in the future we should use a phar / and require whichever part of the phpunit framework we are referencing in our code. Tests are part of the code and have dependencies and a such, should absolutely require them (in the |
Apparently, they are using them on other projects than Symfony, so maybe it would indeed help. Would have to be tested on the next weird issue we get if require phpunit is such a no-no for you. |
Can be a good alternative IMHO.
I'm not sure of what you mean, test class will always extend PHPUnit classes... |
This means you should always at least require the package where these classes are defined. In the future, the package that defines |
I have a confirmation from the symfony team that simple-phpunit would indeed be the way to go for us. |
@sonata-project/contributors : Here is a POC : sonata-project/SonataAdminBundle#4307 . Please have a look at it. |
Recap of the sf slack :
I think @soullivaneuh wants to set this up only on projects that have a problem, while others might want to do it on all projects, so let's vote on this. |
Solution 1 : switch to simple-phpunit when problem arise on libs |
Solution 2: switch all projects to simple-phpunit |
Solution 3: do nothing and wait for php-scoper. |
I vote 2. b/c I think reacting on the fly is not something we are that good at, because of the nature of dev-kit, and I don't want to wait for an undetermined period of time and bang my head against the wall on weird problems. Also, it might be more simple to implement. |
We do not have to care anymore about picking the right phpunit versions, and this should spare us some autoloading issues. Closing sonata-project#197
We do not have to care anymore about picking the right phpunit versions, and this should spare us some autoloading issues. Closing sonata-project#197
As we don't want to use composer to handle developer tools (e.g. PHPUnit), what about adding the allowed tools to the |
Sorry, what? |
Reword the text xD |
Ah ok I get it now! It's a way to communicate it indeed, but it will not "do" anything, will it? Plus this will prevent people using conflicting versions of phpunit or whatever in their project, and we should have zero influence on that. |
Or we use this: #372 |
@greg0ire I'll close this since we're now using |
No it's fine I think :) |
@sonata-project/contributors, I have big issue with phpunit. The fact that we don't require and treat it as a dependency of our project seems to mean that as soon as we require a library the phpunit phar also bundles, test can fuck up in unexpected ways. It is the case in this PR since I required
matthiasnoback/symfony-dependency-injection-test
to test the Sonata Admin Symfony extension (which was not covered at all, it seems, by the way). My last commit, where I require and use phpunit provided by Composer fixes this issue. Here is what I get otherwise. This way of doing things has caused issues in the past, and will probably cause more if we continue like this. Can we agree that this is no longer relevant? As an argument against this, doing things like that also makes the travis workflow unnecessarily complicated IMO.And finally, we were warned against this by Jordi himself, and I really think we should listen to what this guy has to say.
Related issues (each one has been very time-consuming) :
The text was updated successfully, but these errors were encountered: