Same name in other branches
  1. 5.0.x advagg_cdn/tests/src/Functional/CdnTest.php \Drupal\Tests\advagg_cdn\Functional\CdnTest::testCdn()
  2. 8.x-3.x advagg_cdn/tests/src/Functional/CdnTest.php \Drupal\Tests\advagg_cdn\Functional\CdnTest::testCdn()

Test the cdn functionality and settings configuration.

Fichier

advagg_cdn/tests/src/Functional/CdnTest.php, line 27

Classe

CdnTest
Tests that AdvAgg CDN changes are properly applied.

Namespace

Drupal\Tests\advagg_cdn\Functional

Code

public function testCdn() {
    // Load config form and ensure jQuery js is being modified.
    $this->drupalGet(Url::fromRoute('advagg_cdn.settings'));
    $session = $this->assertSession();
    $session->statusCodeEquals(200);
    $session->responseContains('src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"');
    $session->responseNotContains('jquery-ui.min.css');
    // Test config form function, enable cdn for jQueryUI, disable minification.
    $edit = [
        'jquery_ui_css' => TRUE,
        'minified' => FALSE,
    ];
    $this->submitForm($edit, $this->t('Save configuration'));
    $session = $this->assertSession();
    $session->responseNotContains('jquery.min.js');
    $this->assertTrue($this->config('advagg_cdn.settings')
        ->get('jquery_ui_css'));
    $session->responseContains('jquery.js');
    $session->responseContains('jquery-ui.css');
}