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

Test combining css media queries.

@group advagg

Hierarchy

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

Expanded class hierarchy of CombineMediaQueriesTest

Related topics

File

tests/src/Functional/CombineMediaQueriesTest.php, line 14

Namespace

Drupal\Tests\advagg\Functional
View source
class CombineMediaQueriesTest extends AdvaggFunctionalTestBase {
    
    /**
     * Modules to enable.
     *
     * @var array
     */
    protected static $modules = [
        'advagg',
        'advagg_test',
    ];
    
    /**
     * Tests path converting functions, and that saving a change to them works.
     */
    public function testCombineMedia() {
        // Agreggrate files.
        $this->config('system.performance')
            ->set('css.preprocess', TRUE)
            ->save();
        // Ensure that when combine media is disabled, that there is a media query.
        $this->drupalGet(Url::fromRoute('advagg.settings'));
        $this->assertSession()
            ->responseContains('media="screen"');
        // Test combine media.
        $edit = [];
        $edit['css_combine_media'] = TRUE;
        $this->submitForm($edit, 'op');
        $config = $this->config('advagg.settings');
        $this->assertTrue($config->get('css.combine_media'));
        $this->assertSession()
            ->responseNotContains('media="screen"');
        // Ensure that if the optimization is cached that the asset definition
        // is still updated.
        $this->drupalGet(Url::fromRoute('advagg.operations'));
        $this->assertSession()
            ->responseNotContains('media="screen"');
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
AdvaggFunctionalTestBase::$defaultTheme protected property
AdvaggFunctionalTestBase::$user protected property A user with permission to administer site configuration.
AdvaggFunctionalTestBase::setUp protected function
CombineMediaQueriesTest::$modules protected static property Modules to enable. Overrides AdvaggFunctionalTestBase::$modules
CombineMediaQueriesTest::testCombineMedia public function Tests path converting functions, and that saving a change to them works.