public function DefaultPaymentAdminTest::testPaymentTab in Commerce Core 8.2
Tests the Payments tab.
File
- modules/
payment/ tests/ src/ Functional/ DefaultPaymentAdminTest.php, line 135
Class
- DefaultPaymentAdminTest
- Tests the admin UI for payments of type 'payment_default'.
Namespace
Drupal\Tests\commerce_payment\FunctionalCode
public function testPaymentTab() {
// Confirm that the tab is visible on the order page.
$this
->drupalGet($this->order
->toUrl());
$this
->assertSession()
->linkExists('Payments');
$this
->assertSession()
->linkByHrefExists($this->paymentUri);
// Confirm that a payment is visible.
$this
->createEntity('commerce_payment', [
'payment_gateway' => $this->paymentGateway
->id(),
'payment_method' => $this->paymentMethod
->id(),
'order_id' => $this->order
->id(),
'amount' => new Price('10', 'USD'),
]);
$this
->drupalGet($this->paymentUri);
$this
->assertSession()
->pageTextContains('$10.00');
$this
->assertSession()
->pageTextContains($this->paymentGateway
->label());
// Confirm that the payment is visible even if the gateway was deleted.
$this->paymentGateway
->delete();
$this
->drupalGet($this->paymentUri);
$this
->assertSession()
->pageTextContains('$10.00');
$this
->assertSession()
->pageTextNotContains($this->paymentGateway
->label());
}