You are here

public function PriceTest::testGetters in Commerce Core 8.2

Tests the methods for getting the number/currency code in various formats.

::covers getNumber ::covers getCurrencyCode ::covers __toString ::covers toArray.

File

modules/price/tests/src/Unit/PriceTest.php, line 85

Class

PriceTest
Tests the Price class.

Namespace

Drupal\Tests\commerce_price\Unit

Code

public function testGetters() {
  $this
    ->assertEquals('10', $this->price
    ->getNumber());
  $this
    ->assertEquals('USD', $this->price
    ->getCurrencyCode());
  $this
    ->assertEquals('10 USD', $this->price
    ->__toString());
  $this
    ->assertEquals([
    'number' => '10',
    'currency_code' => 'USD',
  ], $this->price
    ->toArray());
}