From b7fdd99fa77606f32db8276f39cfdffc2bcfa87a Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Thu, 6 Jun 2019 18:59:00 -0700 Subject: [PATCH] Make sure that (VAR)CHAR column length is specified in characters, not bytes --- .../DBAL/Functional/Platform/ColumnTest.php | 43 ++++++++++++++++--- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/tests/Doctrine/Tests/DBAL/Functional/Platform/ColumnTest.php b/tests/Doctrine/Tests/DBAL/Functional/Platform/ColumnTest.php index 0bf4274337f..14fd1ab5a15 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Platform/ColumnTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Platform/ColumnTest.php @@ -18,22 +18,53 @@ public function testVariableLengthStringNoLength() : void $this->assertColumn(Types::STRING, [], 'Test', ParameterType::STRING); } - public function testVariableLengthStringWithLength() : void + /** + * @dataProvider string8Provider + */ + public function testVariableLengthStringWithLength(string $value) : void { - $this->assertColumn(Types::STRING, ['length' => 8], 'Doctrine', ParameterType::STRING); + $this->assertColumn(Types::STRING, ['length' => 8], $value, ParameterType::STRING); } - public function testFixedLengthStringNoLength() : void + /** + * @dataProvider string1Provider + */ + public function testFixedLengthStringNoLength(string $value) : void { - $this->assertColumn(Types::STRING, ['fixed' => true], 'Z', ParameterType::STRING); + $this->assertColumn(Types::STRING, ['fixed' => true], $value, ParameterType::STRING); } - public function testFixedLengthStringWithLength() : void + /** + * @dataProvider string8Provider + */ + public function testFixedLengthStringWithLength(string $value) : void { $this->assertColumn(Types::STRING, [ 'fixed' => true, 'length' => 8, - ], 'Doctrine', ParameterType::STRING); + ], $value, ParameterType::STRING); + } + + /** + * @return iterable> + */ + public static function string1Provider() : iterable + { + return [ + 'ansi' => ['Z'], + 'unicode' => ['Я'], + ]; + } + + /** + * @return iterable> + */ + public static function string8Provider() : iterable + { + return [ + 'ansi' => ['Doctrine'], + 'unicode' => ['Доктрина'], + ]; } public function testVariableLengthBinaryNoLength() : void