Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4939 from morozov/issues/3346
- Loading branch information
Showing
2 changed files
with
33 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\DBAL\Tests\Functional\Platform; | ||
|
||
use Doctrine\DBAL\Tests\FunctionalTestCase; | ||
|
||
final class ConcatExpressionTest extends FunctionalTestCase | ||
{ | ||
/** | ||
* @param list<string> $arguments | ||
* | ||
* @dataProvider expressionProvider | ||
*/ | ||
public function testConcatExpression(array $arguments, string $expected): void | ||
{ | ||
$platform = $this->connection->getDatabasePlatform(); | ||
$query = $platform->getDummySelectSQL($platform->getConcatExpression(...$arguments)); | ||
|
||
self::assertEquals($expected, $this->connection->fetchOne($query)); | ||
} | ||
|
||
/** | ||
* @return iterable<string,array{list<string>,string}> | ||
*/ | ||
public static function expressionProvider(): iterable | ||
{ | ||
yield 'strings' => [["'foo'", "'bar'"], 'foobar']; | ||
yield 'numbers and a hyphen' => [['2010', "'-'", '2019'], '2010-2019']; | ||
} | ||
} |