You are here

public function LineItemCollectionTest::setUp in Payment 8.2

Overrides UnitTestCase::setUp

File

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

Class

LineItemCollectionTest
@coversDefaultClass \Drupal\payment\LineItemCollection

Namespace

Drupal\Tests\payment\Unit

Code

public function setUp() : void {
  $this->currencyCode = $this
    ->randomMachineName();
  $line_item_name_a = $this
    ->randomMachineName();
  $line_item_a = $this
    ->createMock(PaymentLineItemInterface::class);
  $line_item_a
    ->expects($this
    ->atLeastOnce())
    ->method('getName')
    ->willReturn($line_item_name_a);
  $line_item_name_b = $this
    ->randomMachineName();
  $line_item_b = $this
    ->createMock(PaymentLineItemInterface::class);
  $line_item_b
    ->expects($this
    ->atLeastOnce())
    ->method('getName')
    ->willReturn($line_item_name_b);
  $this->lineItems = [
    $line_item_name_a => $line_item_a,
    $line_item_name_b => $line_item_b,
  ];
  $this->sut = new LineItemCollection($this->currencyCode, $this->lineItems);
}