Esempio n. 1
0
 public function testAroundDispatch()
 {
     $this->moduleManagerMock->expects($this->any())->method('isEnabled')->with('Magento_PageCache')->willReturn(true);
     $this->cacheConfigMock->expects($this->any())->method('isEnabled')->willReturn(true);
     $this->taxHelperMock->expects($this->any())->method('isCatalogPriceDisplayAffectedByTax')->willReturn(true);
     $this->customerSessionMock->expects($this->once())->method('getDefaultTaxBillingAddress')->willReturn(['country_id' => 1, 'region_id' => null, 'postcode' => 11111]);
     $this->customerSessionMock->expects($this->once())->method('getDefaultTaxShippingAddress')->willReturn(['country_id' => 1, 'region_id' => null, 'postcode' => 11111]);
     $this->customerSessionMock->expects($this->once())->method('getCustomerTaxClassId')->willReturn(1);
     $this->taxCalculationMock->expects($this->once())->method('getTaxRates')->with(['country_id' => 1, 'region_id' => null, 'postcode' => 11111], ['country_id' => 1, 'region_id' => null, 'postcode' => 11111], 1)->willReturn([]);
     $this->httpContextMock->expects($this->once())->method('setValue')->with('tax_rates', [], 0);
     $action = $this->objectManager->getObject('Magento\\Framework\\App\\Action\\Action');
     $request = $this->getMock('\\Magento\\Framework\\App\\Request\\Http', ['getActionName'], [], '', false);
     $expectedResult = 'expectedResult';
     $proceed = function ($request) use($expectedResult) {
         return $expectedResult;
     };
     $this->contextPlugin->aroundDispatch($action, $proceed, $request);
 }