Skip to content

Commit

Permalink
Simplify InlineParameterFormatterTest (#1411)
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Mar 6, 2024
1 parent 44c5a96 commit c8f23d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -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",
Expand Down
19 changes: 5 additions & 14 deletions tests/InlineParameterFormatterTest.php
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
}

0 comments on commit c8f23d8

Please sign in to comment.