public function InvoiceTypeTest::testEdit in Commerce Invoice 8.2
Tests editing an invoice type.
File
- tests/
src/ FunctionalJavascript/ InvoiceTypeTest.php, line 72
Class
- InvoiceTypeTest
- Tests the invoice type UI.
Namespace
Drupal\Tests\commerce_invoice\FunctionalJavascriptCode
public function testEdit() {
$this
->drupalGet('admin/commerce/config/invoice-types/default/edit');
$edit = [
'label' => 'Default!',
'footerText' => $this
->randomString(),
'paymentTerms' => $this
->randomString(),
'dueDays' => 15,
];
$this
->submitForm($edit, 'Save');
$this
->assertSession()
->pageTextContains('Saved the Default! invoice type.');
$invoice_type = InvoiceType::load('default');
$this
->assertNotEmpty($invoice_type);
$this
->assertEquals($edit['label'], $invoice_type
->label());
$this
->assertEquals($edit['footerText'], $invoice_type
->getFooterText());
$this
->assertEquals($edit['paymentTerms'], $invoice_type
->getPaymentTerms());
$this
->assertEquals($edit['dueDays'], $invoice_type
->getDueDays());
}