コード例 #1
0
 /**
  * @param string $action
  * @dataProvider dataProviderActions
  */
 public function testProcessShippingAmountActions($action)
 {
     $discountAmount = 50;
     $ruleMock = $this->getMockBuilder('Magento\\SalesRule\\Model\\Rule')->disableOriginalConstructor()->setMethods(['getApplyToShipping', 'getSimpleAction', 'getDiscountAmount'])->getMock();
     $ruleMock->expects($this->any())->method('getApplyToShipping')->willReturn(true);
     $ruleMock->expects($this->any())->method('getDiscountAmount')->willReturn($discountAmount);
     $ruleMock->expects($this->any())->method('getSimpleAction')->willReturn($action);
     $iterator = new \ArrayIterator([$ruleMock]);
     $this->ruleCollection->expects($this->any())->method('getIterator')->willReturn($iterator);
     $this->utility->expects($this->any())->method('canProcessRule')->willReturn(true);
     $this->model->init($this->model->getWebsiteId(), $this->model->getCustomerGroupId(), $this->model->getCouponCode());
     $this->assertInstanceOf('Magento\\SalesRule\\Model\\Validator', $this->model->processShippingAmount($this->getAddressMock(5)));
 }
コード例 #2
0
ファイル: Collection.php プロジェクト: aiesh/magento2
 /**
  * Add websites for load
  *
  * @return $this
  */
 public function _initSelect()
 {
     parent::_initSelect();
     $this->addWebsitesToResult();
     return $this;
 }