Ejemplo n.º 1
0
 public function setUp()
 {
     $this->objectManager = Bootstrap::getObjectManager();
     $this->scopeConfig = $this->objectManager->create('Magento\\Framework\\App\\MutableScopeConfig');
     $this->scopeConfig->setValue(Observer::IMPORT_ENABLE, 1, ScopeInterface::SCOPE_STORE);
     $this->scopeConfig->setValue(Observer::CRON_STRING_PATH, 'cron-string-path', ScopeInterface::SCOPE_STORE);
     $this->scopeConfig->setValue(Observer::IMPORT_SERVICE, 'webservicex', ScopeInterface::SCOPE_STORE);
     $this->configResource = $this->objectManager->get('Magento\\Config\\Model\\ResourceModel\\Config');
     $this->configResource->saveConfig($this->baseCurrencyPath, $this->baseCurrency, ScopeInterface::SCOPE_STORE, 0);
     $this->observer = $this->objectManager->create('Magento\\Directory\\Model\\Observer');
 }
Ejemplo n.º 2
0
 /**
  * @param \Magento\Framework\Object $input
  * @param float $expectOutputPrice
  * @param string[] $configs
  * @param string $productClassName
  *
  * @magentoDataFixture Magento/Catalog/_files/products.php
  * @magentoDataFixture Magento/Customer/_files/customer.php
  * @magentoDataFixture Magento/Customer/_files/customer_address.php
  * @magentoDbIsolation enabled
  * @dataProvider getPriceDataProvider
  */
 public function testGetPrice($input, $expectOutputPrice, $configs = [], $productClassName = 'DefaultProductClass')
 {
     $this->setUpDefaultRules();
     $fixtureProductId = 1;
     /** @var \Magento\Catalog\Model\Product $product */
     $product = $this->objectManager->create('Magento\\Catalog\\Model\\Product')->load($fixtureProductId);
     $product->setTaxClassId($this->taxClasses[$productClassName]);
     $shippingAddress = $this->getCustomerAddress();
     $billingAddress = $shippingAddress;
     foreach ($configs as $config) {
         $this->scopeConfig->setValue($config['path'], $config['value'], ScopeInterface::SCOPE_STORE, 'default');
     }
     $price = $this->helper->getPrice($product, $input->getPrice(), $input->getIncludingTax(), $shippingAddress, $billingAddress, $this->taxClasses['DefaultCustomerClass'], $input->getStore(), $input->getPriceIncludesTax(), $input->getRoundPrice());
     $this->assertEquals($expectOutputPrice, $price);
 }
Ejemplo n.º 3
0
 /**
  * @param  string $path
  * @return mixed
  */
 public function getStoreConfig($path)
 {
     return $this->_config->getValue(self::BASE . $path, self::SCOPE);
 }