From 4601eab0098e34e2d461fe573b9d013ea344f5f1 Mon Sep 17 00:00:00 2001 From: Joe Danis Date: Thu, 17 Sep 2020 15:14:20 -0400 Subject: [PATCH] Fix tests --- src/Driver/Mysqli/Statement.php | 2 +- src/Driver/PDO/SQLSrv/Statement.php | 2 +- src/Driver/PDO/Statement.php | 2 +- src/Driver/SQLSrv/Statement.php | 2 +- src/ParameterType.php | 2 +- src/Types/AsciiStringType.php | 2 +- .../ParameterTypes/{AsciiStringTest.php => AsciiTest.php} | 4 ++-- tests/Functional/Types/AsciiStringTest.php | 6 +++--- tests/Types/AsciiStringTest.php | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) rename tests/Functional/ParameterTypes/{AsciiStringTest.php => AsciiTest.php} (84%) diff --git a/src/Driver/Mysqli/Statement.php b/src/Driver/Mysqli/Statement.php index 92795077fbd..b3a5ca87465 100644 --- a/src/Driver/Mysqli/Statement.php +++ b/src/Driver/Mysqli/Statement.php @@ -28,7 +28,7 @@ final class Statement implements StatementInterface { /** @var string[] */ protected static $_paramTypeMap = [ - ParameterType::ASCII_STRING => 's', + ParameterType::ASCII => 's', ParameterType::STRING => 's', ParameterType::BINARY => 's', ParameterType::BOOLEAN => 'i', diff --git a/src/Driver/PDO/SQLSrv/Statement.php b/src/Driver/PDO/SQLSrv/Statement.php index ee01c64d266..8b8e551fcdb 100644 --- a/src/Driver/PDO/SQLSrv/Statement.php +++ b/src/Driver/PDO/SQLSrv/Statement.php @@ -37,7 +37,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le break; - case ParameterType::ASCII_STRING: + case ParameterType::ASCII: $type = PDO::PARAM_STR; $length = 0; $driverOptions = PDO::SQLSRV_ENCODING_SYSTEM; diff --git a/src/Driver/PDO/Statement.php b/src/Driver/PDO/Statement.php index 642ad2b1db1..7107fa2dff5 100644 --- a/src/Driver/PDO/Statement.php +++ b/src/Driver/PDO/Statement.php @@ -20,7 +20,7 @@ final class Statement implements StatementInterface ParameterType::NULL => PDO::PARAM_NULL, ParameterType::INTEGER => PDO::PARAM_INT, ParameterType::STRING => PDO::PARAM_STR, - ParameterType::ASCII_STRING => PDO::PARAM_STR, + ParameterType::ASCII => PDO::PARAM_STR, ParameterType::BINARY => PDO::PARAM_LOB, ParameterType::LARGE_OBJECT => PDO::PARAM_LOB, ParameterType::BOOLEAN => PDO::PARAM_BOOL, diff --git a/src/Driver/SQLSrv/Statement.php b/src/Driver/SQLSrv/Statement.php index 298d2271b1a..fe380fa11cd 100644 --- a/src/Driver/SQLSrv/Statement.php +++ b/src/Driver/SQLSrv/Statement.php @@ -182,7 +182,7 @@ private function prepare() ]; break; - case ParameterType::ASCII_STRING: + case ParameterType::ASCII: $params[$column - 1] = [ &$variable, SQLSRV_PARAM_IN, diff --git a/src/ParameterType.php b/src/ParameterType.php index 147b3cd3c76..b77722d9ec3 100644 --- a/src/ParameterType.php +++ b/src/ParameterType.php @@ -44,7 +44,7 @@ final class ParameterType /** * Represents an ascii string data type */ - public const ASCII_STRING = 17; + public const ASCII = 17; /** * This class cannot be instantiated. diff --git a/src/Types/AsciiStringType.php b/src/Types/AsciiStringType.php index ad8f588032c..981761a11e2 100644 --- a/src/Types/AsciiStringType.php +++ b/src/Types/AsciiStringType.php @@ -22,7 +22,7 @@ public function getSQLDeclaration(array $column, AbstractPlatform $platform) */ public function getBindingType() { - return ParameterType::ASCII_STRING; + return ParameterType::ASCII; } public function getName(): string diff --git a/tests/Functional/ParameterTypes/AsciiStringTest.php b/tests/Functional/ParameterTypes/AsciiTest.php similarity index 84% rename from tests/Functional/ParameterTypes/AsciiStringTest.php rename to tests/Functional/ParameterTypes/AsciiTest.php index 669b418fdba..70c56540173 100644 --- a/tests/Functional/ParameterTypes/AsciiStringTest.php +++ b/tests/Functional/ParameterTypes/AsciiTest.php @@ -8,7 +8,7 @@ use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Tests\FunctionalTestCase; -class AsciiStringTest extends FunctionalTestCase +class AsciiTest extends FunctionalTestCase { public function testAsciiBinding(): void { @@ -18,7 +18,7 @@ public function testAsciiBinding(): void $statement = $this->connection->prepare('SELECT sql_variant_property(?, \'BaseType\')'); - $statement->bindValue(1, 'test', ParameterType::ASCII_STRING); + $statement->bindValue(1, 'test', ParameterType::ASCII); $results = $statement->execute()->fetchOne(); self::assertEquals('varchar', $results); diff --git a/tests/Functional/Types/AsciiStringTest.php b/tests/Functional/Types/AsciiStringTest.php index 3e1d468b8ec..832541c50b3 100644 --- a/tests/Functional/Types/AsciiStringTest.php +++ b/tests/Functional/Types/AsciiStringTest.php @@ -48,8 +48,8 @@ private function insert(string $id, string $value): void 'id' => $id, 'val' => $value, ], [ - ParameterType::ASCII_STRING, - ParameterType::ASCII_STRING, + ParameterType::ASCII, + ParameterType::ASCII, ]); self::assertSame(1, $result); @@ -60,7 +60,7 @@ private function select(string $id): string $value = $this->connection->fetchOne( 'SELECT val FROM ascii_table WHERE id = ?', [$id], - [ParameterType::ASCII_STRING] + [ParameterType::ASCII] ); self::assertIsString($value); diff --git a/tests/Types/AsciiStringTest.php b/tests/Types/AsciiStringTest.php index def092c2d34..7cc48c083c6 100644 --- a/tests/Types/AsciiStringTest.php +++ b/tests/Types/AsciiStringTest.php @@ -21,7 +21,7 @@ protected function setUp(): void public function testReturnCorrectBindingType(): void { - self::assertEquals($this->type->getBindingType(), ParameterType::ASCII_STRING); + self::assertEquals($this->type->getBindingType(), ParameterType::ASCII); } public function testDelegateToPlatformForSqlDeclaration(): void @@ -34,7 +34,7 @@ public function testDelegateToPlatformForSqlDeclaration(): void foreach ($columnDefinitions as $column) { $platform = $this->createMock(AbstractPlatform::class); $platform->expects(self::once()) - ->method('getAsciiTypeDeclarationSQL') + ->method('getAsciiStringTypeDeclarationSQL') ->with($column); $this->type->getSQLDeclaration($column, $platform);