You are here

public function AkamaiHomepageTest::testHomepageClear in Akamai 8.3

Tests that Akamai Cache Clear block can clear the homepage.

File

src/Tests/AkamaiHomepageTest.php, line 66

Class

AkamaiHomepageTest
Test the Akamai Homepage Clearing.

Namespace

Drupal\akamai\Tests

Code

public function testHomepageClear() {

  // Set up theme.
  \Drupal::service('theme_handler')
    ->install([
    'bartik',
  ]);
  $theme_settings = $this
    ->config('system.theme');
  foreach ([
    'bartik',
  ] as $theme) {

    // Configure and save the block.
    $this
      ->drupalPlaceBlock('akamai_cache_clear_block', [
      'region' => 'content',
      'theme' => $theme,
    ]);

    // Set the default theme and ensure the block is placed.
    $theme_settings
      ->set('default', $theme)
      ->save();

    // The cache clearing block should pick up the current URL as the clearing
    // target.
    $this
      ->drupalGet($this->homepage);
    $this
      ->assertText($this->homepage, 'The Akamai path field is set correctly');
  }
}