function GeshiFilterTest::testBracketsOnlyPhpCodeBlock in GeSHi Filter for syntax highlighting 6
Same name and namespace in other branches
- 7 geshifilter.test \GeshiFilterTest::testBracketsOnlyPhpCodeBlock()
File
- ./
geshifilter.test, line 411 - Tests for the GeSHi filter module.
Class
Code
function testBracketsOnlyPhpCodeBlock() {
variable_set('geshifilter_tags', 'code');
variable_set('geshifilter_language_enabled_cpp', 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 double square brackets
variable_set('geshifilter_tag_styles', array(
GESHIFILTER_BRACKETS_PHPBLOCK => GESHIFILTER_BRACKETS_PHPBLOCK,
));
// This should be filtered.
$this
->assertGeshiFilterHighlighting('<?php' . $source_code . '?>', array(
array(
$source_code,
'php',
0,
1,
FALSE,
),
), t('Checking php code blocks in GESHIFILTER_BRACKETS_PHPBLOCK mode'));
// This should not be filtered.
$this
->assertGeshiFilterHighlighting('<code language="cpp">' . $source_code . '</code>', array(
array(
$source_code,
NULL,
0,
1,
FALSE,
),
), t('Checking angle brackets style in GESHIFILTER_BRACKETS_PHPBLOCK mode'));
$this
->assertGeshiFilterHighlighting('[code language="cpp"]' . $source_code . '[/code]', array(
array(
$source_code,
NULL,
0,
1,
FALSE,
),
), t('Checking [foo] brackets style in GESHIFILTER_BRACKETS_PHPBLOCK mode'));
$this
->assertGeshiFilterHighlighting('[[code language="cpp"]]' . $source_code . '[[/code]]', array(
array(
$source_code,
NULL,
0,
1,
FALSE,
),
), t('Checking [[foo]] brackets style in GESHIFILTER_BRACKETS_PHPBLOCK mode'));
}