From c50265c1ebc28720a61629247351feb6976a2572 Mon Sep 17 00:00:00 2001 From: Yassine Guedidi Date: Tue, 1 Apr 2025 23:07:49 +0200 Subject: [PATCH] Replace setMethods by onlyMethods --- .../Api/EntryRestControllerTest.php | 2 +- tests/Controller/EntryControllerTest.php | 2 +- tests/Helper/ContentProxyTest.php | 38 +++++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/Controller/Api/EntryRestControllerTest.php b/tests/Controller/Api/EntryRestControllerTest.php index 342f4424c..4719a746b 100644 --- a/tests/Controller/Api/EntryRestControllerTest.php +++ b/tests/Controller/Api/EntryRestControllerTest.php @@ -691,7 +691,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $container = $this->client->getContainer(); $contentProxy = $this->getMockBuilder(ContentProxy::class) ->disableOriginalConstructor() - ->setMethods(['updateEntry']) + ->onlyMethods(['updateEntry']) ->getMock(); $contentProxy->expects($this->any()) ->method('updateEntry') diff --git a/tests/Controller/EntryControllerTest.php b/tests/Controller/EntryControllerTest.php index b84c3917c..dd1a33c3f 100644 --- a/tests/Controller/EntryControllerTest.php +++ b/tests/Controller/EntryControllerTest.php @@ -1721,7 +1721,7 @@ class EntryControllerTest extends WallabagTestCase $container = $client->getContainer(); $contentProxy = $this->getMockBuilder(ContentProxy::class) ->disableOriginalConstructor() - ->setMethods(['updateEntry']) + ->onlyMethods(['updateEntry']) ->getMock(); $contentProxy->expects($this->any()) ->method('updateEntry') diff --git a/tests/Helper/ContentProxyTest.php b/tests/Helper/ContentProxyTest.php index c9ee0eddb..18e349135 100644 --- a/tests/Helper/ContentProxyTest.php +++ b/tests/Helper/ContentProxyTest.php @@ -29,7 +29,7 @@ class ContentProxyTest extends TestCase $ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock(); $graby = $this->getMockBuilder(Graby::class) - ->setMethods(['fetchContent']) + ->onlyMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); @@ -69,7 +69,7 @@ class ContentProxyTest extends TestCase $ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock(); $graby = $this->getMockBuilder(Graby::class) - ->setMethods(['fetchContent']) + ->onlyMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); @@ -109,7 +109,7 @@ class ContentProxyTest extends TestCase $ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock(); $graby = $this->getMockBuilder(Graby::class) - ->setMethods(['fetchContent']) + ->onlyMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); @@ -154,7 +154,7 @@ class ContentProxyTest extends TestCase ->method('process'); $graby = $this->getMockBuilder(Graby::class) - ->setMethods(['fetchContent']) + ->onlyMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); @@ -200,7 +200,7 @@ class ContentProxyTest extends TestCase ->method('process'); $graby = $this->getMockBuilder(Graby::class) - ->setMethods(['fetchContent']) + ->onlyMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); @@ -246,7 +246,7 @@ class ContentProxyTest extends TestCase ->method('process'); $graby = $this->getMockBuilder(Graby::class) - ->setMethods(['fetchContent']) + ->onlyMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); @@ -291,7 +291,7 @@ class ContentProxyTest extends TestCase ->method('process'); $graby = $this->getMockBuilder(Graby::class) - ->setMethods(['fetchContent']) + ->onlyMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); @@ -341,7 +341,7 @@ class ContentProxyTest extends TestCase ->willReturn(new ConstraintViolationList([new ConstraintViolation('oops', 'oops', [], 'oops', 'language', 'dontexist')])); $graby = $this->getMockBuilder(Graby::class) - ->setMethods(['fetchContent']) + ->onlyMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); @@ -392,7 +392,7 @@ class ContentProxyTest extends TestCase )); $graby = $this->getMockBuilder(Graby::class) - ->setMethods(['fetchContent']) + ->onlyMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); @@ -649,7 +649,7 @@ class ContentProxyTest extends TestCase $ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock(); $graby = $this->getMockBuilder(Graby::class) - ->setMethods(['fetchContent']) + ->onlyMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); @@ -693,7 +693,7 @@ class ContentProxyTest extends TestCase $ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock(); $graby = $this->getMockBuilder(Graby::class) - ->setMethods(['fetchContent']) + ->onlyMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); @@ -732,7 +732,7 @@ class ContentProxyTest extends TestCase $ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock(); $graby = $this->getMockBuilder(Graby::class) - ->setMethods(['fetchContent']) + ->onlyMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); @@ -770,7 +770,7 @@ class ContentProxyTest extends TestCase $ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock(); $graby = $this->getMockBuilder(Graby::class) - ->setMethods(['fetchContent']) + ->onlyMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); @@ -808,7 +808,7 @@ class ContentProxyTest extends TestCase $ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock(); $graby = $this->getMockBuilder(Graby::class) - ->setMethods(['fetchContent']) + ->onlyMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); @@ -846,7 +846,7 @@ class ContentProxyTest extends TestCase $ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock(); $graby = $this->getMockBuilder(Graby::class) - ->setMethods(['fetchContent']) + ->onlyMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); @@ -895,7 +895,7 @@ class ContentProxyTest extends TestCase $ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock(); $graby = $this->getMockBuilder(Graby::class) - ->setMethods(['fetchContent']) + ->onlyMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); @@ -1103,7 +1103,7 @@ class ContentProxyTest extends TestCase private function getTaggerMock() { return $this->getMockBuilder(RuleBasedTagger::class) - ->setMethods(['tag']) + ->onlyMethods(['tag']) ->disableOriginalConstructor() ->getMock(); } @@ -1111,7 +1111,7 @@ class ContentProxyTest extends TestCase private function getRuleBasedIgnoreOriginProcessorMock() { return $this->getMockBuilder(RuleBasedIgnoreOriginProcessor::class) - ->setMethods(['process']) + ->onlyMethods(['process']) ->disableOriginalConstructor() ->getMock(); } @@ -1124,7 +1124,7 @@ class ContentProxyTest extends TestCase private function getValidator($withDefaultMock = true) { $mock = $this->getMockBuilder(RecursiveValidator::class) - ->setMethods(['validate']) + ->onlyMethods(['validate']) ->disableOriginalConstructor() ->getMock();