You are here

public function OrderTypeTest::testEdit in Commerce Core 8.2

Tests editing an order type.

File

modules/order/tests/src/Functional/OrderTypeTest.php, line 54

Class

OrderTypeTest
Tests the order type UI.

Namespace

Drupal\Tests\commerce_order\Functional

Code

public function testEdit() {
  $this
    ->drupalGet('admin/commerce/config/order-types/default/edit');
  $edit = [
    'label' => 'Default!',
    'generate_number' => FALSE,
    'refresh_mode' => 'always',
    'refresh_frequency' => 60,
  ];
  $this
    ->submitForm($edit, 'Save');
  $this
    ->assertSession()
    ->pageTextContains('Saved the Default! order type.');
  $order_type = OrderType::load('default');
  $this
    ->assertNotEmpty($order_type);
  $this
    ->assertEquals($edit['label'], $order_type
    ->label());
  $this
    ->assertEmpty($order_type
    ->getNumberPatternId());
  $this
    ->assertEquals($edit['refresh_mode'], $order_type
    ->getRefreshMode());
  $this
    ->assertEquals($edit['refresh_frequency'], $order_type
    ->getRefreshFrequency());
}