public function ResponsiveWrappersTest::testsFilterContentOutput in Responsive wrappers 8
Same name and namespace in other branches
- 2.0.x tests/src/Functional/ResponsiveWrappersTest.php \Drupal\Tests\responsivewrappers\Functional\ResponsiveWrappersTest::testsFilterContentOutput()
Tests responsive wrappers filter content output.
File
- tests/
src/ Functional/ ResponsiveWrappersTest.php, line 84
Class
- ResponsiveWrappersTest
- Provides a class for responsivewrappers functional tests.
Namespace
Drupal\Tests\responsivewrappers\FunctionalCode
public function testsFilterContentOutput() {
// Tests the node output without responsive wrappers filter enabled.
$this
->drupalGet('node/' . $this->node
->id());
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->responseContains('<img scr="#" />');
$this
->assertSession()
->responseContains('<table></table>');
$this
->assertSession()
->responseContains('<iframe src="https://www.youtube.com/embed/"></iframe>');
$this
->assertSession()
->responseContains('<iframe src="https://player.vimeo.com/video/"></iframe>');
// Enable the responsive wrappers filter.
$this
->drupalGet('admin/config/content/formats/manage/full_html');
$edit = [
'filters[filter_bootstrap_responsive_wrapper][status]' => TRUE,
'filters[filter_bootstrap_responsive_wrapper][settings][responsive_iframe]' => TRUE,
'filters[filter_bootstrap_responsive_wrapper][settings][responsive_table]' => TRUE,
'filters[filter_bootstrap_responsive_wrapper][settings][responsive_image]' => TRUE,
];
$this
->drupalPostForm(NULL, $edit, t('Save configuration'));
// Tests the node output with responsive wrappers filter enabled.
$this
->drupalGet('node/' . $this->node
->id());
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->responseContains('<img scr="#" class="img-responsive" />');
$this
->assertSession()
->responseContains('<div class="table-responsive"><table class="table"></table></div>');
$this
->assertSession()
->responseContains('<div class="embed-responsive embed-responsive-16by9"><iframe src="https://www.youtube.com/embed/" class="embed-responsive-item"></iframe></div>');
$this
->assertSession()
->responseContains('<div class="embed-responsive embed-responsive-16by9"><iframe src="https://player.vimeo.com/video/" class="embed-responsive-item"></iframe></div>');
// Set Bootstrap 4 output.
$this
->drupalGet('admin/config/content/responsivewrappers');
$edit = [
'responsivewrappers_version' => 4,
];
$this
->drupalPostForm(NULL, $edit, t('Save configuration'));
// Update node to apply new filter settings.
$this->node
->setTitle('Responsive filter test B4');
$this->node
->save();
// Tests Bootstrap 4 output.
$this
->drupalGet('node/' . $this->node
->id());
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->responseContains('<img scr="#" class="img-fluid" />');
}