public function ProductVariationTypeTest::testAdd in Commerce Core 8.2
Tests adding a product variation type.
File
- modules/product/ tests/ src/ Functional/ ProductVariationTypeTest.php, line 45 
Class
- ProductVariationTypeTest
- Tests the product variation type UI.
Namespace
Drupal\Tests\commerce_product\FunctionalCode
public function testAdd() {
  $this
    ->drupalGet('admin/commerce/config/product-variation-types/add');
  $edit = [
    'id' => strtolower($this
      ->randomMachineName(8)),
    'label' => 'Clothing',
    'orderItemType' => 'default',
  ];
  $this
    ->submitForm($edit, t('Save'));
  $this
    ->assertSession()
    ->pageTextContains('Saved the Clothing product variation type.');
  $variation_type = ProductVariationType::load($edit['id']);
  $this
    ->assertNotEmpty($variation_type);
  $this
    ->assertEquals('Clothing', $variation_type
    ->label());
  $this
    ->assertEquals('default', $variation_type
    ->getOrderItemTypeId());
}