-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
stop using the deprecated at() PHPUnit matcher #37808
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
Conversation
xabbuh
commented
Aug 12, 2020
Q | A |
---|---|
Branch? | 3.4 |
Bug fix? | no |
New feature? | no |
Deprecations? | no |
Tickets | Fix #37780 |
License | MIT |
Doc PR |
a64e242
to
362c7ed
Compare
should be rebased as the first commit (taken from #37771) is now merged |
7e828f7
to
35b5757
Compare
$container->expects($this->at(0))->method('has')->willReturn(false); | ||
$container->expects($this->at(1))->method('has')->willReturn(true); | ||
$container->expects($this->at(2))->method('get')->willReturn($twig); | ||
$container = new ContainerBuilder(); |
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.
You can use Container
instead of ContainerBuilder
. Btw, good catch! We shouldn't mock the container. 😃
@@ -108,14 +109,10 @@ private function getFrameworkEngineMock($template, $supports) | |||
|
|||
private function getContainerMock($services) | |||
{ | |||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock(); | |||
$container = new ContainerBuilder(); |
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.
Same here.
->withConsecutive( | ||
['Notified event "{event}" to listener "{listener}".', ['event' => 'foo', 'listener' => 'closure']], | ||
['Notified event "{event}" to listener "{listener}".', ['event' => 'foo', 'listener' => 'closure']] | ||
); |
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 wonder if we should just use BufferingLogger
instead of mocking the logger.
Thank you @xabbuh. |
… backwards-compatibility (xabbuh) This PR was merged into the 3.4 branch. Discussion ---------- [Validator] ensure that the validator is a mock object for backwards-compatibility | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | I accidentally broke the class in #37808. The validator was a mock object before (see the failing tests on the `5.1` branch). Commits ------- 1c9b671 ensure that the validator is a mock object for backwards-compatibility
… BufferingLogger (xabbuh) This PR was merged into the 3.4 branch. Discussion ---------- [EventDispatcher] drop logger mock in favor of using the BufferingLogger | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Fix #37808 (comment) | License | MIT | Doc PR | Commits ------- 86a7e32 drop logger mock in favor of using the BufferingLogger
…d exception (xabbuh) This PR was merged into the 3.4 branch. Discussion ---------- [Intl] fix test by letting mock throw the actual expected exception | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Fix #37808 | License | MIT | Doc PR | This fixes a mistake I made when rewriting the tests in #37808. Commits ------- f6f162d fix test by letting mock throw the actual expected exception