Fix the test
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
15bbe02106
commit
17a2723948
1 changed files with 5 additions and 5 deletions
|
@ -400,18 +400,18 @@ class LegacyDBTest extends \Test\TestCase {
|
||||||
/**
|
/**
|
||||||
* @dataProvider insertAndSelectDataProvider
|
* @dataProvider insertAndSelectDataProvider
|
||||||
*/
|
*/
|
||||||
public function testInsertAndSelectData($expected, $skipOnMysql) {
|
public function testInsertAndSelectData($expected, $throwsOnMysqlWithoutUTF8MB4) {
|
||||||
$table = "*PREFIX*{$this->text_table}";
|
$table = "*PREFIX*{$this->text_table}";
|
||||||
|
$config = \OC::$server->getConfig();
|
||||||
|
|
||||||
$query = OC_DB::prepare("INSERT INTO `$table` (`textfield`) VALUES (?)");
|
$query = OC_DB::prepare("INSERT INTO `$table` (`textfield`) VALUES (?)");
|
||||||
|
if ($throwsOnMysqlWithoutUTF8MB4 && $config->getSystemValue('dbtype', 'sqlite') === 'mysql' && $config->getSystemValue('mysql.utf8mb4', false) === false) {
|
||||||
|
$this->markTestSkipped('MySQL requires UTF8mb4 to store value: ' . $expected);
|
||||||
|
}
|
||||||
$result = $query->execute(array($expected));
|
$result = $query->execute(array($expected));
|
||||||
$this->assertEquals(1, $result);
|
$this->assertEquals(1, $result);
|
||||||
|
|
||||||
$actual = OC_DB::prepare("SELECT `textfield` FROM `$table`")->execute()->fetchOne();
|
$actual = OC_DB::prepare("SELECT `textfield` FROM `$table`")->execute()->fetchOne();
|
||||||
$config = \OC::$server->getConfig();
|
|
||||||
if($skipOnMysql && $config->getSystemValue('dbtype', 'sqlite') === 'mysql' && $config->getSystemValue('mysql.utf8mb4', false) === false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$this->assertSame($expected, $actual);
|
$this->assertSame($expected, $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue