public function GeshiFilterTest::testBracketsOnlyAngle in GeSHi Filter for syntax highlighting 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/GeshiFilterTest.php \Drupal\Tests\geshifilter\Functional\GeshiFilterTest::testBracketsOnlyAngle()
Test with brackets only angle.
File
- tests/
src/ Functional/ GeshiFilterTest.php, line 235
Class
- GeshiFilterTest
- Tests for GeshiFilter in node content.
Namespace
Drupal\Tests\geshifilter\FunctionalCode
public function testBracketsOnlyAngle() {
$this->config
->set('tags', 'code');
$this->config
->set('language.cpp.enabled', TRUE);
// Enable only angle brackets.
$this->config
->set('tag_styles', [
GeshiFilter::BRACKETS_ANGLE => GeshiFilter::BRACKETS_ANGLE,
]);
$this->config
->save();
$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}";
// This should be filtered.
$this
->assertGeshiFilterHighlighting('<code language="cpp">' . $source_code . '</code>', [
[
$source_code,
'cpp',
0,
1,
FALSE,
],
], t('Checking angle brackets style in GeshiFilter::BRACKETS_ANGLE mode'));
// This should not be filtered.
$this
->assertGeshiFilterHighlighting('[code language="cpp"]' . $source_code . '[/code]', [
[
$source_code,
NULL,
0,
1,
FALSE,
],
], t('Checking [foo] brackets style in GeshiFilter::BRACKETS_ANGLE mode'));
$this
->assertGeshiFilterHighlighting('[[code language="cpp"]]' . $source_code . '[[/code]]', [
[
$source_code,
NULL,
0,
1,
FALSE,
],
], t('Checking [[foo]] brackets style in GeshiFilter::BRACKETS_ANGLE mode'));
$this
->assertGeshiFilterHighlighting('<?php' . $source_code . '?>', [
[
$source_code,
NULL,
0,
1,
FALSE,
],
], t('Checking php code blocks in GeshiFilter::BRACKETS_ANGLE mode'));
}