You are here

public function PaymentUnitTest::testGetAmount in Payment 8.2

Tests getAmount().

File

tests/src/Kernel/PaymentUnitTest.php, line 190

Class

PaymentUnitTest
\Drupal\payment\Entity\Payment unit test.

Namespace

Drupal\Tests\payment\Kernel

Code

public function testGetAmount() {
  $amount = 3;
  $quantity = 2;
  for ($i = 0; $i < 2; $i++) {

    /** @var \Drupal\payment\Plugin\Payment\LineItem\Basic $line_item */
    $line_item = $this->lineItemManager
      ->createInstance('payment_basic');
    $name = $this
      ->randomMachineName();
    $line_item
      ->setName($name);
    $line_item
      ->setAmount($amount);
    $line_item
      ->setQuantity($quantity);
    $this->payment
      ->setLineItem($line_item);
  }
  $this
    ->assertEqual($this->payment
    ->getAmount(), 12);
}