You are here

public function CommerceMigrateTestTrait::assertPrice in Commerce Migrate 3.1.x

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/CommerceMigrateTestTrait.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrateTestTrait::assertPrice()
  2. 3.0.x tests/src/Kernel/CommerceMigrateTestTrait.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrateTestTrait::assertPrice()

Assert a price.

Parameters

\Drupal\commerce_price\Price $expected: The expected price.

\Drupal\commerce_price\Price $actual: The actual price.

1 call to CommerceMigrateTestTrait::assertPrice()
CommerceMigrateTestTrait::assertAdjustment in tests/src/Kernel/CommerceMigrateTestTrait.php
Assert an adjustment.

File

tests/src/Kernel/CommerceMigrateTestTrait.php, line 430

Class

CommerceMigrateTestTrait
Helper function to test migrations.

Namespace

Drupal\Tests\commerce_migrate\Kernel

Code

public function assertPrice(Price $expected, Price $actual) {
  $formatted_number = $this
    ->formatNumber($expected
    ->getNumber(), $actual
    ->getNumber());
  $this
    ->assertSame($formatted_number['expected'], $formatted_number['actual']);
  $this
    ->assertSame($expected
    ->getCurrencyCode(), $actual
    ->getCurrencyCode());
}