/** * @dataProvider isLoadedDataProvider * @param bool $expected */ public function testIsCacheLoaded($expected) { $url = 'http://test.local'; $path = $this->manager->getCachedWsdlPath($url); $this->fs->expects($this->once())->method('exists')->with($path)->will($this->returnValue($expected)); $this->assertEquals($expected, $this->manager->isCacheLoaded($url)); }
/** * {@inheritdoc} */ public function init(Transport $transportEntity) { /** * Cache WSDL and force transport entity to use it instead of original URL. * This should be done before parent::init as settings will be cached there. */ if ($transportEntity instanceof MagentoSoapTransport) { $wsdlUrl = $transportEntity->getWsdlUrl(); // Save auth information to be able to perform requests. $urlParts = parse_url($wsdlUrl); if (isset($urlParts['user'], $urlParts['pass'])) { $this->auth['login'] = $urlParts['user']; $this->auth['password'] = $urlParts['pass']; } // Load WSDL to local cache. if (!$this->wsdlManager->isCacheLoaded($wsdlUrl)) { $this->wsdlManager->loadWsdl($wsdlUrl); } // Set cached WSDL path to transport entity. $transportEntity->setWsdlCachePath($this->wsdlManager->getCachedWsdlPath($wsdlUrl)); } parent::init($transportEntity); $wsiMode = $this->settings->get('wsi_mode', false); $apiUser = $this->settings->get('api_user', false); $apiKey = $this->settings->get('api_key', false); $apiKey = $this->encoder->decryptData($apiKey); if (!$apiUser || !$apiKey) { throw new InvalidConfigurationException("Magento SOAP transport require 'api_key' and 'api_user' settings to be defined."); } // revert initial state $this->isExtensionInstalled = null; $this->adminUrl = null; $this->isWsiMode = $wsiMode; /** @var string sessionId returned by Magento API login method */ $this->sessionId = null; $this->sessionId = $this->call('login', ['username' => $apiUser, 'apiKey' => $apiKey]); $this->checkExtensionFunctions(); }