diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-06-11 17:02:34 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-07-14 16:20:09 +0200 |
commit | 10a29556b0eca1303fd48caccbc464e1b6231d05 (patch) | |
tree | 9ae5f6cbc6addd343c48124ab0b57551a66360f2 /apps/files_encryption/tests/migration.php | |
parent | 05ba9b3c64b5c4a109773fe776fd6a2ebd34502a (diff) | |
download | nextcloud-server-10a29556b0eca1303fd48caccbc464e1b6231d05.tar.gz nextcloud-server-10a29556b0eca1303fd48caccbc464e1b6231d05.zip |
- Added test to trigger index id error
- re-enable encryption migration tests
- sqlite requires reconnect after schema changes
Diffstat (limited to 'apps/files_encryption/tests/migration.php')
-rw-r--r-- | apps/files_encryption/tests/migration.php | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/apps/files_encryption/tests/migration.php b/apps/files_encryption/tests/migration.php index d6cd0357ae0..e58ceb0bc6f 100644 --- a/apps/files_encryption/tests/migration.php +++ b/apps/files_encryption/tests/migration.php @@ -50,10 +50,44 @@ class Test_Migration extends PHPUnit_Framework_TestCase { } - public function testDataMigration() { + public function checkLastIndexId() { + $query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (' + .' `item_type`, `item_source`, `item_target`, `share_type`,' + .' `share_with`, `uid_owner`, `permissions`, `stime`, `file_source`,' + .' `file_target`, `token`, `parent`, `expiration`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)'); + $query->bindValue(1, 'file'); + $query->bindValue(2, 949); + $query->bindValue(3, '/949'); + $query->bindValue(4, 0); + $query->bindValue(5, 'migrate-test-user'); + $query->bindValue(6, 'migrate-test-owner'); + $query->bindValue(7, 23); + $query->bindValue(8, 1402493312); + $query->bindValue(9, 0); + $query->bindValue(10, '/migration.txt'); + $query->bindValue(11, null); + $query->bindValue(12, null); + $query->bindValue(13, null); + $this->assertEquals(1, $query->execute()); + + $this->assertNotEquals('0', \OC_DB::insertid('*PREFIX*share')); + + // cleanup + $query = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `file_target` = ?'); + $query->bindValue(1, '/migration.txt'); + $this->assertEquals(1, $query->execute()); + + } + + public function testBrokenLastIndexId() { + + // create test table + $this->checkLastIndexId(); + OC_DB::createDbFromStructure(__DIR__ . '/encryption_table.xml'); + $this->checkLastIndexId(); + } - //FIXME fix this test so that we can enable it again - $this->markTestIncomplete('Disabled, because of this tests a lot of other tests fail at the moment'); + public function testDataMigration() { $this->assertTableNotExist('encryption_test'); @@ -80,9 +114,6 @@ class Test_Migration extends PHPUnit_Framework_TestCase { public function testDuplicateDataMigration() { - //FIXME fix this test so that we can enable it again - $this->markTestIncomplete('Disabled, because of this tests a lot of other tests fail at the moment'); - // create test table OC_DB::createDbFromStructure(__DIR__ . '/encryption_table.xml'); |