You are here

public function HierarchicalTaxonomyMenuImageTest::testBlockImageStyles in Hierarchical Taxonomy Menu 8

Tests image styles.

File

tests/src/Functional/HierarchicalTaxonomyMenuImageTest.php, line 167

Class

HierarchicalTaxonomyMenuImageTest
Tests the Hierarchical Taxonomy Menu images.

Namespace

Drupal\Tests\hierarchical_taxonomy_menu\Functional

Code

public function testBlockImageStyles() {
  $this->block
    ->set('settings', [
    'label' => 'Hierarchical Taxonomy Menu',
    'label_display' => 'visible',
    'vocabulary' => $this->vocabulary
      ->id() . '|field_icon',
    'collapsible' => FALSE,
    'use_image_style' => TRUE,
    'image_style' => 'medium',
  ])
    ->save();
  $this
    ->drupalGet('<front>');
  $image1 = $this
    ->getSession()
    ->getPage()
    ->find('css', '.hierarchical-taxonomy-menu li:first-child img');
  $this
    ->assertStringContainsString('files/styles/medium', $image1
    ->getAttribute('src'));
  $image2 = $this
    ->getSession()
    ->getPage()
    ->find('css', '.hierarchical-taxonomy-menu li:last-child img');
  $this
    ->assertStringContainsString('files/styles/medium', $image2
    ->getAttribute('src'));
}