public function ShipmentManagerTest::testApplyRate in Commerce Shipping 8.2
Tests applying rates.
@covers ::applyRate
File
- tests/src/ Kernel/ ShipmentManagerTest.php, line 180 
Class
- ShipmentManagerTest
- Tests the shipment manager.
Namespace
Drupal\Tests\commerce_shipping\KernelCode
public function testApplyRate() {
  $rates = $this->shipmentManager
    ->calculateRates($this->shipment);
  $this
    ->assertCount(2, $rates);
  /** @var \Drupal\commerce_shipping\ShippingRate $second_rate */
  $second_rate = end($rates);
  $this->shipmentManager
    ->applyRate($this->shipment, $second_rate);
  $this
    ->assertEquals($second_rate
    ->getShippingMethodId(), $this->shipment
    ->getShippingMethodId());
  $this
    ->assertEquals($second_rate
    ->getService()
    ->getId(), $this->shipment
    ->getShippingService());
  $this
    ->assertEquals($second_rate
    ->getOriginalAmount(), $this->shipment
    ->getOriginalAmount());
  $this
    ->assertEquals($second_rate
    ->getAmount(), $this->shipment
    ->getAmount());
}