Пример #1
0
 /**
  * @dataProvider fetchDataProvider
  */
 public function testFetch($shippingAmount, $shippingDescription, $expectedTotal)
 {
     $address = $this->getMock('Magento\\Quote\\Model\\Quote\\Address', ['getShippingAmount', 'getShippingDescription', 'addTotal', '__wakeup'], [], '', false);
     $address->expects($this->once())->method('getShippingAmount')->will($this->returnValue($shippingAmount));
     $address->expects($this->once())->method('getShippingDescription')->will($this->returnValue($shippingDescription));
     $address->expects($this->once())->method('addTotal')->with($this->equalTo($expectedTotal))->will($this->returnSelf());
     $this->assertEquals($this->shippingModel, $this->shippingModel->fetch($address));
 }
Пример #2
0
 public function testFetch()
 {
     $shippingAmount = 100;
     $shippingDescription = 100;
     $expectedResult = ['code' => 'shipping', 'value' => 100, 'title' => __('Shipping & Handling (%1)', $shippingDescription)];
     $quoteMock = $this->getMock('\\Magento\\Quote\\Model\\Quote', [], [], '', false);
     $totalMock = $this->getMock('\\Magento\\Quote\\Model\\Quote\\Address\\Total', ['getShippingAmount', 'getShippingDescription'], [], '', false);
     $totalMock->expects($this->once())->method('getShippingAmount')->willReturn($shippingAmount);
     $totalMock->expects($this->once())->method('getShippingDescription')->willReturn($shippingDescription);
     $this->assertEquals($expectedResult, $this->shippingModel->fetch($quoteMock, $totalMock));
 }