Skip to content

Commit 98fb210

Browse files
committed
minor #37831 stop using deprecated PHPUnit APIs (xabbuh)
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
2 parents ce729cd + 4b232e3 commit 98fb210

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

Tests/EventListener/LocaleAwareListenerTest.php

+16-12
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ public function testLocaleIsSetInOnKernelRequest()
4747
public function testDefaultLocaleIsUsedOnExceptionsInOnKernelRequest()
4848
{
4949
$this->localeAwareService
50-
->expects($this->at(0))
50+
->expects($this->exactly(2))
5151
->method('setLocale')
52-
->will($this->throwException(new \InvalidArgumentException()));
53-
$this->localeAwareService
54-
->expects($this->at(1))
55-
->method('setLocale')
56-
->with($this->equalTo('en'));
52+
->withConsecutive(
53+
[$this->anything()],
54+
['en']
55+
)
56+
->willReturnOnConsecutiveCalls(
57+
$this->throwException(new \InvalidArgumentException())
58+
);
5759

5860
$event = new RequestEvent($this->createHttpKernel(), $this->createRequest('fr'), HttpKernelInterface::MASTER_REQUEST);
5961
$this->listener->onKernelRequest($event);
@@ -89,13 +91,15 @@ public function testLocaleIsSetToDefaultOnKernelFinishRequestWhenParentRequestDo
8991
public function testDefaultLocaleIsUsedOnExceptionsInOnKernelFinishRequest()
9092
{
9193
$this->localeAwareService
92-
->expects($this->at(0))
94+
->expects($this->exactly(2))
9395
->method('setLocale')
94-
->will($this->throwException(new \InvalidArgumentException()));
95-
$this->localeAwareService
96-
->expects($this->at(1))
97-
->method('setLocale')
98-
->with($this->equalTo('en'));
96+
->withConsecutive(
97+
[$this->anything()],
98+
['en']
99+
)
100+
->willReturnOnConsecutiveCalls(
101+
$this->throwException(new \InvalidArgumentException())
102+
);
99103

100104
$this->requestStack->push($this->createRequest('fr'));
101105
$this->requestStack->push($subRequest = $this->createRequest('de'));

Tests/KernelTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ public function getContainerClass(): string
662662
}
663663
};
664664

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

668668
/**

0 commit comments

Comments
 (0)