You are here

public function BillingScheduleTest::testBillingScheduleDeletion in Commerce Recurring Framework 8

Tests deleting a billing schedule.

File

tests/src/FunctionalJavascript/BillingScheduleTest.php, line 197

Class

BillingScheduleTest
Tests the billing schedule UI.

Namespace

Drupal\Tests\commerce_recurring\FunctionalJavascript

Code

public function testBillingScheduleDeletion() {
  $billing_schedule = BillingSchedule::create([
    'id' => 'test',
    'label' => 'Test',
    'displayLabel' => 'Awesome test',
    'billingType' => BillingScheduleInterface::BILLING_TYPE_POSTPAID,
    'plugin' => 'fixed',
    'configuration' => [
      'interval' => [
        'number' => '2',
        'unit' => 'month',
      ],
    ],
  ]);
  $billing_schedule
    ->save();
  $this
    ->drupalGet('admin/commerce/config/billing-schedules/manage/' . $billing_schedule
    ->id() . '/delete');
  $this
    ->submitForm([], 'Delete');
  $this
    ->assertSession()
    ->addressEquals('admin/commerce/config/billing-schedules');
  $billing_schedule_exists = (bool) BillingSchedule::load('test');
  $this
    ->assertEmpty($billing_schedule_exists);
}