You are here

public function CatalogTest::testCatalogField in Ubercart 8.4

Tests the catalog taxonomy field.

File

uc_catalog/tests/src/Functional/CatalogTest.php, line 106

Class

CatalogTest
Tests for the Ubercart catalog.

Namespace

Drupal\Tests\uc_catalog\Functional

Code

public function testCatalogField() {

  /** @var \Drupal\Tests\WebAssert $assert */
  $assert = $this
    ->assertSession();
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/structure/taxonomy/manage/catalog/overview/fields');

  // Check that the catalog term image field exists.
  $assert
    ->pageTextContains('uc_catalog_image');
  $this
    ->drupalGet('admin/structure/types/manage/product/fields');

  // Check that the catalog taxonomy term reference field exists for products.
  $assert
    ->pageTextContains('taxonomy_catalog');
  $this
    ->drupalGet('node/add/product');

  // Check that catalog taxonomy field is shown on product node form.
  $assert
    ->fieldExists('taxonomy_catalog');

  // Check that product kits get the catalog taxonomy.
  \Drupal::service('module_installer')
    ->install([
    'uc_product_kit',
  ], FALSE);
  $this
    ->drupalGet('admin/structure/types/manage/product_kit/fields');

  // Check that the catalog taxonomy term reference field exists for
  // product kits.
  $assert
    ->pageTextContains('taxonomy_catalog');
}