public function FontYourFaceSubmoduleInstallTest::testImportWebSafeFonts in @font-your-face 8.3
Tests importing fonts from websafe_fonts_test.
File
- tests/
src/ Functional/ FontYourFaceSubmoduleInstallTest.php, line 59
Class
- FontYourFaceSubmoduleInstallTest
- Tests that installing @font-your-face submodules is not broken.
Namespace
Drupal\Tests\fontyourface\FunctionalCode
public function testImportWebSafeFonts() {
// Assert no fonts exist to start.
$this
->drupalGet(Url::fromRoute('entity.font.collection'));
$this
->assertNoText('Arial');
$this
->drupalGet(Url::fromRoute('font.settings'));
$this
->submitForm([], 'Import from websafe_fonts_test');
$this
->assertResponse(200);
$this
->assertText(t('Finished importing fonts.'));
// Assert all fonts were imported.
$this
->drupalGet(Url::fromRoute('entity.font.collection'));
$this
->assertText('Arial');
$this
->assertText('Verdana');
$this
->assertText('Courier New');
$this
->assertText('Georgia');
// Assert fonts load on font collection page.
$this
->assertSession()
->responseContains('<meta name="Websafe Font" content="Arial" />');
$this
->assertSession()
->responseContains('<meta name="Websafe Font" content="Courier New" />');
$this
->assertSession()
->responseContains('<meta name="Websafe Font" content="Georgia" />');
$this
->assertSession()
->responseContains('<meta name="Websafe Font" content="Verdana" />');
// ENsure font is not loaded on front page because font is not enabled.
$this
->drupalGet('<front>');
$this
->assertNoRaw('<meta name="Websafe Font" content="Arial" />');
}