diff options
author | Anika Henke <anika@selfthinker.org> | 2012-06-29 17:51:09 +0100 |
---|---|---|
committer | Anika Henke <anika@selfthinker.org> | 2012-06-29 17:51:09 +0100 |
commit | 0c06a181819249c6a4a2a6c60e13f739df1f2253 (patch) | |
tree | 859377c572d0acbfc520b02304ef515bf3aebbe0 /_test/cases/inc/html_hilight.test.php | |
parent | ef7e36e4fd2a168977754f0aac1d855fb651f104 (diff) | |
parent | 5d0aaf958325f500ce69cfb79e69eb0d8f83fdeb (diff) | |
download | rpg-0c06a181819249c6a4a2a6c60e13f739df1f2253.tar.gz rpg-0c06a181819249c6a4a2a6c60e13f739df1f2253.tar.bz2 |
Merge branch 'master' of github.com:splitbrain/dokuwiki into frontend_improvements
Conflicts:
lib/tpl/dokuwiki/css/basic.css
Diffstat (limited to '_test/cases/inc/html_hilight.test.php')
-rw-r--r-- | _test/cases/inc/html_hilight.test.php | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/_test/cases/inc/html_hilight.test.php b/_test/cases/inc/html_hilight.test.php deleted file mode 100644 index cc5579c71..000000000 --- a/_test/cases/inc/html_hilight.test.php +++ /dev/null @@ -1,104 +0,0 @@ -<?php - -require_once DOKU_INC.'inc/html.php'; - -if (!extension_loaded('runkit')) { - SimpleTestOptions::ignore('html_hilight_test'); - trigger_error('Skipping html_hilight_test - http://www.php.net/runkit required'); -} - -function html_hilight_test_unslash($string,$char="'"){ - $str= str_replace('\\'.$char,$char,$string); - return $str; -} - -class html_hilight_test extends UnitTestCase{ - - function setup() { - if ( function_exists('unslash') ) { - runkit_function_rename('unslash','html_hilight_test_unslash_real'); - } - runkit_function_rename('html_hilight_test_unslash','unslash'); - } - - function teardown() { - runkit_function_rename('unslash','html_hilight_test_unslash'); - if ( function_exists('html_hilight_test_unslash_real') ) { - runkit_function_rename('html_hilight_test_unslash_real','unslash'); - } - } - - function testHighlightOneWord() { - $html = 'Foo bar Foo'; - $this->assertPattern( - '/Foo <span.*>bar<\/span> Foo/', - html_hilight($html,'bar') - ); - } - - function testHighlightTwoWords() { - $html = 'Foo bar Foo php Foo'; - $this->assertPattern( - '/Foo <span.*>bar<\/span> Foo <span.*>php<\/span> Foo/', - html_hilight($html,array('bar','php')) - ); - } - - function testHighlightTwoWordsHtml() { - $html = 'Foo <b>bar</b> <i>Foo</i> php Foo'; - $this->assertPattern( - '/Foo <b><span.*>bar<\/span><\/b> <i>Foo<\/i> <span.*>php<\/span> Foo/', - html_hilight($html,array('bar','php')) - ); - } - - function testNoHighlight() { - $html = 'Foo bar Foo'; - $this->assertPattern( - '/Foo bar Foo/', - html_hilight($html,'php') - ); - } - - function testHighlightPHP() { - $html = 'Foo $_GET[\'bar\'] Foo'; - $this->assertEqual( - 'Foo <span class="search_hit">$_GET[\'bar\']</span> Foo', - html_hilight($html,'$_GET[\'bar\']') - ); - } - - function testMatchAttribute() { - $html = 'Foo <b class="x">bar</b> Foo'; - $this->assertPattern( - '/Foo <b class="x">bar<\/b> Foo/', - html_hilight($html,'class="x"') - ); - } - - function testMatchAttributeWord() { - $html = 'Foo <b class="x">bar</b> Foo'; - $this->assertEqual( - 'Foo <b class="x">bar</b> Foo', - html_hilight($html,'class="x">bar') - ); - } - - function testRegexInjection() { - $html = 'Foo bar Foo'; - $this->assertPattern( - '/Foo bar Foo/', - html_hilight($html,'*') - ); - } - - function testRegexInjectionSlash() { - $html = 'Foo bar Foo'; - $this->assertPattern( - '/Foo bar Foo/', - html_hilight($html,'x/') - ); - } - -} - |