-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed quoting of string literals containing backslash
- Loading branch information
Showing
5 changed files
with
46 additions
and
36 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
32 changes: 32 additions & 0 deletions
32
tests/Doctrine/Tests/DBAL/Functional/Platform/QuotingTest.php
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 | ||
|
||
namespace Doctrine\Tests\DBAL\Functional\Platform; | ||
|
||
use Doctrine\Tests\DbalFunctionalTestCase; | ||
|
||
class QuotingTest extends DbalFunctionalTestCase | ||
{ | ||
/** | ||
* @dataProvider stringLiteralProvider | ||
*/ | ||
public function testQuoteStringLiteral(string $string) : void | ||
{ | ||
$platform = $this->connection->getDatabasePlatform(); | ||
$query = $platform->getDummySelectSQL( | ||
$platform->quoteStringLiteral($string) | ||
); | ||
|
||
self::assertSame($string, $this->connection->fetchColumn($query)); | ||
} | ||
|
||
/** | ||
* @return mixed[][] | ||
*/ | ||
public static function stringLiteralProvider() : iterable | ||
{ | ||
return [ | ||
'backslash' => ['\\'], | ||
'single-quote' => ["'"], | ||
]; | ||
} | ||
} |
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