diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-01-20 14:25:07 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-03-16 16:25:21 +0100 |
commit | 5538c2732276e2d1d4b30faf475b41a1e8e3681d (patch) | |
tree | 2b8bd81253e4f95956d790bccd0eb008c58c90a2 /tests/lib/repair | |
parent | 35abb4d71e049c2c7b244ac346c7f1b9e455d20c (diff) | |
download | nextcloud-server-5538c2732276e2d1d4b30faf475b41a1e8e3681d.tar.gz nextcloud-server-5538c2732276e2d1d4b30faf475b41a1e8e3681d.zip |
Do not abort when meeting unfixable legacy storages
Diffstat (limited to 'tests/lib/repair')
-rw-r--r-- | tests/lib/repair/repairlegacystorage.php | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/tests/lib/repair/repairlegacystorage.php b/tests/lib/repair/repairlegacystorage.php index f08393300e1..24f2dbe13c0 100644 --- a/tests/lib/repair/repairlegacystorage.php +++ b/tests/lib/repair/repairlegacystorage.php @@ -24,6 +24,8 @@ class TestRepairLegacyStorages extends \Test\TestCase { private $legacyStorageId; private $newStorageId; + private $warnings; + protected function setUp() { parent::setUp(); @@ -32,6 +34,12 @@ class TestRepairLegacyStorages extends \Test\TestCase { $this->oldDataDir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data/'); $this->repair = new \OC\Repair\RepairLegacyStorages($this->config, $this->connection); + + $this->warnings = []; + + $this->repair->listen('\OC\Repair', 'warning', function ($description){ + $this->warnings[] = $description; + }); } protected function tearDown() { @@ -181,22 +189,17 @@ class TestRepairLegacyStorages extends \Test\TestCase { $this->createData($this->legacyStorageId); $this->createData($this->newStorageId); - try { - $thrown = false; - $this->repair->run(); - } - catch (\OC\RepairException $e) { - $thrown = true; - } + $this->repair->run(); - $this->assertTrue($thrown); + $this->assertEquals(1, count($this->warnings)); + $this->assertEquals('Could not repair legacy storage ', substr(current($this->warnings), 0, 32)); // storages left alone $this->assertEquals($legacyStorageNumId, $this->getStorageId($this->legacyStorageId)); $this->assertEquals($newStorageNumId, $this->getStorageId($this->newStorageId)); - // did not set the done flag - $this->assertNotEquals('yes', $this->config->getAppValue('core', 'repairlegacystoragesdone')); + // set the done flag + $this->assertEquals('yes', $this->config->getAppValue('core', 'repairlegacystoragesdone')); } /** |