public function testUpdateDbWithException() { $this->databaseConfig->expects($this->once())->method('isAutoUpdate')->willReturn(true); $e = new \Exception(); $this->updaterSelected->expects($this->once())->method('update')->willThrowException($e); $this->logger->expects($this->once())->method('critical')->with($e); $this->assertSame($this->cronUpdateDb, $this->cronUpdateDb->execute()); }
public function testUpdate() { $availableDatabases = ['db_code_1', 'db_code_2', 'db_cod_3']; $countAvailableDatabases = count($availableDatabases); $this->config->expects($this->once())->method('getAvailableDatabases')->willReturn($availableDatabases); $this->updater->expects($this->exactly($countAvailableDatabases))->method('update')->withConsecutive(['db_code_1'], ['db_code_2'], ['db_cod_3']); $this->updaterSelected->update(); }