/** * Note: Not using a dataprovider because onConsecutiveCalls expects not * an array but the function arguments directly */ public function testGetFinalLocationOfURLInvalid() { $url = 'https://www.owncloud.org/enterprise/'; $expected = 'http://www.owncloud.com/enterprise/'; $this->httpHelperMock->expects($this->any())->method('getHeaders')->will($this->onConsecutiveCalls(array('Location' => 'http://www.owncloud.com/enterprise/'), array('Location' => 'file://etc/passwd'), array('Location' => 'http://www.example.com/'))); $result = $this->httpHelperMock->getFinalLocationOfURL($url); $this->assertSame($expected, $result); }
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()); }