Same name in other branches
  1. 8.x-3.x advagg_cdn/tests/src/Functional/CdnTest.php \Drupal\Tests\advagg_cdn\Functional\CdnTest
  2. 8.x-4.x advagg_cdn/tests/src/Functional/CdnTest.php \Drupal\Tests\advagg_cdn\Functional\CdnTest

Tests that AdvAgg CDN changes are properly applied.

@group advagg

Hierarchy

  • class \Drupal\Tests\advagg\functional\AdvaggFunctionalTestBase extends \Drupal\Tests\BrowserTestBase uses \Drupal\Core\StringTranslation\StringTranslationTrait
    • class \Drupal\Tests\advagg_cdn\Functional\CdnTest extends \Drupal\Tests\advagg\Functional\AdvaggFunctionalTestBase

Expanded class hierarchy of CdnTest

Sujets associés

Fichier

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

Namespace

Drupal\Tests\advagg_cdn\Functional
View source
class CdnTest extends AdvaggFunctionalTestBase {
    
    /**
     * Modules to enable.
     *
     * @var array
     */
    protected static $modules = [
        'advagg_cdn',
        'advagg_test',
    ];
    
    /**
     * Test the cdn functionality and settings configuration.
     */
    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');
    }

}

Members

Titre Trier par ordre décroissant Modifiers Object type Résumé Overriden Title
AdvaggFunctionalTestBase::$defaultTheme protected property
AdvaggFunctionalTestBase::$user protected property A user with permission to administer site configuration.
AdvaggFunctionalTestBase::setUp protected function
CdnTest::$modules protected static property Modules to enable. Overrides AdvaggFunctionalTestBase::$modules
CdnTest::testCdn public function Test the cdn functionality and settings configuration.