Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 1 commit into from
Aug 13, 2020
Merged

Conversation

xabbuh
Copy link
Member

@xabbuh 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

@stof
Copy link
Member

stof commented Aug 12, 2020

should be rebased as the first commit (taken from #37771) is now merged

@xabbuh xabbuh force-pushed the issue-37780 branch 2 times, most recently from 7e828f7 to 35b5757 Compare August 12, 2020 14:20
@xabbuh xabbuh marked this pull request as ready for review August 12, 2020 15:12
@xabbuh xabbuh requested a review from dunglas as a code owner August 12, 2020 15:12
$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();
Copy link
Member

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();
Copy link
Member

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']]
);
Copy link
Member

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.

@fabpot
Copy link
Member

fabpot commented Aug 13, 2020

Thank you @xabbuh.

@fabpot fabpot merged commit 6972bc2 into symfony:3.4 Aug 13, 2020
@xabbuh xabbuh deleted the issue-37780 branch August 13, 2020 14:09
fabpot added a commit that referenced this pull request Aug 17, 2020
… 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
fabpot added a commit that referenced this pull request Sep 18, 2020
… 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
xabbuh added a commit that referenced this pull request Sep 18, 2020
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants