diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-01-20 14:25:07 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-02-27 12:03:22 +0100 |
commit | e6abe96374d31ba4c44103b822ee826ea6e5a927 (patch) | |
tree | edaba3f380b6159e5a6bc88486a854fb69efeef0 /tests/lib/repair | |
parent | 7fe07e93fe4706962d2957d252b009513459d15e (diff) | |
download | nextcloud-server-e6abe96374d31ba4c44103b822ee826ea6e5a927.tar.gz nextcloud-server-e6abe96374d31ba4c44103b822ee826ea6e5a927.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')); } /** |