-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] Check Mongo effective connection before starting tests #16287
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
[HttpFoundation] Check Mongo effective connection before starting tests #16287
Conversation
Mongo is mocked in the tests. So there should not be any connection necessary at all. So this change doesn't make sense to me. Status: Needs Work |
Hi @Tobion, this is my first source PR so probably hasn't the best development topics behind, sorry about it. ^^' Anyway I'm seeing that currently this test class has the annotation
I have the mongo extension installed but default parameters aren't accepted for the connection. Should I open an issue about these failures instead of this PR? |
I think it's because the original constructor is still called of the mock. Please adjust the code in https://github.com/EmanueleMinotto/symfony/blob/mongo-effective-connection/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php#L36 as follows and the 8000 n test again.
|
Still failing, 6 failures now:
Could https://github.com/symfony/symfony/blob/2.8/.travis.yml#L26 affect results? |
@Tobion how should I proceed? |
@EmanueleMinotto Did you change the |
@xabbuh sorry, I didn't see the notification. |
@EmanueleMinotto Because from looking at the stack trace you posted the error is triggered in that method when creating the mock object. |
@xabbuh added the check in |
Imo having this check method is the wrong solution. Simply calling |
That's what I meant some comments above, even with |
@EmanueleMinotto Can you please push the |
@xabbuh you're right, output changes, but I'm still having 6 failures:
|
@EmanueleMinotto Hard to tell without knowing how your code now looks like. Please push your changes here. |
@EmanueleMinotto I found some time to have a deeper look into your issue which should be solved by #16370. |
@xabbuh great, thanks |
…bjects (xabbuh) This PR was merged into the 2.3 branch. Discussion ---------- [HttpFoundation] don't call constructors on Mongo mock objects | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #16287 | License | MIT | Doc PR | Calling the parent constructor of the mocked `Mongo` class tries to connect to a local MongoDB server which fails in case no local server was configured. Similarly, when the parent constructor of the mocked `MongoCollection` class is called it performs checks on the passed arguments which fails again when a connection was not established successfully before. Commits ------- 6541b8b don't call constructors on Mongo mock objects
The test suite for
MongoDbSessionHandlerTest
is executed even if a connection can’t be established.