public function PaymentLineItemBaseTest::testGetTotalAmount in Payment 8.2
@covers ::getTotalAmount
File
- tests/
src/ Unit/ Plugin/ Payment/ LineItem/ PaymentLineItemBaseTest.php, line 62
Class
- PaymentLineItemBaseTest
- @coversDefaultClass \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemBase
Namespace
Drupal\Tests\payment\Unit\Plugin\Payment\LineItemCode
public function testGetTotalAmount() {
$amount = 7;
$quantity = 7;
$total_amount = bcmul($amount, $quantity, 6);
$configuration = [];
$plugin_id = $this
->randomMachineName();
$plugin_definition = [];
/** @var \Drupal\payment\Plugin\Payment\LineItem\Basic|\PHPUnit\Framework\MockObject\MockObject $line_item */
$line_item = $this
->getMockBuilder(PaymentLineItemBase::class)
->setMethods(array(
'formElements',
'getAmount',
'getConfigurationFromFormValues',
'getCurrencyCode',
'getDescription',
'getQuantity',
))
->setConstructorArgs(array(
$configuration,
$plugin_id,
$plugin_definition,
))
->getMock();
$line_item
->expects($this
->once())
->method('getAmount')
->willReturn($amount);
$line_item
->expects($this
->once())
->method('getQuantity')
->willReturn($quantity);
$this
->assertSame($total_amount, $line_item
->getTotalAmount());
}