You are here

public function LineItemCollectionTest::testUnsetLineItems in Payment 8.2

@covers ::unsetLineItem @covers ::getLineItem @covers ::getLineItems

File

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

Class

LineItemCollectionTest
@coversDefaultClass \Drupal\payment\LineItemCollection

Namespace

Drupal\Tests\payment\Unit

Code

public function testUnsetLineItems() {
  list($line_item_name_a, $line_item_name_b) = array_keys($this->lineItems);
  $this
    ->assertSame($this->sut, $this->sut
    ->unsetLineItem($line_item_name_a));
  $this
    ->assertNull($this->sut
    ->getLineItem($line_item_name_a));
  $this
    ->assertSame($this->lineItems[$line_item_name_b], $this->sut
    ->getLineItem($line_item_name_b));
  $expected = [
    $line_item_name_b => $this->lineItems[$line_item_name_b],
  ];
  $this
    ->assertSame($expected, $this->sut
    ->getLineItems());
}