You are here

public function LineItemCollectionTest::testConstruct in Payment 8.2

@covers ::__construct @covers ::getLineItem @covers ::getLineItems

File

tests/src/Unit/LineItemCollectionTest.php, line 70

Class

LineItemCollectionTest
@coversDefaultClass \Drupal\payment\LineItemCollection

Namespace

Drupal\Tests\payment\Unit

Code

public function testConstruct() {
  $this->sut = new LineItemCollection($this->currencyCode, $this->lineItems);

  // Test that all line items can be retrieved individually after they have
  // been injected through the constructor.
  foreach ($this->lineItems as $name => $line_item) {
    $this
      ->assertSame($line_item, $this->sut
      ->getLineItem($name));
  }

  // Test that all line items can be retrieved after they have been injected
  // through the constructor.
  $this
    ->assertSame($this->lineItems, $this->sut
    ->getLineItems());

  // Test that the currency code can be retrieved after it has been injected
  // through the constructor.
  $this
    ->assertSame($this->currencyCode, $this->sut
    ->getCurrencyCode());
}