You are here

public function PriceEqualsTest::testPriceItemListNotEquals in Commerce Core 8.2

Tests an expected unequal amount is not equal.

File

modules/price/tests/src/Kernel/PriceEqualsTest.php, line 73

Class

PriceEqualsTest
Tests that price item list `equals` works as expected.

Namespace

Drupal\Tests\commerce_price\Kernel

Code

public function testPriceItemListNotEquals() {

  /** @var \Drupal\commerce_product\Entity\ProductVariationInterface $variation1 */
  $variation1 = ProductVariation::create([
    'type' => 'default',
    'sku' => strtolower($this
      ->randomMachineName()),
    'price' => new Price('13.00', 'USD'),
  ]);
  $variation1
    ->save();

  /** @var \Drupal\commerce_product\Entity\ProductVariationInterface $variation2 */
  $variation2 = ProductVariation::create([
    'type' => 'default',
    'sku' => 'TEST_' . strtolower($this
      ->randomMachineName()),
    'price' => new Price('12', 'USD'),
  ]);
  $variation2
    ->save();
  $this
    ->assertFalse($variation1
    ->get('price')
    ->equals($variation2
    ->get('price')));
}