summaryrefslogtreecommitdiffstats
path: root/tests/lib/DB
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2018-01-25 11:23:12 +0100
committerJoas Schilling <coding@schilljs.com>2018-01-25 11:33:25 +0100
commitbf2be08c9f3b6957a3327929a169eb6204e84cd0 (patch)
tree4738ade539309fea85c5db8e796783c2cdbc0438 /tests/lib/DB
parent24af5c20bd65f8e657bcc495984234088c22e824 (diff)
downloadnextcloud-server-bf2be08c9f3b6957a3327929a169eb6204e84cd0.tar.gz
nextcloud-server-bf2be08c9f3b6957a3327929a169eb6204e84cd0.zip
Fix risky tests without assertions
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/DB')
-rw-r--r--tests/lib/DB/ConnectionTest.php6
-rw-r--r--tests/lib/DB/DBSchemaTest.php2
-rw-r--r--tests/lib/DB/MDB2SchemaManagerTest.php2
-rw-r--r--tests/lib/DB/MigratorTest.php10
-rw-r--r--tests/lib/DB/MySqlMigrationTest.php2
-rw-r--r--tests/lib/DB/QueryBuilder/QueryBuilderTest.php4
-rw-r--r--tests/lib/DB/SqliteMigrationTest.php2
7 files changed, 15 insertions, 13 deletions
diff --git a/tests/lib/DB/ConnectionTest.php b/tests/lib/DB/ConnectionTest.php
index 2a0cd70f83a..3a4a80bdbd9 100644
--- a/tests/lib/DB/ConnectionTest.php
+++ b/tests/lib/DB/ConnectionTest.php
@@ -58,7 +58,7 @@ class ConnectionTest extends \Test\TestCase {
public function assertTableExist($table) {
if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
// sqlite removes the tables after closing the DB
- $this->assertTrue(true);
+ $this->addToAssertionCount(1);
} else {
$this->assertTrue($this->connection->tableExists($table), 'Table ' . $table . ' exists.');
}
@@ -70,7 +70,7 @@ class ConnectionTest extends \Test\TestCase {
public function assertTableNotExist($table) {
if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
// sqlite removes the tables after closing the DB
- $this->assertTrue(true);
+ $this->addToAssertionCount(1);
} else {
$this->assertFalse($this->connection->tableExists($table), 'Table ' . $table . " doesn't exist.");
}
@@ -195,5 +195,7 @@ class ConnectionTest extends \Test\TestCase {
], [
'textfield' => 'foo'
]);
+
+ $this->addToAssertionCount(1);
}
}
diff --git a/tests/lib/DB/DBSchemaTest.php b/tests/lib/DB/DBSchemaTest.php
index 8eb7fcf81b4..cc6059c163f 100644
--- a/tests/lib/DB/DBSchemaTest.php
+++ b/tests/lib/DB/DBSchemaTest.php
@@ -107,7 +107,7 @@ class DBSchemaTest extends TestCase {
$platform = \OC::$server->getDatabaseConnection()->getDatabasePlatform();
if ($platform instanceof SqlitePlatform) {
// sqlite removes the tables after closing the DB
- $this->assertTrue(true);
+ $this->addToAssertionCount(1);
} else {
$this->assertFalse(OC_DB::tableExists($table), 'Table ' . $table . ' exists.');
}
diff --git a/tests/lib/DB/MDB2SchemaManagerTest.php b/tests/lib/DB/MDB2SchemaManagerTest.php
index 93078b4f722..75572bb36a5 100644
--- a/tests/lib/DB/MDB2SchemaManagerTest.php
+++ b/tests/lib/DB/MDB2SchemaManagerTest.php
@@ -46,7 +46,7 @@ class MDB2SchemaManagerTest extends \Test\TestCase {
$connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('123'));
$manager->updateDbFromStructure(__DIR__ . '/ts-autoincrement-after.xml');
- $this->assertTrue(true);
+ $this->addToAssertionCount(1);
}
}
diff --git a/tests/lib/DB/MigratorTest.php b/tests/lib/DB/MigratorTest.php
index ea718240c5e..9dfed5ecd1a 100644
--- a/tests/lib/DB/MigratorTest.php
+++ b/tests/lib/DB/MigratorTest.php
@@ -132,7 +132,7 @@ class MigratorTest extends \Test\TestCase {
$migrator->checkMigrate($endSchema);
$migrator->migrate($endSchema);
- $this->assertTrue(true);
+ $this->addToAssertionCount(1);
}
public function testUpgradeDifferentPrefix() {
@@ -151,7 +151,7 @@ class MigratorTest extends \Test\TestCase {
$migrator->checkMigrate($endSchema);
$migrator->migrate($endSchema);
- $this->assertTrue(true);
+ $this->addToAssertionCount(1);
$this->config->setSystemValue('dbtableprefix', $oldTablePrefix);
}
@@ -169,7 +169,7 @@ class MigratorTest extends \Test\TestCase {
$this->connection->insert($this->tableName, array('id' => 2, 'name' => 'qwerty'));
$this->fail('Expected duplicate key insert to fail');
} catch (DBALException $e) {
- $this->assertTrue(true);
+ $this->addToAssertionCount(1);
}
}
@@ -191,7 +191,7 @@ class MigratorTest extends \Test\TestCase {
$migrator->checkMigrate($endSchema);
$migrator->migrate($endSchema);
- $this->assertTrue(true);
+ $this->addToAssertionCount(1);
}
public function testReservedKeywords() {
@@ -213,7 +213,7 @@ class MigratorTest extends \Test\TestCase {
$migrator->checkMigrate($endSchema);
$migrator->migrate($endSchema);
- $this->assertTrue(true);
+ $this->addToAssertionCount(1);
}
public function testAddingForeignKey() {
diff --git a/tests/lib/DB/MySqlMigrationTest.php b/tests/lib/DB/MySqlMigrationTest.php
index cdc7ef47784..3bbe89fe025 100644
--- a/tests/lib/DB/MySqlMigrationTest.php
+++ b/tests/lib/DB/MySqlMigrationTest.php
@@ -43,7 +43,7 @@ class MySqlMigrationTest extends \Test\TestCase {
$manager = new \OC\DB\MDB2SchemaManager($this->connection);
$manager->updateDbFromStructure(__DIR__ . '/testschema.xml');
- $this->assertTrue(true);
+ $this->addToAssertionCount(1);
}
}
diff --git a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
index e264fde6ec7..fa1c4add0ab 100644
--- a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
+++ b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
@@ -1137,7 +1137,7 @@ class QueryBuilderTest extends \Test\TestCase {
$qB->getLastInsertId();
$this->fail('getLastInsertId() should throw an exception, when being called before insert()');
} catch (\BadMethodCallException $e) {
- $this->assertTrue(true);
+ $this->addToAssertionCount(1);
}
$qB->insert('properties')
@@ -1163,7 +1163,7 @@ class QueryBuilderTest extends \Test\TestCase {
$qB->getLastInsertId();
$this->fail('getLastInsertId() should throw an exception, when being called after delete()');
} catch (\BadMethodCallException $e) {
- $this->assertTrue(true);
+ $this->addToAssertionCount(1);
}
}
diff --git a/tests/lib/DB/SqliteMigrationTest.php b/tests/lib/DB/SqliteMigrationTest.php
index 76002e1afce..4712fc6d70b 100644
--- a/tests/lib/DB/SqliteMigrationTest.php
+++ b/tests/lib/DB/SqliteMigrationTest.php
@@ -43,7 +43,7 @@ class SqliteMigrationTest extends \Test\TestCase {
$manager = new \OC\DB\MDB2SchemaManager($this->connection);
$manager->updateDbFromStructure(__DIR__ . '/testschema.xml');
- $this->assertTrue(true);
+ $this->addToAssertionCount(1);
}
}