Example #1
0
 /**
  * @return array
  */
 public function getUpdateState()
 {
     $data = $this->updater->check();
     $result = [];
     if (isset($data['version']) && $data['version'] !== '' && $data['version'] !== []) {
         $result['updateAvailable'] = true;
         $result['updateVersion'] = $data['versionstring'];
         if (substr($data['web'], 0, 8) === 'https://') {
             $result['updateLink'] = $data['web'];
         }
         return $result;
     }
     return [];
 }
Example #2
0
 public function testCheckWithEmptyInvalidXmlResponse()
 {
     $expectedResult = [];
     $this->config->expects($this->at(0))->method('getAppValue')->with('core', 'lastupdatedat')->will($this->returnValue(0));
     $this->config->expects($this->at(1))->method('setAppValue')->with('core', 'lastupdatedat', $this->isType('integer'));
     $this->config->expects($this->at(3))->method('getAppValue')->with('core', 'installedat')->will($this->returnValue('installedat'));
     $this->config->expects($this->at(4))->method('getAppValue')->with('core', 'lastupdatedat')->will($this->returnValue('lastupdatedat'));
     $this->config->expects($this->at(5))->method('setAppValue')->with('core', 'lastupdateResult', json_encode($expectedResult));
     $updateXml = '';
     $this->httpHelper->expects($this->once())->method('getUrlContent')->with($this->buildUpdateUrl('https://updates.owncloud.com/server/'))->will($this->returnValue($updateXml));
     $this->assertSame($expectedResult, $this->updater->check());
 }