Skip to content

Commit

Permalink
Merge branch '4.4' into 5.1
Browse files Browse the repository at this point in the history
* 4.4:
  stop using deprecated PHPUnit APIs
  • Loading branch information
fabpot committed Aug 17, 2020
2 parents ba620ba + 98fb210 commit 794f3d4
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 @@ -558,7 +558,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 794f3d4

Please sign in to comment.