Пример #1
0
 public function testSaveDeleteConfig()
 {
     $connection = $this->_model->getReadConnection();
     $select = $connection->select()->from($this->_model->getMainTable())->where('path=?', 'test/config');
     $this->_model->saveConfig('test/config', 'test', 'default', 0);
     $this->assertNotEmpty($connection->fetchRow($select));
     $this->_model->deleteConfig('test/config', 'default', 0);
     $this->assertEmpty($connection->fetchRow($select));
 }
Пример #2
0
 public function testUpdateOrderStatusForPaymentMethodsNewState()
 {
     $this->_prepareEventMockWithMethods(['getState', 'getStatus']);
     $this->eventMock->expects($this->once())->method('getState')->will($this->returnValue(\Magento\Sales\Model\Order::STATE_NEW));
     $this->eventMock->expects($this->once())->method('getStatus')->will($this->returnValue(self::ORDER_STATUS));
     $defaultStatus = 'defaultStatus';
     $this->orderConfigMock->expects($this->once())->method('getStateDefaultStatus')->with(\Magento\Sales\Model\Order::STATE_NEW)->will($this->returnValue($defaultStatus));
     $this->paymentConfigMock->expects($this->once())->method('getActiveMethods')->will($this->returnValue($this->_getPreparedActiveMethods()));
     $this->coreResourceConfigMock->expects($this->once())->method('saveConfig')->with('payment/' . self::METHOD_CODE . '/order_status', $defaultStatus, 'default', 0);
     $this->observer->updateOrderStatusForPaymentMethods($this->observerMock);
 }
Пример #3
0
 /**
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function updateOrderStatusForPaymentMethods(\Magento\Framework\Event\Observer $observer)
 {
     if ($observer->getEvent()->getState() != \Magento\Sales\Model\Order::STATE_NEW) {
         return;
     }
     $status = $observer->getEvent()->getStatus();
     $defaultStatus = $this->_salesOrderConfig->getStateDefaultStatus(\Magento\Sales\Model\Order::STATE_NEW);
     $methods = $this->_paymentConfig->getActiveMethods();
     foreach ($methods as $method) {
         if ($method->getConfigData('order_status') == $status) {
             $this->_resourceConfig->saveConfig('payment/' . $method->getCode() . '/order_status', $defaultStatus, 'default', 0);
         }
     }
 }
Пример #4
0
 /**
  * Reset flag for showing tax notifications
  *
  * @param string $path
  * @return \Magento\Tax\Model\Config\Notification
  */
 protected function _resetNotificationFlag($path)
 {
     $this->resourceConfig->saveConfig($path, 0, \Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT, 0);
     return $this;
 }