port 1776 databox create to master

This commit is contained in:
aina-esokia
2018-03-01 17:41:08 +04:00
parent 71f6e5d964
commit 9226e5a478
18 changed files with 411 additions and 166 deletions

View File

@@ -52,4 +52,27 @@ class StringHelperTest extends \PhraseanetTestCase
["ABC\n\rDEF", "ABC\n\nDEF"],
];
}
/**
* @dataProvider provideStringsForSqlQuote
* @covers Alchemy\Phrasea\Utilities\StringHelper::SqlQuote
*/
public function testSqlQuote($string, $mode, $expected)
{
$result = StringHelper::SqlQuote($string, $mode);
$this->assertEquals($expected, $result);
}
public function provideStringsForSqlQuote()
{
return [
["azerty", StringHelper::SQL_VALUE, "'azerty'"],
["aze'rty", StringHelper::SQL_VALUE, "'aze''rty'"],
["aze`rty", StringHelper::SQL_VALUE, "'aze`rty'"],
["azerty", StringHelper::SQL_IDENTIFIER, "`azerty`"],
["aze'rty", StringHelper::SQL_IDENTIFIER, "`aze'rty`"],
["aze`rty", StringHelper::SQL_IDENTIFIER, "`aze``rty`"],
];
}
}