/** * Only run the repair once */ public function testOnlyRunOnce() { $this->outputMock->expects($this->exactly(1))->method('info'); $this->prepareSettings('/tmp/oc-autotest/datadir', $this->getUniqueID('user_')); $this->assertNotEquals('yes', $this->config->getAppValue('core', 'repairlegacystoragesdone')); $this->repair->run($this->outputMock); $this->assertEquals('yes', $this->config->getAppValue('core', 'repairlegacystoragesdone')); $this->outputMock->expects($this->never())->method('info'); $this->repair->run($this->outputMock); $this->assertEquals('yes', $this->config->getAppValue('core', 'repairlegacystoragesdone')); }
/** * Only run the repair once */ public function testOnlyRunOnce() { $output = array(); $this->repair->listen('\\OC\\Repair', 'info', function ($description) use(&$output) { $output[] = 'info: ' . $description; }); $this->prepareSettings('/tmp/oc-autotest/datadir', $this->getUniqueID('user_')); $this->assertNotEquals('yes', $this->config->getAppValue('core', 'repairlegacystoragesdone')); $this->repair->run(); $this->assertEquals(1, count($output)); $this->assertEquals('yes', $this->config->getAppValue('core', 'repairlegacystoragesdone')); $output = array(); $this->repair->run(); // no output which means it did not run $this->assertEquals(0, count($output)); $this->assertEquals('yes', $this->config->getAppValue('core', 'repairlegacystoragesdone')); }