public function BlockInstanceTest::testBlockInstanceConfigOutput in Collapsiblock 3.x
Same name and namespace in other branches
- 4.x tests/src/Functional/BlockInstanceTest.php \Drupal\Tests\collapsiblock\Functional\BlockInstanceTest::testBlockInstanceConfigOutput()
Test that block instance configuration is output to pages.
File
- tests/
src/ Functional/ BlockInstanceTest.php, line 73
Class
- BlockInstanceTest
- Test Collapsiblock settings on block instances.
Namespace
Drupal\Tests\collapsiblock\FunctionalCode
public function testBlockInstanceConfigOutput() {
$this
->drupalLogin($this
->getCollapsiblockUnprivilegedUser());
$testBlockHtmlId = 'collapsiblock-wrapper-' . $this->collapsiblockTestBlock
->id();
// Add Collapsiblock configuration to the test block, telling the Block
// Collapse Behavior to mirror the Global Default. Then, change the Global
// Default to something other than 1 (i.e.: "None") so that Collapsiblock
// acts on the block. Then test that the test block's output does in fact
// use the Global Default value.
$this
->setCollapsiblockBlockInstanceSetting($this->collapsiblockTestBlock, 0, 'collapse_action');
$this
->setCollapsiblockGlobalSetting(2, 'default_action');
drupal_flush_all_caches();
$this
->drupalGet('<front>');
$this
->assertSession()
->responseContains('<div id="' . $testBlockHtmlId . '" class="collapsiblock" data-collapsiblock-action="2">');
// Change the test block's Collapsiblock configuration to something other
// than the Global Default, and test that the output uses the new value.
$this
->setCollapsiblockBlockInstanceSetting($this->collapsiblockTestBlock, 3, 'collapse_action');
drupal_flush_all_caches();
$this
->drupalGet('<front>');
$this
->assertSession()
->responseContains('<div id="' . $testBlockHtmlId . '" class="collapsiblock" data-collapsiblock-action="3">');
}