From ba51f1537213b38c9aef863174a327f1cbb4e7d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Norkus?= Date: Tue, 23 Nov 2021 15:39:00 +0200 Subject: [PATCH] Fix tests --- tests/Unit/Services/DatabaseCheckerTest.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/Unit/Services/DatabaseCheckerTest.php b/tests/Unit/Services/DatabaseCheckerTest.php index c1ae216..ce2aa0a 100644 --- a/tests/Unit/Services/DatabaseCheckerTest.php +++ b/tests/Unit/Services/DatabaseCheckerTest.php @@ -32,11 +32,22 @@ public function testCheckStatus( ->getMock() ; + $pdoMock = $this + ->getMockBuilder(\PDO::class) + ->disableOriginalConstructor() + ->onlyMethods(['prepare']) + ->getMock(); + + $pdoMock + ->expects($this->once()) + ->method('prepare') + ->willReturn($this->createMock(\PDOStatement::class)); + $databaseCheckerMock ->expects(static::once()) ->method('createConnection') ->with(...$expectedPdoArgs) - ->willReturn($this->createMock(\PDO::class)) + ->willReturn($pdoMock) ; $actualResult = $databaseCheckerMock->checkStatus();