Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure that (VAR)CHAR column length is specified in characters, not bytes #3599

Merged
merged 1 commit into from
Jun 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions tests/Doctrine/Tests/DBAL/Functional/Platform/ColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, array<int, mixed>>
*/
public static function string1Provider() : iterable
{
return [
'ansi' => ['Z'],
'unicode' => ['Я'],
];
}

/**
* @return iterable<string, array<int, mixed>>
*/
public static function string8Provider() : iterable
{
return [
'ansi' => ['Doctrine'],
'unicode' => ['Доктрина'],
];
}

public function testVariableLengthBinaryNoLength() : void
Expand Down