/** * @dataProvider isExtensionInstalledProvider * * @param mixed $isInstalledResult * @param mixed $adminUrlResult * @param mixed $soapResult * @param bool $throwsException */ public function testIsExtensionInstalled($isInstalledResult, $adminUrlResult, $soapResult, $throwsException = false) { $this->initSettings(); if ($throwsException) { $this->soapClientMock->expects($this->at(1))->method('__soapCall')->with(SoapTransport::ACTION_PING, ['sessionId' => $this->sessionId])->will($this->throwException(new \Exception())); } else { $this->soapClientMock->expects($this->at(1))->method('__soapCall')->with(SoapTransport::ACTION_PING, ['sessionId' => $this->sessionId])->will($this->returnValue($soapResult)); } $this->transport->init($this->transportEntity); $result1 = $this->transport->isExtensionInstalled(); $result2 = $this->transport->isExtensionInstalled(); $this->assertSame($result1, $result2, 'All results should be same, and call remote service only once'); $this->assertSame($isInstalledResult, $result1); $result1 = $this->transport->getAdminUrl(); $result2 = $this->transport->getAdminUrl(); $this->assertSame($result1, $result2, 'All results should be same, and call remote service only once'); $this->assertSame($adminUrlResult, $result1); }
/** * @dataProvider isExtensionInstalledProvider * * @param array $functions * @param mixed $isInstalledResult * @param mixed $soapResult * @param mixed $adminUrlResult * @param bool|string $extensionVersion * @param bool|string $magentoVersion */ public function testIsExtensionInstalled(array $functions, $isInstalledResult, $soapResult, $adminUrlResult = false, $extensionVersion = null, $magentoVersion = null) { $this->initSettings(false, $functions); if ($functions) { $this->soapClientMock->expects($this->at(3))->method('__soapCall')->with(SoapTransport::ACTION_PING, ['sessionId' => $this->sessionId])->will($this->returnValue($soapResult)); } $this->transport->init($this->transportEntity); $result1 = $this->transport->isExtensionInstalled(); $result2 = $this->transport->isExtensionInstalled(); $this->assertSame($result1, $result2, 'All results should be same, and call remote service only once'); $this->assertSame($isInstalledResult, $result1, 'Is installed is not correct'); $result1 = $this->transport->getAdminUrl(); $result2 = $this->transport->getAdminUrl(); $this->assertSame($result1, $result2, 'All results should be same, and call remote service only once'); $this->assertSame($adminUrlResult, $result1); $result1 = $this->transport->getExtensionVersion(); $result2 = $this->transport->getExtensionVersion(); $this->assertSame($result1, $result2, 'All results should be same, and call remote service only once'); $this->assertSame($extensionVersion, $result1, 'Extension version is not correct'); $result1 = $this->transport->getMagentoVersion(); $result2 = $this->transport->getMagentoVersion(); $this->assertSame($result1, $result2, 'All results should be same, and call remote service only once'); $this->assertSame($magentoVersion, $result1, 'Magento version is not correct'); }