You are here

public function ProductKitTest::testUcFormAlter in Ubercart 8.4

Verify uc_product_kit_uc_form_alter() doesn't break catalog view.

See also

https://www.drupal.org/project/ubercart/issues/2932702

File

uc_product_kit/tests/src/Functional/ProductKitTest.php, line 306

Class

ProductKitTest
Tests product kit functionality.

Namespace

Drupal\Tests\uc_product_kit\Functional

Code

public function testUcFormAlter() {

  /** @var \Drupal\Tests\WebAssert $assert */
  $assert = $this
    ->assertSession();
  $this
    ->drupalLogin($this->adminUser);
  $term = $this
    ->createCatalogTerm();
  $product = $this
    ->createProduct([
    'taxonomy_catalog' => [
      $term
        ->id(),
    ],
  ]);
  $this
    ->drupalGet('catalog');
  $assert
    ->linkExists($term
    ->label(), 0, 'The term is listed in the catalog.');

  // Clicking this link generates a fatal error if the BuyItNowForm form
  // element 'node' does not exist.
  $this
    ->clickLink($term
    ->label());
  $assert
    ->linkExists($product
    ->label(), 0, 'The product is listed in the catalog.');
}