You are here

public function CatalogBlockTest::testTitleLink in Ubercart 8.4

Tests the optional block title link to catalog page functionality.

File

uc_catalog/tests/src/Functional/CatalogBlockTest.php, line 83

Class

CatalogBlockTest
Tests the catalog block functionality.

Namespace

Drupal\Tests\uc_catalog\Functional

Code

public function testTitleLink() {

  /** @var \Drupal\Tests\WebAssert $assert */
  $assert = $this
    ->assertSession();

  // Title link is turned off by default.
  $this
    ->drupalGet('');
  $assert
    ->pageTextContains($this->block
    ->label());
  $assert
    ->linkNotExists($this->block
    ->label(), 0, 'The block title is not a link.');
  $assert
    ->linkByHrefNotExists('catalog', 0, 'The block title is not linked to the catalog page.');

  // Turn on title link.
  $this->block
    ->getPlugin()
    ->setConfigurationValue('link_title', TRUE);
  $this->block
    ->save();

  // Verify title is now linked.
  $this
    ->drupalGet('');
  $assert
    ->linkExists($this->block
    ->label(), 0, 'The block title is a link.');
  $assert
    ->linkByHrefExists('catalog', 0, 'The block title is linked to the catalog page.');
}