|
|
|
@ -46,6 +46,11 @@ class LegacyDBTest extends \Test\TestCase { |
|
|
|
|
*/ |
|
|
|
|
private $table5; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @var string |
|
|
|
|
*/ |
|
|
|
|
private $text_table; |
|
|
|
|
|
|
|
|
|
protected function setUp() { |
|
|
|
|
parent::setUp(); |
|
|
|
|
|
|
|
|
@ -63,6 +68,7 @@ class LegacyDBTest extends \Test\TestCase { |
|
|
|
|
$this->table3 = $this->test_prefix.'vcategory'; |
|
|
|
|
$this->table4 = $this->test_prefix.'decimal'; |
|
|
|
|
$this->table5 = $this->test_prefix.'uniconst'; |
|
|
|
|
$this->text_table = $this->test_prefix.'text_table'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected function tearDown() { |
|
|
|
@ -390,4 +396,29 @@ class LegacyDBTest extends \Test\TestCase { |
|
|
|
|
$result = $query->execute(array('%ba%')); |
|
|
|
|
$this->assertCount(1, $result->fetchAll()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dataProvider insertAndSelectDataProvider |
|
|
|
|
*/ |
|
|
|
|
public function testInsertAndSelectData($expected) { |
|
|
|
|
$table = "*PREFIX*{$this->text_table}"; |
|
|
|
|
|
|
|
|
|
$query = OC_DB::prepare("INSERT INTO `$table` (`textfield`) VALUES (?)"); |
|
|
|
|
$result = $query->execute(array($expected)); |
|
|
|
|
$this->assertEquals(1, $result); |
|
|
|
|
|
|
|
|
|
$actual = OC_DB::prepare("SELECT `textfield` FROM `$table`")->execute()->fetchOne(); |
|
|
|
|
$this->assertSame($expected, $actual); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function insertAndSelectDataProvider() { |
|
|
|
|
return [ |
|
|
|
|
['abcdefghijklmnopqrstuvwxyzABCDEFGHIKLMNOPQRSTUVWXYZ'], |
|
|
|
|
['0123456789'], |
|
|
|
|
['äöüÄÖÜß!"§$%&/()=?#\'+*~°^`´'], |
|
|
|
|
['²³¼½¬{[]}\\'], |
|
|
|
|
['♡⚗'], |
|
|
|
|
['💩'], # :hankey: on github |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|