From fc1c55b1830fbbb13f99db0490df4f46e15dcd31 Mon Sep 17 00:00:00 2001 From: hfuecks Date: Mon, 7 Nov 2005 00:38:00 +0100 Subject: get_tests_running_1 darcs-hash:20051106233800-e96b6-90328f1b6cc5c8b25c6e02f113cf80475789d297.gz --- _test/cases/inc/html_hilight.test.php | 10 +- _test/cases/inc/init_getBaseURL.test.php | 215 --------------------- _test/cases/inc/init_getbaseurl.test.php | 215 +++++++++++++++++++++ _test/cases/inc/pageutils_getID.test.php | 49 ----- _test/cases/inc/pageutils_getid.test.php | 49 +++++ _test/cases/inc/parser/lexer.group.php | 2 +- _test/cases/inc/parser/lexer.test.php | 122 ++++++------ _test/cases/inc/parser/parser.group.php | 27 +-- _test/cases/inc/parser/parser_links.test.php | 5 +- _test/cases/inc/parser/parser_unformatted.test.php | 1 + _test/index.php | 3 + 11 files changed, 355 insertions(+), 343 deletions(-) delete mode 100644 _test/cases/inc/init_getBaseURL.test.php create mode 100644 _test/cases/inc/init_getbaseurl.test.php delete mode 100644 _test/cases/inc/pageutils_getID.test.php create mode 100644 _test/cases/inc/pageutils_getid.test.php (limited to '_test') diff --git a/_test/cases/inc/html_hilight.test.php b/_test/cases/inc/html_hilight.test.php index 450e8d6d5..1baec416a 100644 --- a/_test/cases/inc/html_hilight.test.php +++ b/_test/cases/inc/html_hilight.test.php @@ -15,11 +15,17 @@ function html_hilight_test_unslash($string,$char="'"){ 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'); + 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() { @@ -93,6 +99,6 @@ class html_hilight_test extends UnitTestCase{ html_hilight($html,'x/') ); } - + } diff --git a/_test/cases/inc/init_getBaseURL.test.php b/_test/cases/inc/init_getBaseURL.test.php deleted file mode 100644 index 5dec4a954..000000000 --- a/_test/cases/inc/init_getBaseURL.test.php +++ /dev/null @@ -1,215 +0,0 @@ - - */ - function test1(){ - global $conf; - $conf['basedir'] = ''; - $conf['baseurl'] = ''; - $conf['canonical'] = 0; - - $_SERVER['DOCUMENT_ROOT'] = '/var/www/'; - $_SERVER['HTTP_HOST'] = 'xerxes.my.home'; - $_SERVER['SCRIPT_FILENAME'] = '/var/www/dokuwiki/doku.php'; - $_SERVER['REQUEST_URI'] = '/dokuwiki/doku.php?do=debug'; - $_SERVER['SCRIPT_NAME'] = '/dokuwiki/doku.php'; - $_SERVER['PATH_INFO'] = null; - $_SERVER['PATH_TRANSLATED'] = '/var/www/dokuwiki/doku.php'; - $_SERVER['PHP_SELF'] = '/dokuwiki/doku.php'; - - $this->assertEqual(getBaseURL(),'/dokuwiki/'); - } - - /** - * Apache, CGI, mod_userdir, subdirectory - * - * data provided by Hilko Bengen - */ - function test2(){ - global $conf; - $conf['basedir'] = ''; - $conf['baseurl'] = ''; - $conf['canonical'] = 0; - - $_SERVER['DOCUMENT_ROOT'] = '/var/www/localhost'; - $_SERVER['HTTP_HOST'] = 'localhost'; - $_SERVER['SCRIPT_FILENAME'] = '/usr/lib/cgi-bin/php4'; - $_SERVER['REQUEST_URI'] = '/~bengen/dokuwiki/doku.php?do=debug'; - $_SERVER['SCRIPT_NAME'] = '/cgi-bin/php4'; - $_SERVER['PATH_INFO'] = '/~bengen/dokuwiki/doku.php'; - $_SERVER['PATH_TRANSLATED'] = '/home/bengen/public_html/dokuwiki/doku.php'; - $_SERVER['PHP_SELF'] = '/~bengen/dokuwiki/doku.php'; - - $this->assertEqual(getBaseURL(),'/~bengen/dokuwiki/'); - } - - /** - * Apache, FastCGI, mod_userdir, subdirectory - * - * data provided by Hilko Bengen - */ - function test3(){ - global $conf; - $conf['basedir'] = ''; - $conf['baseurl'] = ''; - $conf['canonical'] = 0; - - $_SERVER['DOCUMENT_ROOT'] = '/var/www/localhost'; - $_SERVER['HTTP_HOST'] = 'localhost'; - $_SERVER['SCRIPT_FILENAME'] = '/var/run/php-fastcgi/fcgi-bin/bengen/php4'; - $_SERVER['REQUEST_URI'] = '/~bengen/dokuwiki/doku.php?do=debug'; - $_SERVER['SCRIPT_NAME'] = '/fcgi-bin/php4-bengen'; - $_SERVER['PATH_INFO'] = '/~bengen/dokuwiki/doku.php'; - $_SERVER['PATH_TRANSLATED'] = '/home/bengen/public_html/dokuwiki/doku.php'; - $_SERVER['PHP_SELF'] = '/~bengen/dokuwiki/doku.php'; - - $this->assertEqual(getBaseURL(),'/~bengen/dokuwiki/'); - } - - /** - * Apache, mod_php, mod_userdir, subdirectory - * - * data provided by Hilko Bengen - */ - function test4(){ - global $conf; - $conf['basedir'] = ''; - $conf['baseurl'] = ''; - $conf['canonical'] = 0; - - $_SERVER['DOCUMENT_ROOT'] = '/var/www/localhost'; - $_SERVER['HTTP_HOST'] = 'localhost'; - $_SERVER['SCRIPT_FILENAME'] = '/home/bengen/public_html/dokuwiki/doku.php'; - $_SERVER['REQUEST_URI'] = '/~bengen/dokuwiki/doku.php?do=debug'; - $_SERVER['SCRIPT_NAME'] = '/~bengen/dokuwiki/doku.php'; - $_SERVER['PATH_INFO'] = null; - $_SERVER['PATH_TRANSLATED'] = '/home/bengen/public_html/dokuwiki/doku.php'; - $_SERVER['PHP_SELF'] = '/~bengen/dokuwiki/doku.php'; - - $this->assertEqual(getBaseURL(),'/~bengen/dokuwiki/'); - } - - /** - * IIS - * - * data provided by David Mach - */ - function test5(){ - global $conf; - $conf['basedir'] = ''; - $conf['baseurl'] = ''; - $conf['canonical'] = 0; - - $_SERVER['DOCUMENT_ROOT'] = null; - $_SERVER['HTTP_HOST'] = 'intranet'; - $_SERVER['SCRIPT_FILENAME'] = null; - $_SERVER['REQUEST_URI'] = null; - $_SERVER['SCRIPT_NAME'] = '/wiki/doku.php'; - $_SERVER['PATH_INFO'] = '/wiki/doku.php'; - $_SERVER['PATH_TRANSLATED'] = 'C:\\Inetpub\\wwwroot\\wiki\\doku.php'; - $_SERVER['PHP_SELF'] = '/wiki/doku.php'; - - $this->assertEqual(getBaseURL(),'/wiki/'); - } - - /** - * Apache 2, mod_php, real URL rewriting, useslash (bug #292) - * - * data provided by Ted - */ - function test6(){ - global $conf; - $conf['basedir'] = ''; - $conf['baseurl'] = ''; - $conf['canonical'] = 0; - - $_SERVER['DOCUMENT_ROOT'] = '/home/websites/wiki/htdocs'; - $_SERVER['HTTP_HOST'] = 'wiki.linuxwan.net'; - $_SERVER['SCRIPT_FILENAME'] = '/home/websites/wiki/htdocs/doku.php'; - $_SERVER['REQUEST_URI'] = '/wiki/syntax?do=debug'; - $_SERVER['SCRIPT_NAME'] = '/wiki/syntax'; - $_SERVER['PATH_INFO'] = null; - $_SERVER['PATH_TRANSLATED'] = null; - $_SERVER['PHP_SELF'] = '/wiki/syntax'; - - $this->assertEqual(getBaseURL(),'/'); - } - - /** - * lighttpd, fastcgi - * - * data provided by Andreas Gohr - */ - function test7(){ - global $conf; - $conf['basedir'] = ''; - $conf['baseurl'] = ''; - $conf['canonical'] = 0; - - $_SERVER['DOCUMENT_ROOT'] = '/var/www/'; - $_SERVER['HTTP_HOST'] = 'localhost'; - $_SERVER['SCRIPT_FILENAME'] = '/var/www/dokuwiki/doku.php'; - $_SERVER['REQUEST_URI'] = '/dokuwiki/doku.php?do=debug'; - $_SERVER['SCRIPT_NAME'] = '/dokuwiki/doku.php'; - $_SERVER['PATH_INFO'] = ''; - $_SERVER['PATH_TRANSLATED'] = null; - $_SERVER['PHP_SELF'] = ''; - - $this->assertEqual(getBaseURL(),'/dokuwiki/'); - } - - /** - * Apache, mod_php, Pseudo URL rewrite, useslash - * - * data provided by Andreas Gohr - */ - function test8(){ - global $conf; - $conf['basedir'] = ''; - $conf['baseurl'] = ''; - $conf['canonical'] = 0; - - $_SERVER['DOCUMENT_ROOT'] = '/var/www/'; - $_SERVER['HTTP_HOST'] = 'xerxes.my.home'; - $_SERVER['SCRIPT_FILENAME'] = '/var/www/dokuwiki/doku.php'; - $_SERVER['REQUEST_URI'] = '/dokuwiki/doku.php/wiki/syntax?do=debug'; - $_SERVER['SCRIPT_NAME'] = '/dokuwiki/doku.php'; - $_SERVER['PATH_INFO'] = '/wiki/syntax'; - $_SERVER['PATH_TRANSLATED'] = '/var/www/wiki/syntax'; - $_SERVER['PHP_SELF'] = '/dokuwiki/doku.php/wiki/syntax'; - - $this->assertEqual(getBaseURL(),'/dokuwiki/'); - } - - /** - * Apache, mod_php, real URL rewrite, useslash - * - * data provided by Andreas Gohr - */ - function test9(){ - global $conf; - $conf['basedir'] = ''; - $conf['baseurl'] = ''; - $conf['canonical'] = 0; - - $_SERVER['DOCUMENT_ROOT'] = '/var/www/'; - $_SERVER['HTTP_HOST'] = 'xerxes.my.home'; - $_SERVER['SCRIPT_FILENAME'] = '/var/www/dokuwiki/doku.php'; - $_SERVER['REQUEST_URI'] = '/dokuwiki/wiki/syntax?do=debug'; - $_SERVER['SCRIPT_NAME'] = '/dokuwiki/doku.php'; - $_SERVER['PATH_INFO'] = null; - $_SERVER['PATH_TRANSLATED'] = '/var/www/dokuwiki/doku.php'; - $_SERVER['PHP_SELF'] = '/dokuwiki/doku.php'; - - $this->assertEqual(getBaseURL(),'/dokuwiki/'); - } -} - -//Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/_test/cases/inc/init_getbaseurl.test.php b/_test/cases/inc/init_getbaseurl.test.php new file mode 100644 index 000000000..5dec4a954 --- /dev/null +++ b/_test/cases/inc/init_getbaseurl.test.php @@ -0,0 +1,215 @@ + + */ + function test1(){ + global $conf; + $conf['basedir'] = ''; + $conf['baseurl'] = ''; + $conf['canonical'] = 0; + + $_SERVER['DOCUMENT_ROOT'] = '/var/www/'; + $_SERVER['HTTP_HOST'] = 'xerxes.my.home'; + $_SERVER['SCRIPT_FILENAME'] = '/var/www/dokuwiki/doku.php'; + $_SERVER['REQUEST_URI'] = '/dokuwiki/doku.php?do=debug'; + $_SERVER['SCRIPT_NAME'] = '/dokuwiki/doku.php'; + $_SERVER['PATH_INFO'] = null; + $_SERVER['PATH_TRANSLATED'] = '/var/www/dokuwiki/doku.php'; + $_SERVER['PHP_SELF'] = '/dokuwiki/doku.php'; + + $this->assertEqual(getBaseURL(),'/dokuwiki/'); + } + + /** + * Apache, CGI, mod_userdir, subdirectory + * + * data provided by Hilko Bengen + */ + function test2(){ + global $conf; + $conf['basedir'] = ''; + $conf['baseurl'] = ''; + $conf['canonical'] = 0; + + $_SERVER['DOCUMENT_ROOT'] = '/var/www/localhost'; + $_SERVER['HTTP_HOST'] = 'localhost'; + $_SERVER['SCRIPT_FILENAME'] = '/usr/lib/cgi-bin/php4'; + $_SERVER['REQUEST_URI'] = '/~bengen/dokuwiki/doku.php?do=debug'; + $_SERVER['SCRIPT_NAME'] = '/cgi-bin/php4'; + $_SERVER['PATH_INFO'] = '/~bengen/dokuwiki/doku.php'; + $_SERVER['PATH_TRANSLATED'] = '/home/bengen/public_html/dokuwiki/doku.php'; + $_SERVER['PHP_SELF'] = '/~bengen/dokuwiki/doku.php'; + + $this->assertEqual(getBaseURL(),'/~bengen/dokuwiki/'); + } + + /** + * Apache, FastCGI, mod_userdir, subdirectory + * + * data provided by Hilko Bengen + */ + function test3(){ + global $conf; + $conf['basedir'] = ''; + $conf['baseurl'] = ''; + $conf['canonical'] = 0; + + $_SERVER['DOCUMENT_ROOT'] = '/var/www/localhost'; + $_SERVER['HTTP_HOST'] = 'localhost'; + $_SERVER['SCRIPT_FILENAME'] = '/var/run/php-fastcgi/fcgi-bin/bengen/php4'; + $_SERVER['REQUEST_URI'] = '/~bengen/dokuwiki/doku.php?do=debug'; + $_SERVER['SCRIPT_NAME'] = '/fcgi-bin/php4-bengen'; + $_SERVER['PATH_INFO'] = '/~bengen/dokuwiki/doku.php'; + $_SERVER['PATH_TRANSLATED'] = '/home/bengen/public_html/dokuwiki/doku.php'; + $_SERVER['PHP_SELF'] = '/~bengen/dokuwiki/doku.php'; + + $this->assertEqual(getBaseURL(),'/~bengen/dokuwiki/'); + } + + /** + * Apache, mod_php, mod_userdir, subdirectory + * + * data provided by Hilko Bengen + */ + function test4(){ + global $conf; + $conf['basedir'] = ''; + $conf['baseurl'] = ''; + $conf['canonical'] = 0; + + $_SERVER['DOCUMENT_ROOT'] = '/var/www/localhost'; + $_SERVER['HTTP_HOST'] = 'localhost'; + $_SERVER['SCRIPT_FILENAME'] = '/home/bengen/public_html/dokuwiki/doku.php'; + $_SERVER['REQUEST_URI'] = '/~bengen/dokuwiki/doku.php?do=debug'; + $_SERVER['SCRIPT_NAME'] = '/~bengen/dokuwiki/doku.php'; + $_SERVER['PATH_INFO'] = null; + $_SERVER['PATH_TRANSLATED'] = '/home/bengen/public_html/dokuwiki/doku.php'; + $_SERVER['PHP_SELF'] = '/~bengen/dokuwiki/doku.php'; + + $this->assertEqual(getBaseURL(),'/~bengen/dokuwiki/'); + } + + /** + * IIS + * + * data provided by David Mach + */ + function test5(){ + global $conf; + $conf['basedir'] = ''; + $conf['baseurl'] = ''; + $conf['canonical'] = 0; + + $_SERVER['DOCUMENT_ROOT'] = null; + $_SERVER['HTTP_HOST'] = 'intranet'; + $_SERVER['SCRIPT_FILENAME'] = null; + $_SERVER['REQUEST_URI'] = null; + $_SERVER['SCRIPT_NAME'] = '/wiki/doku.php'; + $_SERVER['PATH_INFO'] = '/wiki/doku.php'; + $_SERVER['PATH_TRANSLATED'] = 'C:\\Inetpub\\wwwroot\\wiki\\doku.php'; + $_SERVER['PHP_SELF'] = '/wiki/doku.php'; + + $this->assertEqual(getBaseURL(),'/wiki/'); + } + + /** + * Apache 2, mod_php, real URL rewriting, useslash (bug #292) + * + * data provided by Ted + */ + function test6(){ + global $conf; + $conf['basedir'] = ''; + $conf['baseurl'] = ''; + $conf['canonical'] = 0; + + $_SERVER['DOCUMENT_ROOT'] = '/home/websites/wiki/htdocs'; + $_SERVER['HTTP_HOST'] = 'wiki.linuxwan.net'; + $_SERVER['SCRIPT_FILENAME'] = '/home/websites/wiki/htdocs/doku.php'; + $_SERVER['REQUEST_URI'] = '/wiki/syntax?do=debug'; + $_SERVER['SCRIPT_NAME'] = '/wiki/syntax'; + $_SERVER['PATH_INFO'] = null; + $_SERVER['PATH_TRANSLATED'] = null; + $_SERVER['PHP_SELF'] = '/wiki/syntax'; + + $this->assertEqual(getBaseURL(),'/'); + } + + /** + * lighttpd, fastcgi + * + * data provided by Andreas Gohr + */ + function test7(){ + global $conf; + $conf['basedir'] = ''; + $conf['baseurl'] = ''; + $conf['canonical'] = 0; + + $_SERVER['DOCUMENT_ROOT'] = '/var/www/'; + $_SERVER['HTTP_HOST'] = 'localhost'; + $_SERVER['SCRIPT_FILENAME'] = '/var/www/dokuwiki/doku.php'; + $_SERVER['REQUEST_URI'] = '/dokuwiki/doku.php?do=debug'; + $_SERVER['SCRIPT_NAME'] = '/dokuwiki/doku.php'; + $_SERVER['PATH_INFO'] = ''; + $_SERVER['PATH_TRANSLATED'] = null; + $_SERVER['PHP_SELF'] = ''; + + $this->assertEqual(getBaseURL(),'/dokuwiki/'); + } + + /** + * Apache, mod_php, Pseudo URL rewrite, useslash + * + * data provided by Andreas Gohr + */ + function test8(){ + global $conf; + $conf['basedir'] = ''; + $conf['baseurl'] = ''; + $conf['canonical'] = 0; + + $_SERVER['DOCUMENT_ROOT'] = '/var/www/'; + $_SERVER['HTTP_HOST'] = 'xerxes.my.home'; + $_SERVER['SCRIPT_FILENAME'] = '/var/www/dokuwiki/doku.php'; + $_SERVER['REQUEST_URI'] = '/dokuwiki/doku.php/wiki/syntax?do=debug'; + $_SERVER['SCRIPT_NAME'] = '/dokuwiki/doku.php'; + $_SERVER['PATH_INFO'] = '/wiki/syntax'; + $_SERVER['PATH_TRANSLATED'] = '/var/www/wiki/syntax'; + $_SERVER['PHP_SELF'] = '/dokuwiki/doku.php/wiki/syntax'; + + $this->assertEqual(getBaseURL(),'/dokuwiki/'); + } + + /** + * Apache, mod_php, real URL rewrite, useslash + * + * data provided by Andreas Gohr + */ + function test9(){ + global $conf; + $conf['basedir'] = ''; + $conf['baseurl'] = ''; + $conf['canonical'] = 0; + + $_SERVER['DOCUMENT_ROOT'] = '/var/www/'; + $_SERVER['HTTP_HOST'] = 'xerxes.my.home'; + $_SERVER['SCRIPT_FILENAME'] = '/var/www/dokuwiki/doku.php'; + $_SERVER['REQUEST_URI'] = '/dokuwiki/wiki/syntax?do=debug'; + $_SERVER['SCRIPT_NAME'] = '/dokuwiki/doku.php'; + $_SERVER['PATH_INFO'] = null; + $_SERVER['PATH_TRANSLATED'] = '/var/www/dokuwiki/doku.php'; + $_SERVER['PHP_SELF'] = '/dokuwiki/doku.php'; + + $this->assertEqual(getBaseURL(),'/dokuwiki/'); + } +} + +//Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/_test/cases/inc/pageutils_getID.test.php b/_test/cases/inc/pageutils_getID.test.php deleted file mode 100644 index e6ddb5e3b..000000000 --- a/_test/cases/inc/pageutils_getID.test.php +++ /dev/null @@ -1,49 +0,0 @@ - - */ - function test1(){ - global $conf; - $conf['basedir'] = '//'; - $conf['userewrite'] = 2; - $conf['deaccent'] = 0; // the default (1) gives me strange exceptions - - - $_SERVER['SCRIPT_FILENAME'] = '/lib/exe/fetch.php'; - $_SERVER['REQUEST_URI'] = '/lib/exe/fetch.php/myhdl-0.5dev1.tar.gz?id=snapshots&cache=cache'; - - $this->assertEqual(getID('media'), 'myhdl-0.5dev1.tar.gz'); - } - - - /** - * getID with internal mediafile, urlrewrite=2, no basedir set, apache, mod_php - */ - function test2(){ - global $conf; - $conf['basedir'] = ''; - $conf['userewrite'] = '2'; - $conf['baseurl'] = ''; - $conf['useslash'] = '1'; - $_SERVER['DOCUMENT_ROOT'] = '/var/www/'; - $_SERVER['HTTP_HOST'] = 'xerxes.my.home'; - $_SERVER['SCRIPT_FILENAME'] = '/var/www/dokuwiki/lib/exe/detail.php'; - $_SERVER['PHP_SELF'] = '/dokuwiki/lib/exe/detail.php/wiki/discussion/button-dw.png'; - $_SERVER['REQUEST_URI'] = '/dokuwiki/lib/exe/detail.php/wiki/discussion/button-dw.png?id=test&debug=1'; - $_SERVER['SCRIPT_NAME'] = '/dokuwiki/lib/exe/detail.php'; - $_SERVER['PATH_INFO'] = '/wiki/discussion/button-dw.png'; - $_SERVER['PATH_TRANSLATED'] = '/var/www/wiki/discussion/button-dw.png'; - - $this->assertEqual(getID('media',true), 'wiki:discussion:button-dw.png'); - $this->assertEqual(getID('media',false), 'wiki/discussion/button-dw.png'); - } - -} -//Setup VIM: ex: et ts=4 enc=utf-8 : diff --git a/_test/cases/inc/pageutils_getid.test.php b/_test/cases/inc/pageutils_getid.test.php new file mode 100644 index 000000000..9e115acdb --- /dev/null +++ b/_test/cases/inc/pageutils_getid.test.php @@ -0,0 +1,49 @@ + + */ + function test1(){ + global $conf; + $conf['basedir'] = '//'; + $conf['userewrite'] = 2; + $conf['deaccent'] = 0; // the default (1) gives me strange exceptions + + + $_SERVER['SCRIPT_FILENAME'] = '/lib/exe/fetch.php'; + $_SERVER['REQUEST_URI'] = '/lib/exe/fetch.php/myhdl-0.5dev1.tar.gz?id=snapshots&cache=cache'; + + $this->assertEqual(getID('media'), 'myhdl-0.5dev1.tar.gz'); + } + + + /** + * getID with internal mediafile, urlrewrite=2, no basedir set, apache, mod_php + */ + function test2(){ + global $conf; + $conf['basedir'] = ''; + $conf['userewrite'] = '2'; + $conf['baseurl'] = ''; + $conf['useslash'] = '1'; + $_SERVER['DOCUMENT_ROOT'] = '/var/www/'; + $_SERVER['HTTP_HOST'] = 'xerxes.my.home'; + $_SERVER['SCRIPT_FILENAME'] = '/var/www/dokuwiki/lib/exe/detail.php'; + $_SERVER['PHP_SELF'] = '/dokuwiki/lib/exe/detail.php/wiki/discussion/button-dw.png'; + $_SERVER['REQUEST_URI'] = '/dokuwiki/lib/exe/detail.php/wiki/discussion/button-dw.png?id=test&debug=1'; + $_SERVER['SCRIPT_NAME'] = '/dokuwiki/lib/exe/detail.php'; + $_SERVER['PATH_INFO'] = '/wiki/discussion/button-dw.png'; + $_SERVER['PATH_TRANSLATED'] = '/var/www/wiki/discussion/button-dw.png'; + + $this->assertEqual(getID('media',true), 'wiki:discussion:button-dw.png'); + $this->assertEqual(getID('media',false), 'wiki/discussion/button-dw.png'); + } + +} +//Setup VIM: ex: et ts=4 enc=utf-8 : diff --git a/_test/cases/inc/parser/lexer.group.php b/_test/cases/inc/parser/lexer.group.php index 99ec993be..6e9ef0742 100644 --- a/_test/cases/inc/parser/lexer.group.php +++ b/_test/cases/inc/parser/lexer.group.php @@ -13,7 +13,7 @@ class LexerGroupTest extends GroupTest { function LexerGroupTest() { $this->GroupTest('LexerGroupTest'); - $this->addTestFile('lexer.test.php'); + $this->addTestFile(dirname(__FILE__).'/lexer.test.php'); } } diff --git a/_test/cases/inc/parser/lexer.test.php b/_test/cases/inc/parser/lexer.test.php index 818009f92..75fa32ee0 100644 --- a/_test/cases/inc/parser/lexer.test.php +++ b/_test/cases/inc/parser/lexer.test.php @@ -355,7 +355,7 @@ class TestParserByteIndex { function ignore() {} - function catch() {} + function caught() {} } Mock::generate('TestParserByteIndex'); @@ -371,41 +371,41 @@ class TestOfLexerByteIndices extends UnitTestCase { $handler = &new MockTestParserByteIndex($this); $handler->setReturnValue("ignore", true); - $handler->setReturnValue("catch", true); + $handler->setReturnValue("caught", true); $handler->expectArgumentsAt( 0, - "catch", + "caught", array("", DOKU_LEXER_ENTER, strpos($doc,'')) ); $handler->expectArgumentsAt( 1, - "catch", + "caught", array("b", DOKU_LEXER_SPECIAL, strpos($doc,'b')) ); $handler->expectArgumentsAt( 2, - "catch", + "caught", array("c", DOKU_LEXER_MATCHED, strpos($doc,'c')) ); $handler->expectArgumentsAt( 3, - "catch", + "caught", array("d", DOKU_LEXER_UNMATCHED, strpos($doc,'d')) ); $handler->expectArgumentsAt( 4, - "catch", + "caught", array("", DOKU_LEXER_EXIT, strpos($doc,'')) ); - $handler->expectCallCount("catch", 5); + $handler->expectCallCount("caught", 5); $lexer = &new Doku_Lexer($handler, "ignore"); - $lexer->addEntryPattern("", "ignore", "catch"); - $lexer->addExitPattern("", "catch"); - $lexer->addSpecialPattern('b','catch','special'); - $lexer->mapHandler('special','catch'); - $lexer->addPattern('c','catch'); + $lexer->addEntryPattern("", "ignore", "caught"); + $lexer->addExitPattern("", "caught"); + $lexer->addSpecialPattern('b','caught','special'); + $lexer->mapHandler('special','caught'); + $lexer->addPattern('c','caught'); $this->assertTrue($lexer->parse($doc)); $handler->tally(); @@ -416,41 +416,41 @@ class TestOfLexerByteIndices extends UnitTestCase { $handler = &new MockTestParserByteIndex($this); $handler->setReturnValue("ignore", true); - $handler->setReturnValue("catch", true); + $handler->setReturnValue("caught", true); $handler->expectArgumentsAt( 0, - "catch", + "caught", array("", DOKU_LEXER_ENTER, strpos($doc,'')) ); $handler->expectArgumentsAt( 1, - "catch", + "caught", array("b", DOKU_LEXER_SPECIAL, strpos($doc,'b')) ); $handler->expectArgumentsAt( 2, - "catch", + "caught", array("c", DOKU_LEXER_MATCHED, strpos($doc,'c')) ); $handler->expectArgumentsAt( 3, - "catch", + "caught", array("d", DOKU_LEXER_UNMATCHED, strpos($doc,'d')) ); $handler->expectArgumentsAt( 4, - "catch", + "caught", array("", DOKU_LEXER_EXIT, strpos($doc,'')) ); - $handler->expectCallCount("catch", 5); + $handler->expectCallCount("caught", 5); $lexer = &new Doku_Lexer($handler, "ignore"); - $lexer->addEntryPattern('(?=.*\x3C/file\x3E)', "ignore", "catch"); - $lexer->addExitPattern("", "catch"); - $lexer->addSpecialPattern('b','catch','special'); - $lexer->mapHandler('special','catch'); - $lexer->addPattern('c','catch'); + $lexer->addEntryPattern('(?=.*\x3C/file\x3E)', "ignore", "caught"); + $lexer->addExitPattern("", "caught"); + $lexer->addSpecialPattern('b','caught','special'); + $lexer->mapHandler('special','caught'); + $lexer->addPattern('c','caught'); $this->assertTrue($lexer->parse($doc)); $handler->tally(); @@ -461,41 +461,41 @@ class TestOfLexerByteIndices extends UnitTestCase { $handler = &new MockTestParserByteIndex($this); $handler->setReturnValue("ignore", true); - $handler->setReturnValue("catch", true); + $handler->setReturnValue("caught", true); $handler->expectArgumentsAt( 0, - "catch", + "caught", array("", DOKU_LEXER_ENTER, strpos($doc,'')) ); $handler->expectArgumentsAt( 1, - "catch", + "caught", array("b", DOKU_LEXER_SPECIAL, strpos($doc,'b')) ); $handler->expectArgumentsAt( 2, - "catch", + "caught", array("c", DOKU_LEXER_MATCHED, strpos($doc,'c')) ); $handler->expectArgumentsAt( 3, - "catch", + "caught", array("d", DOKU_LEXER_UNMATCHED, strpos($doc,'d')) ); $handler->expectArgumentsAt( 4, - "catch", + "caught", array("", DOKU_LEXER_EXIT, strpos($doc,'')) ); - $handler->expectCallCount("catch", 5); + $handler->expectCallCount("caught", 5); $lexer = &new Doku_Lexer($handler, "ignore"); - $lexer->addEntryPattern('(?!foo)', "ignore", "catch"); - $lexer->addExitPattern("", "catch"); - $lexer->addSpecialPattern('b','catch','special'); - $lexer->mapHandler('special','catch'); - $lexer->addPattern('c','catch'); + $lexer->addEntryPattern('(?!foo)', "ignore", "caught"); + $lexer->addExitPattern("", "caught"); + $lexer->addSpecialPattern('b','caught','special'); + $lexer->mapHandler('special','caught'); + $lexer->addPattern('c','caught'); $this->assertTrue($lexer->parse($doc)); $handler->tally(); @@ -506,41 +506,41 @@ class TestOfLexerByteIndices extends UnitTestCase { $handler = &new MockTestParserByteIndex($this); $handler->setReturnValue("ignore", true); - $handler->setReturnValue("catch", true); + $handler->setReturnValue("caught", true); $handler->expectArgumentsAt( 0, - "catch", + "caught", array("", DOKU_LEXER_ENTER, strpos($doc,'')) ); $handler->expectArgumentsAt( 1, - "catch", + "caught", array("b", DOKU_LEXER_SPECIAL, strpos($doc,'b')) ); $handler->expectArgumentsAt( 2, - "catch", + "caught", array("c", DOKU_LEXER_MATCHED, strpos($doc,'c')) ); $handler->expectArgumentsAt( 3, - "catch", + "caught", array("d", DOKU_LEXER_UNMATCHED, strpos($doc,'d')) ); $handler->expectArgumentsAt( 4, - "catch", + "caught", array("", DOKU_LEXER_EXIT, strpos($doc,'')) ); - $handler->expectCallCount("catch", 5); + $handler->expectCallCount("caught", 5); $lexer = &new Doku_Lexer($handler, "ignore"); - $lexer->addEntryPattern('', "ignore", "catch"); - $lexer->addExitPattern("(?<=d)", "catch"); - $lexer->addSpecialPattern('b','catch','special'); - $lexer->mapHandler('special','catch'); - $lexer->addPattern('c','catch'); + $lexer->addEntryPattern('', "ignore", "caught"); + $lexer->addExitPattern("(?<=d)", "caught"); + $lexer->addSpecialPattern('b','caught','special'); + $lexer->mapHandler('special','caught'); + $lexer->addPattern('c','caught'); $this->assertTrue($lexer->parse($doc)); $handler->tally(); @@ -551,41 +551,41 @@ class TestOfLexerByteIndices extends UnitTestCase { $handler = &new MockTestParserByteIndex($this); $handler->setReturnValue("ignore", true); - $handler->setReturnValue("catch", true); + $handler->setReturnValue("caught", true); $handler->expectArgumentsAt( 0, - "catch", + "caught", array("", DOKU_LEXER_ENTER, strpos($doc,'')) ); $handler->expectArgumentsAt( 1, - "catch", + "caught", array("b", DOKU_LEXER_SPECIAL, strpos($doc,'b')) ); $handler->expectArgumentsAt( 2, - "catch", + "caught", array("c", DOKU_LEXER_MATCHED, strpos($doc,'c')) ); $handler->expectArgumentsAt( 3, - "catch", + "caught", array("d", DOKU_LEXER_UNMATCHED, strpos($doc,'d')) ); $handler->expectArgumentsAt( 4, - "catch", + "caught", array("", DOKU_LEXER_EXIT, strpos($doc,'')) ); - $handler->expectCallCount("catch", 5); + $handler->expectCallCount("caught", 5); $lexer = &new Doku_Lexer($handler, "ignore"); - $lexer->addEntryPattern('', "ignore", "catch"); - $lexer->addExitPattern("(?", "catch"); - $lexer->addSpecialPattern('b','catch','special'); - $lexer->mapHandler('special','catch'); - $lexer->addPattern('c','catch'); + $lexer->addEntryPattern('', "ignore", "caught"); + $lexer->addExitPattern("(?", "caught"); + $lexer->addSpecialPattern('b','caught','special'); + $lexer->mapHandler('special','caught'); + $lexer->addPattern('c','caught'); $this->assertTrue($lexer->parse($doc)); $handler->tally(); diff --git a/_test/cases/inc/parser/parser.group.php b/_test/cases/inc/parser/parser.group.php index bfd086999..a295f6882 100644 --- a/_test/cases/inc/parser/parser.group.php +++ b/_test/cases/inc/parser/parser.group.php @@ -12,20 +12,21 @@ class ParserGroupTest extends GroupTest { function ParserGroupTest() { + $dir = dirname(__FILE__).'/'; $this->GroupTest('ParserGroupTest'); - $this->addTestFile('parser_eol.test.php'); - $this->addTestFile('parser_footnote.test.php'); - $this->addTestFile('parser_formatting.test.php'); - $this->addTestFile('parser_headers.test.php'); - $this->addTestFile('parser_i18n.test.php'); - $this->addTestFile('parser_links.test.php'); - $this->addTestFile('parser_lists.test.php'); - $this->addTestFile('parser_preformatted.test.php'); - $this->addTestFile('parser_quote.test.php'); - $this->addTestFile('parser_replacements.test.php'); - $this->addTestFile('parser_table.test.php'); - $this->addTestFile('parser_tocsections.test.php'); - $this->addTestFile('parser_unformatted.test.php'); + $this->addTestFile($dir . 'parser_eol.test.php'); + $this->addTestFile($dir . 'parser_footnote.test.php'); + $this->addTestFile($dir .'parser_formatting.test.php'); + $this->addTestFile($dir .'parser_headers.test.php'); + $this->addTestFile($dir .'parser_i18n.test.php'); + $this->addTestFile($dir .'parser_links.test.php'); + $this->addTestFile($dir .'parser_lists.test.php'); + $this->addTestFile($dir .'parser_preformatted.test.php'); + $this->addTestFile($dir .'parser_quote.test.php'); + $this->addTestFile($dir .'parser_replacements.test.php'); + $this->addTestFile($dir .'parser_table.test.php'); + $this->addTestFile($dir .'parser_tocsections.test.php'); + $this->addTestFile($dir .'parser_unformatted.test.php'); } } diff --git a/_test/cases/inc/parser/parser_links.test.php b/_test/cases/inc/parser/parser_links.test.php index 1bcdcd461..ff0389a8c 100644 --- a/_test/cases/inc/parser/parser_links.test.php +++ b/_test/cases/inc/parser/parser_links.test.php @@ -80,8 +80,9 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { ); $this->assertEqual(array_map('stripByteIndex',$this->H->calls),$calls); } - function testEmail() { + $this->fail('The emaillink mode seems to cause php 5.0.5 to segfault'); + return; $this->P->addMode('email',new Doku_Parser_Mode_Emaillink()); $this->P->parse("Foo Bar"); $calls = array ( @@ -95,7 +96,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { ); $this->assertEqual(array_map('stripByteIndex',$this->H->calls),$calls); } - + function testInternalLinkOneChar() { $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); $this->P->parse("Foo [[l]] Bar"); diff --git a/_test/cases/inc/parser/parser_unformatted.test.php b/_test/cases/inc/parser/parser_unformatted.test.php index 5a7d956a9..28f6e50cb 100644 --- a/_test/cases/inc/parser/parser_unformatted.test.php +++ b/_test/cases/inc/parser/parser_unformatted.test.php @@ -19,6 +19,7 @@ class TestOfDoku_Parser_Unformatted extends TestOfDoku_Parser { array('p_close',array()), array('document_end',array()), ); + $this->assertEqual(array_map('stripByteIndex',$this->H->calls),$calls); } diff --git a/_test/index.php b/_test/index.php index 9b20cee39..7410cf461 100644 --- a/_test/index.php +++ b/_test/index.php @@ -1,5 +1,8 @@