From c8f23d84794545e43141184431b477b2d78e306f Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Wed, 6 Mar 2024 14:54:48 +0100 Subject: [PATCH] Simplify InlineParameterFormatterTest (#1411) --- composer.json | 2 +- tests/InlineParameterFormatterTest.php | 19 +++++-------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index 6a8dfef4b..da85fa3a4 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "require": { "php": "^8.1", "composer-runtime-api": "^2", - "doctrine/dbal": "^3.5.1 || ^4", + "doctrine/dbal": "^3.6 || ^4", "doctrine/deprecations": "^0.5.3 || ^1", "doctrine/event-manager": "^1.2 || ^2.0", "psr/log": "^1.1.3 || ^2 || ^3", diff --git a/tests/InlineParameterFormatterTest.php b/tests/InlineParameterFormatterTest.php index 642c223fc..02a4ccc64 100644 --- a/tests/InlineParameterFormatterTest.php +++ b/tests/InlineParameterFormatterTest.php @@ -12,14 +12,8 @@ use Doctrine\Migrations\InlineParameterFormatter; use PHPUnit\Framework\TestCase; -use function class_exists; - class InlineParameterFormatterTest extends TestCase { - private Connection $connection; - - private AbstractPlatform $platform; - private InlineParameterFormatter $parameterFormatter; public function testFormatParameters(): void @@ -61,8 +55,7 @@ public function testFormatParameters(): void 'unknown', 'unknown', ParameterType::STRING, - // @phpstan-ignore-next-line - class_exists(ArrayParameterType::class) ? ArrayParameterType::INTEGER : Connection::PARAM_INT_ARRAY, + ArrayParameterType::INTEGER, ]; $result = $this->parameterFormatter->formatParameters($params, $types); @@ -74,14 +67,12 @@ class_exists(ArrayParameterType::class) ? ArrayParameterType::INTEGER : Connecti protected function setUp(): void { - $this->connection = $this->createMock(Connection::class); - - $this->platform = $this->createMock(AbstractPlatform::class); + $connection = $this->createMock(Connection::class); - $this->connection->expects(self::any()) + $connection->expects(self::any()) ->method('getDatabasePlatform') - ->willReturn($this->platform); + ->willReturn(self::createStub(AbstractPlatform::class)); - $this->parameterFormatter = new InlineParameterFormatter($this->connection); + $this->parameterFormatter = new InlineParameterFormatter($connection); } }