/** * Test Soap server construction with WSDL cache disabling. */ public function testConstructDisableWsdlCache() { /** Mock getConfig method to return false. */ $this->_storeMock->expects($this->any())->method('getConfig')->will($this->returnValue(false)); /** Create Soap server object. */ $server = new Mage_Webapi_Model_Soap_Server($this->_applicationMock, $this->_requestMock, $this->_domDocumentFactory); $server->initWsdlCache(); /** Assert soap wsdl caching option was disabled after soap server initialization. */ $this->assertFalse((bool) ini_get('soap.wsdl_cache_enabled'), 'WSDL caching was not disabled.'); }
/** * Test getEndpointUri method. */ public function testGetEndpointUri() { $this->_storeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue('http://magento.com/')); $expectedResult = 'http://magento.com/' . Mage_Webapi_Controller_Router_Route_Webapi::API_AREA_NAME . '/' . Mage_Webapi_Controller_Front::API_TYPE_SOAP; $actualResult = $this->_soapServer->getEndpointUri(); $this->assertEquals($expectedResult, $actualResult, 'Wrong endpoint URI building.'); }
public function setUp() { $this->_realCoreHelper = Mage::helper('eb2ccore'); $this->_doc = $this->_realCoreHelper->getNewDomDocument(); $this->_coreHelper = $this->getHelperMock('eb2ccore/data', array('getConfigModel', 'triggerError', 'parseBool', 'getNewDomDocument')); $this->_docMock = $this->getMockBuilder('EbayEnterprise_Dom_Document')->disableOriginalConstructor()->setMethods(array('save', 'loadXML', 'importNode'))->getMock(); $this->_pimProductCollection = $this->getModelMockBuilder('ebayenterprise_catalog/pim_product_collection')->disableOriginalConstructor()->setMethods(array('count', 'getItems'))->getMock(); $this->_feedTypeConfig = $this->_stubFeedConfig(); $this->_productIdCollection = new Varien_Data_Collection(); $this->_productIdCollection->addItem(new Varien_Object(array('id' => 1, 'entity_id' => 1))); $this->_emptyBatch = Mage::getModel('ebayenterprise_catalog/pim_batch'); $batchClass = 'EbayEnterprise_Catalog_Model_Pim_Batch'; $this->_defaultStore = $this->getModelMockBuilder('core/store')->disableOriginalConstructor()->setMethods(array('getId'))->getMock(); $this->_defaultStore->expects($this->any())->method('getId')->will($this->returnValue(0)); $this->_store = $this->getModelMockBuilder('core/store')->disableOriginalConstructor()->setMethods(array('getId'))->getMock(); $this->_store->expects($this->any())->method('getId')->will($this->returnValue(1)); $this->_storesArray = array(0 => $this->_defaultStore, 1 => $this->_store); $this->_batch = Mage::getModel('ebayenterprise_catalog/pim_batch', array($batchClass::COLLECTION_KEY => $this->_productIdCollection, $batchClass::STORES_KEY => array(1 => $this->_store), $batchClass::FT_CONFIG_KEY => $this->_feedTypeConfig, $batchClass::DEFAULT_STORE_KEY => $this->_defaultStore)); $this->_coreFeed = $this->getModelMockBuilder('ebayenterprise_catalog/feed_core')->disableOriginalConstructor()->setMethods(array('getLocalDirectory'))->getMock(); $this->_prodHelper = $this->getHelperMockBuilder('ebayenterprise_catalog/data')->disableOriginalConstructor()->setMethods(array('generateFileName'))->getMock(); // suppressing the real session from starting $session = $this->getModelMockBuilder('core/session')->disableOriginalConstructor()->setMethods(null)->getMock(); $this->replaceByMock('singleton', 'core/session', $session); }
public function testGetCurrentUrl() { $this->_model->expects($this->any())->method('getUrl')->will($this->returnValue('http://localhost/index.php')); $this->assertStringEndsWith('default', $this->_model->getCurrentUrl()); $this->assertStringEndsNotWith('default', $this->_model->getCurrentUrl(false)); }