From c7a4c0b849c7ed2bf5154a1df29d82337bd143a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Tue, 28 Jan 2020 20:07:31 +0100 Subject: [PATCH] Simplify mocking --- tests/Block/AdminListBlockServiceTest.php | 2 +- tests/Block/AdminSearchBlockServiceTest.php | 6 +++--- tests/Block/AdminStatsBlockServiceTest.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/Block/AdminListBlockServiceTest.php b/tests/Block/AdminListBlockServiceTest.php index 1ba550d929..f133251374 100644 --- a/tests/Block/AdminListBlockServiceTest.php +++ b/tests/Block/AdminListBlockServiceTest.php @@ -39,7 +39,7 @@ protected function setUp(): void { parent::setUp(); - $this->pool = $this->getMockBuilder(Pool::class)->disableOriginalConstructor()->getMock(); + $this->pool = $this->createMock(Pool::class); $this->templateRegistry = $this->prophesize(TemplateRegistryInterface::class); } diff --git a/tests/Block/AdminSearchBlockServiceTest.php b/tests/Block/AdminSearchBlockServiceTest.php index 02ca9d828a..651012ba06 100644 --- a/tests/Block/AdminSearchBlockServiceTest.php +++ b/tests/Block/AdminSearchBlockServiceTest.php @@ -40,8 +40,8 @@ protected function setUp(): void { parent::setUp(); - $this->pool = $this->getMockBuilder(Pool::class)->disableOriginalConstructor()->getMock(); - $this->searchHandler = $this->getMockBuilder(SearchHandler::class)->disableOriginalConstructor()->getMock(); + $this->pool = $this->createMock(Pool::class); + $this->searchHandler = $this->createMock(SearchHandler::class); } public function testDefaultSettings(): void @@ -65,7 +65,7 @@ public function testDefaultSettings(): void public function testGlobalSearchReturnsEmptyWhenFiltersAreDisabled(): void { - $admin = $this->getMockBuilder(AbstractAdmin::class)->disableOriginalConstructor()->getMock(); + $admin = $this->createMock(AbstractAdmin::class); $blockService = new AdminSearchBlockService( $this->createMock(Environment::class), diff --git a/tests/Block/AdminStatsBlockServiceTest.php b/tests/Block/AdminStatsBlockServiceTest.php index 3457be2f12..5bba916791 100644 --- a/tests/Block/AdminStatsBlockServiceTest.php +++ b/tests/Block/AdminStatsBlockServiceTest.php @@ -32,7 +32,7 @@ protected function setUp(): void { parent::setUp(); - $this->pool = $this->getMockBuilder(Pool::class)->disableOriginalConstructor()->getMock(); + $this->pool = $this->createMock(Pool::class); } public function testDefaultSettings(): void