You are here

public function FontYourFaceSubmoduleInstallTest::testEnableWebSafeFonts in @font-your-face 8.3

Tests enabling and seeing fonts load.

File

tests/src/Functional/FontYourFaceSubmoduleInstallTest.php, line 90

Class

FontYourFaceSubmoduleInstallTest
Tests that installing @font-your-face submodules is not broken.

Namespace

Drupal\Tests\fontyourface\Functional

Code

public function testEnableWebSafeFonts() {

  // Assert no fonts load to start.
  $this
    ->drupalGet('/node');
  $this
    ->assertNoRaw('<meta name="Websafe Font" content="Arial" />');
  $this
    ->drupalGet(Url::fromRoute('font.settings'));
  $this
    ->submitForm([
    'load_all_enabled_fonts' => 1,
  ], 'Import from websafe_fonts_test');
  $this
    ->drupalGet(url::fromRoute('entity.font.activate', [
    'font' => 1,
    'js' => 'nojs',
  ]));
  $this
    ->assertText('Font Arial successfully enabled');

  // Flush the caches. Not an issue in prod but seems to be in simpletest.
  // Will keep an eye on it.
  $this
    ->resetAll();
  $this
    ->drupalGet('/node');
  $this
    ->assertSession()
    ->responseContains('<meta name="Websafe Font" content="Arial" />');
}