You are here

public function CatalogTest::testCatalogNode in Ubercart 8.4

Tests the catalog from the node page.

File

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

Class

CatalogTest
Tests for the Ubercart catalog.

Namespace

Drupal\Tests\uc_catalog\Functional

Code

public function testCatalogNode() {

  /** @var \Drupal\Tests\WebAssert $assert */
  $assert = $this
    ->assertSession();
  $this
    ->drupalLogin($this->adminUser);
  $term = $this
    ->createCatalogTerm();
  $product = $this
    ->createProduct([
    'taxonomy_catalog' => [
      $term
        ->id(),
    ],
  ]);
  $this
    ->drupalGet('node/' . $product
    ->id());
  $assert
    ->linkExists($term
    ->label(), 0, 'The product links back to the catalog term.');
  $assert
    ->linkByHrefExists('/catalog/' . $term
    ->id(), 0, 'The product links back to the catalog view.');
}