public function testGetConfig() { $storeMock = $this->getMock('\\Magento\\Store\\Model\\Store', [], [], '', false); $shoppingCartUrl = 'http://url.com/cart'; $checkoutUrl = 'http://url.com/checkout'; $updateItemQtyUrl = 'http://url.com/updateItemQty'; $removeItemUrl = 'http://url.com/removeItem'; $baseUrl = 'http://url.com/'; $imageTemplate = 'Magento_Catalog/product/image_with_borders'; $expectedResult = ['shoppingCartUrl' => $shoppingCartUrl, 'checkoutUrl' => $checkoutUrl, 'updateItemQtyUrl' => $updateItemQtyUrl, 'removeItemUrl' => $removeItemUrl, 'imageTemplate' => $imageTemplate, 'baseUrl' => $baseUrl]; $valueMap = [['checkout/cart', [], $shoppingCartUrl], ['checkout', [], $checkoutUrl], ['checkout/sidebar/updateItemQty', [], $updateItemQtyUrl], ['checkout/sidebar/removeItem', [], $removeItemUrl]]; $this->urlBuilderMock->expects($this->exactly(4))->method('getUrl')->willReturnMap($valueMap); $this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($storeMock); $storeMock->expects($this->once())->method('getBaseUrl')->willReturn($baseUrl); $this->viewMock->expects($this->once())->method('isWhiteBorders')->willReturn(false); $this->assertEquals($expectedResult, $this->model->getConfig()); }
/** * {@inheritdoc} */ public function getConfig() { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getConfig'); if (!$pluginInfo) { return parent::getConfig(); } else { return $this->___callPlugins('getConfig', func_get_args(), $pluginInfo); } }
public function testGetConfig() { $storeMock = $this->getMock('\\Magento\\Store\\Model\\Store', [], [], '', false); $shoppingCartUrl = 'http://url.com/cart'; $checkoutUrl = 'http://url.com/checkout'; $updateItemQtyUrl = 'http://url.com/updateItemQty'; $removeItemUrl = 'http://url.com/removeItem'; $baseUrl = 'http://url.com/'; $imageTemplate = 'Magento_Catalog/product/image_with_borders'; $expectedResult = ['shoppingCartUrl' => $shoppingCartUrl, 'checkoutUrl' => $checkoutUrl, 'updateItemQtyUrl' => $updateItemQtyUrl, 'removeItemUrl' => $removeItemUrl, 'imageTemplate' => $imageTemplate, 'baseUrl' => $baseUrl, 'minicartMaxItemsVisible' => 3]; $valueMap = [['checkout/cart', [], $shoppingCartUrl], ['checkout', [], $checkoutUrl], ['checkout/sidebar/updateItemQty', ['_secure' => false], $updateItemQtyUrl], ['checkout/sidebar/removeItem', ['_secure' => false], $removeItemUrl]]; $this->requestMock->expects($this->any())->method('isSecure')->willReturn(false); $this->urlBuilderMock->expects($this->exactly(4))->method('getUrl')->willReturnMap($valueMap); $this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($storeMock); $storeMock->expects($this->once())->method('getBaseUrl')->willReturn($baseUrl); $this->imageHelper->expects($this->once())->method('getFrame')->willReturn(false); $this->scopeConfigMock->expects($this->once())->method('getValue')->with(\Magento\Checkout\Block\Cart\Sidebar::XML_PATH_CHECKOUT_SIDEBAR_COUNT, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)->willReturn(3); $this->assertEquals($expectedResult, $this->model->getConfig()); }