function DevelopmentSettingsFormTest::testDisabledRenderedOutputCacheBins

Same name in other branches
  1. 10 core/modules/system/tests/src/FunctionalJavascript/Form/DevelopmentSettingsFormTest.php \Drupal\Tests\system\FunctionalJavascript\Form\DevelopmentSettingsFormTest::testDisabledRenderedOutputCacheBins()

Tests disabling cache bins which cache markup.

File

core/modules/system/tests/src/FunctionalJavascript/Form/DevelopmentSettingsFormTest.php, line 118

Class

DevelopmentSettingsFormTest
Tests development settings form items for expected behavior.

Namespace

Drupal\Tests\system\FunctionalJavascript\Form

Code

public function testDisabledRenderedOutputCacheBins() : void {
    self::assertFalse(\Drupal::getContainer()->has('cache.backend.null'));
    $this->drupalGet(Url::fromRoute('system.development_settings'));
    $this->getSession()
        ->getPage()
        ->checkField('Do not cache markup');
    $this->getSession()
        ->getPage()
        ->pressButton('Save settings');
    $this->drupalGet(Url::fromRoute('system.status'));
    $this->assertSession()
        ->pageTextContains('Markup caching disabled');
    $this->assertSession()
        ->linkExists('development settings page');
    $refreshed_container = $this->initKernel(Request::create('/'));
    self::assertTrue($refreshed_container->has('cache.backend.null'));
    $cache_bins = [
        'page',
        'dynamic_page_cache',
        'render',
    ];
    foreach ($cache_bins as $cache_bin) {
        self::assertInstanceOf(NullBackend::class, $refreshed_container->get("cache.{$cache_bin}"));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.