public function GeshiFilterTest::testBracketsOnlySquare in GeSHi Filter for syntax highlighting 8.2
Same name and namespace in other branches
- 8 tests/src/Functional/GeshiFilterTest.php \Drupal\Tests\geshifilter\Functional\GeshiFilterTest::testBracketsOnlySquare()
Test with brackets only square.
File
- tests/
src/ Functional/ GeshiFilterTest.php, line 273
Class
- GeshiFilterTest
- Tests for GeshiFilter in node content.
Namespace
Drupal\Tests\geshifilter\FunctionalCode
public function testBracketsOnlySquare() {
$this->config
->set('tags', 'code');
$this->config
->set('language.cpp.enabled', TRUE);
$source_code = "//C++ source code\nfor (int i=0; i<10; ++i) {\n fun(i);\n bar.foo(x, y);\n server->start(&pool); \n}";
// Enable only square brackets.
$this->config
->set('tag_styles', [
GeshiFilter::BRACKETS_SQUARE => GeshiFilter::BRACKETS_SQUARE,
]);
$this->config
->save();
// This should be filtered.
$this
->assertGeshiFilterHighlighting('[code language="cpp"]' . $source_code . '[/code]', [
[
$source_code,
'cpp',
0,
1,
FALSE,
],
], t('Checking [foo] brackets style in GeshiFilter::BRACKETS_SQUARE mode'));
// This should not be filtered.
$this
->assertGeshiFilterHighlighting('<code language="cpp">' . $source_code . '</code>', [
[
$source_code,
NULL,
0,
1,
FALSE,
],
], t('Checking angle brackets style in GeshiFilter::BRACKETS_SQUARE mode'));
$this
->assertGeshiFilterHighlighting('[[code language="cpp"]]' . $source_code . '[[/code]]', [
[
$source_code,
NULL,
0,
1,
FALSE,
],
], t('Checking [[foo]] brackets style in GeshiFilter::BRACKETS_SQUARE mode'));
$this
->assertGeshiFilterHighlighting('<?php' . $source_code . '?>', [
[
$source_code,
NULL,
0,
1,
FALSE,
],
], t('Checking php code blocks in GeshiFilter::BRACKETS_SQUARE mode'));
}