Skip to content

Commit 71baf6b

Browse files
[Tests] Replace setMethods() by onlyMethods() and addMethods()
1 parent 8762335 commit 71baf6b

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

Tests/CacheWarmer/AnnotationsCacheWarmerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function testWarmupRemoveCacheMisses()
136136
$cacheFile = tempnam($this->cacheDir, __FUNCTION__);
137137
$warmer = $this->getMockBuilder(AnnotationsCacheWarmer::class)
138138
->setConstructorArgs([new AnnotationReader(), $cacheFile])
139-
->setMethods(['doWarmUp'])
139+
->onlyMethods(['doWarmUp'])
140140
->getMock();
141141

142142
$warmer->method('doWarmUp')->willReturnCallback(function ($cacheDir, ArrayAdapter $arrayAdapter) {

Tests/CacheWarmer/RouterCacheWarmerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ class RouterCacheWarmerTest extends TestCase
2121
{
2222
public function testWarmUpWithWarmebleInterface()
2323
{
24-
$containerMock = $this->getMockBuilder(ContainerInterface::class)->setMethods(['get', 'has'])->getMock();
24+
$containerMock = $this->getMockBuilder(ContainerInterface::class)->onlyMethods(['get', 'has'])->getMock();
2525

26-
$routerMock = $this->getMockBuilder(testRouterInterfaceWithWarmebleInterface::class)->setMethods(['match', 'generate', 'getContext', 'setContext', 'getRouteCollection', 'warmUp'])->getMock();
26+
$routerMock = $this->getMockBuilder(testRouterInterfaceWithWarmebleInterface::class)->onlyMethods(['match', 'generate', 'getContext', 'setContext', 'getRouteCollection', 'warmUp'])->getMock();
2727
$containerMock->expects($this->any())->method('get')->with('router')->willReturn($routerMock);
2828
$routerCacheWarmer = new RouterCacheWarmer($containerMock);
2929

@@ -34,9 +34,9 @@ public function testWarmUpWithWarmebleInterface()
3434

3535
public function testWarmUpWithoutWarmebleInterface()
3636
{
37-
$containerMock = $this->getMockBuilder(ContainerInterface::class)->setMethods(['get', 'has'])->getMock();
37+
$containerMock = $this->getMockBuilder(ContainerInterface::class)->onlyMethods(['get', 'has'])->getMock();
3838

39-
$routerMock = $this->getMockBuilder(testRouterInterfaceWithoutWarmebleInterface::class)->setMethods(['match', 'generate', 'getContext', 'setContext', 'getRouteCollection'])->getMock();
39+
$routerMock = $this->getMockBuilder(testRouterInterfaceWithoutWarmebleInterface::class)->onlyMethods(['match', 'generate', 'getContext', 'setContext', 'getRouteCollection'])->getMock();
4040
$containerMock->expects($this->any())->method('get')->with('router')->willReturn($routerMock);
4141
$routerCacheWarmer = new RouterCacheWarmer($containerMock);
4242
$this->expectException(\LogicException::class);

Tests/KernelBrowserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function testRequestAfterKernelShutdownAndPerformedRequest()
6464
private function getKernelMock()
6565
{
6666
$mock = $this->getMockBuilder($this->getKernelClass())
67-
->setMethods(['shutdown', 'boot', 'handle', 'getContainer'])
67+
->onlyMethods(['shutdown', 'boot', 'handle', 'getContainer'])
6868
->disableOriginalConstructor()
6969
->getMock();
7070

Tests/Routing/RouterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ private function getServiceContainer(RouteCollection $routes): Container
609609
->willReturn($routes)
610610
;
611611

612-
$sc = $this->getMockBuilder(Container::class)->setMethods(['get'])->getMock();
612+
$sc = $this->getMockBuilder(Container::class)->onlyMethods(['get'])->getMock();
613613

614614
$sc
615615
->expects($this->once())

0 commit comments

Comments
 (0)