You are here

protected function UbercartTestBase::createProductClass in Ubercart 8.4

Creates a new product class.

Fix this after adding a proper API call for saving a product class.

Parameters

array $data: (optional) An associative array with possible keys of 'type', 'name', and 'description' to initialize the product class.

Return value

\Drupal\node\NodeInterface Product node object.

1 call to UbercartTestBase::createProductClass()
CartLinksTest::createCartLinksProduct in uc_cart_links/src/Tests/CartLinksTest.php
Creates a product with all attribute types and options.

File

uc_store/src/Tests/UbercartTestBase.php, line 232

Class

UbercartTestBase
Base class for Ubercart Simpletest tests.

Namespace

Drupal\uc_store\Tests

Code

protected function createProductClass(array $data = []) {
  $class = strtolower($this
    ->randomMachineName(12));
  $edit = $data + [
    'type' => $class,
    'name' => $class,
    'description' => $this
      ->randomMachineName(32),
    'uc_product[product]' => TRUE,
  ];
  $this
    ->drupalPostForm('admin/structure/types/add', $edit, t('Save content type'));
  return node_type_load($class);
}