Skip to content

Commit

Permalink
minor #37831 stop using deprecated PHPUnit APIs (xabbuh)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.4 branch.

Discussion
----------

stop using deprecated PHPUnit APIs

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

3d209c46e4 stop using deprecated PHPUnit APIs
  • Loading branch information
fabpot committed Aug 17, 2020
2 parents ce729cd + 4b232e3 commit 98fb210
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
28 changes: 16 additions & 12 deletions Tests/EventListener/LocaleAwareListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ public function testLocaleIsSetInOnKernelRequest()
public function testDefaultLocaleIsUsedOnExceptionsInOnKernelRequest()
{
$this->localeAwareService
->expects($this->at(0))
->expects($this->exactly(2))
->method('setLocale')
->will($this->throwException(new \InvalidArgumentException()));
$this->localeAwareService
->expects($this->at(1))
->method('setLocale')
->with($this->equalTo('en'));
->withConsecutive(
[$this->anything()],
['en']
)
->willReturnOnConsecutiveCalls(
$this->throwException(new \InvalidArgumentException())
);

$event = new RequestEvent($this->createHttpKernel(), $this->createRequest('fr'), HttpKernelInterface::MASTER_REQUEST);
$this->listener->onKernelRequest($event);
Expand Down Expand Up @@ -89,13 +91,15 @@ public function testLocaleIsSetToDefaultOnKernelFinishRequestWhenParentRequestDo
public function testDefaultLocaleIsUsedOnExceptionsInOnKernelFinishRequest()
{
$this->localeAwareService
->expects($this->at(0))
->expects($this->exactly(2))
->method('setLocale')
->will($this->throwException(new \InvalidArgumentException()));
$this->localeAwareService
->expects($this->at(1))
->method('setLocale')
->with($this->equalTo('en'));
->withConsecutive(
[$this->anything()],
['en']
)
->willReturnOnConsecutiveCalls(
$this->throwException(new \InvalidArgumentException())
);

$this->requestStack->push($this->createRequest('fr'));
$this->requestStack->push($subRequest = $this->createRequest('de'));
Expand Down
2 changes: 1 addition & 1 deletion Tests/KernelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ public function getContainerClass(): string
}
};

$this->assertRegExp('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*TestDebugContainer$/', $kernel->getContainerClass());
$this->assertMatchesRegularExpression('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*TestDebugContainer$/', $kernel->getContainerClass());
}

/**
Expand Down

0 comments on commit 98fb210

Please sign in to comment.