diff options
-rw-r--r-- | _test/cases/inc/common_clientip.test.php | 2 | ||||
-rw-r--r-- | _test/cases/inc/form_form.test.php | 15 | ||||
-rw-r--r-- | _test/cases/inc/pageutils_clean_id.test.php | 10 | ||||
-rw-r--r-- | _test/cases/inc/parser/parser_formatting.test.php | 16 |
4 files changed, 26 insertions, 17 deletions
diff --git a/_test/cases/inc/common_clientip.test.php b/_test/cases/inc/common_clientip.test.php index 04d071e7d..4df463539 100644 --- a/_test/cases/inc/common_clientip.test.php +++ b/_test/cases/inc/common_clientip.test.php @@ -145,7 +145,7 @@ class common_clientIP_test extends UnitTestCase { $_SERVER['REMOTE_ADDR'] = ''; $_SERVER['HTTP_X_REAL_IP'] = ''; $_SERVER['HTTP_X_FORWARDED_FOR'] = '<?php set_time_limit(0);echo \'my_delim\';passthru(123.123.123.123);die;?>'; - $out = '123.123.123.123'; + $out = '0.0.0.0'; $this->assertEqual(clientIP(),$out); } diff --git a/_test/cases/inc/form_form.test.php b/_test/cases/inc/form_form.test.php index 7a5913bf8..f69349ece 100644 --- a/_test/cases/inc/form_form.test.php +++ b/_test/cases/inc/form_form.test.php @@ -1,5 +1,6 @@ <?php +require_once DOKU_INC.'inc/auth.php'; require_once DOKU_INC.'inc/form.php'; class form_test extends UnitTestCase { @@ -22,7 +23,7 @@ class form_test extends UnitTestCase { $realoutput .= 'accept-charset="'.$lang['encoding'].'" id="dw__testform">'; $realoutput .= "\n"; $realoutput .= '<div class="no"><input type="hidden" name="sectok" value="'.getSecurityToken().'" />'; - $realoutput .= '<input type="hidden" name="summary" value="changes &c" /></div>'; + $realoutput .= '<input type="hidden" name="summary" value="changes &c" />'; $realoutput .= "\n"; $realoutput .= "<fieldset ><legend>Test</legend>\n"; $realoutput .= '<label class="block" for="text__id"><span>Text</span> '; @@ -32,14 +33,18 @@ class form_test extends UnitTestCase { $realoutput .= '<input type="checkbox" id="check__id" name="r" value="1" /> '; $realoutput .= '<span>Check</span></label>'; $realoutput .= "\n"; - $realoutput .= '<input name="do[save]" type="submit" value="Save" class="button" accesskey="s" title="Save [ALT+S]" />'; + $realoutput .= '<input name="do[save]" type="submit" value="Save" class="button" accesskey="s" title="Save [S]" />'; $realoutput .= "\n"; $realoutput .= '<input name="do[cancel]" type="submit" value="Cancel" class="button" />'; $realoutput .= "\n"; - $realoutput .= "</fieldset>\n</form>\n"; + $realoutput .= "</fieldset>\n</div></form>\n"; return $realoutput; } + function _ignoreTagWS($data){ + return preg_replace('/>\s+</','><',$data); + } + function test_form_print() { $form = $this->_testform(); ob_start(); @@ -47,7 +52,7 @@ class form_test extends UnitTestCase { $output = ob_get_contents(); ob_end_clean(); $form->addHidden('sectok', getSecurityToken()); - $this->assertEqual($output,$this->_realoutput()); + $this->assertEqual($this->_ignoreTagWS($output),$this->_ignoreTagWS($this->_realoutput())); } function test_get_element_at() { @@ -94,7 +99,7 @@ class form_test extends UnitTestCase { $form->printForm(); $output = ob_get_contents(); ob_end_clean(); - $this->assertEqual($output,$this->_realoutput()); + $this->assertEqual($this->_ignoreTagWS($output),$this->_ignoreTagWS($this->_realoutput())); } } diff --git a/_test/cases/inc/pageutils_clean_id.test.php b/_test/cases/inc/pageutils_clean_id.test.php index 9884bbc12..9c03ce334 100644 --- a/_test/cases/inc/pageutils_clean_id.test.php +++ b/_test/cases/inc/pageutils_clean_id.test.php @@ -28,7 +28,11 @@ class init_clean_id_test extends UnitTestCase { $tests[] = array('pa$%^*#ge',false,'pa_ge'); $tests[] = array('*page*',false,'page'); $tests[] = array('ښ',false,'ښ'); - $tests[] = array('ښ侧化并곦ঝഈβ',false,'ښ侧化并곦ঝഈ'); + $tests[] = array('päge',false,'paege'); + $tests[] = array('foo bar',false,'foo_bar'); + $tests[] = array('PÄGÖ',false,'paegoe'); + $tests[] = array('Faß','false','fass'); + $tests[] = array('ښ侧化并곦 β',false,'ښ侧化并곦_β'); $tests[] = array('page:page',false,'page:page'); $tests[] = array('page;page',false,'page:page'); @@ -80,7 +84,7 @@ class init_clean_id_test extends UnitTestCase { $tests[] = array('pagĖ',false,'pagė'); $tests[] = array('pagĒēĔĕĖėĘęĚě',false,'pagēēĕĕėėęęěě'); $tests[] = array('ښ',false,'ښ'); - $tests[] = array('ښ侧化并곦ঝഈβ',false,'ښ侧化并곦ঝഈ'); + $tests[] = array('ښ侧化并곦ঝഈβ',false,'ښ侧化并곦ঝഈβ'); foreach($tests as $test){ $this->assertEqual(cleanID($test[0],$test[1]),$test[2]); @@ -100,7 +104,7 @@ class init_clean_id_test extends UnitTestCase { $tests[] = array('pagĖ',false,'page'); $tests[] = array('pagĒēĔĕĖėĘęĚě',false,'pageeeeeeeeee'); $tests[] = array('ښ',false,'ښ'); - $tests[] = array('ښ侧化并곦ঝഈβ',false,'ښ侧化并곦ঝഈ'); + $tests[] = array('ښ侧化并곦ঝഈβ',false,'ښ侧化并곦ঝഈβ'); foreach($tests as $test){ $this->assertEqual(cleanID($test[0],$test[1]),$test[2]); diff --git a/_test/cases/inc/parser/parser_formatting.test.php b/_test/cases/inc/parser/parser_formatting.test.php index de125e3c1..3c7449a35 100644 --- a/_test/cases/inc/parser/parser_formatting.test.php +++ b/_test/cases/inc/parser/parser_formatting.test.php @@ -6,7 +6,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser { function TestOfDoku_Parser_Formatting() { $this->UnitTestCase('TestOfDoku_Parser_Formatting'); } - + function testStrong() { $this->P->addMode('strong',new Doku_Parser_Mode_Formatting('strong')); $this->P->parse('abc **bar** def'); @@ -23,7 +23,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser { ); $this->assertEqual(array_map('stripbyteindex',$this->H->calls),$calls); } - + function testNotStrong() { $this->P->addMode('strong',new Doku_Parser_Mode_Formatting('strong')); $this->P->parse('abc **bar def'); @@ -53,7 +53,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser { ); $this->assertEqual(array_map('stripbyteindex',$this->H->calls),$calls); } - + function testNotEm() { $this->P->addMode('emphasis',new Doku_Parser_Mode_Formatting('emphasis')); $this->P->parse('abc //bar def'); @@ -113,7 +113,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser { ); $this->assertEqual(array_map('stripbyteindex',$this->H->calls),$calls); } - + function testNotMonospace() { $this->P->addMode('monospace',new Doku_Parser_Mode_Formatting('monospace')); $this->P->parse("abc ''bar def"); @@ -143,7 +143,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser { ); $this->assertEqual(array_map('stripbyteindex',$this->H->calls),$calls); } - + function testNotSubscript() { $this->P->addMode('subscript',new Doku_Parser_Mode_Formatting('subscript')); $this->P->parse('abc <sub>bar def'); @@ -156,7 +156,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser { ); $this->assertEqual(array_map('stripbyteindex',$this->H->calls),$calls); } - + function testSuperscript() { $this->P->addMode('superscript',new Doku_Parser_Mode_Formatting('superscript')); $this->P->parse("abc <sup>bar</sup> def"); @@ -203,7 +203,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser { ); $this->assertEqual(array_map('stripbyteindex',$this->H->calls),$calls); } - + function testNotDeleted() { $this->P->addMode('deleted',new Doku_Parser_Mode_Formatting('deleted')); $this->P->parse('abc <del>bar def'); @@ -238,7 +238,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser { ); $this->assertEqual(array_map('stripbyteindex',$this->H->calls),$calls); } - + function testIllegalNestedFormatting() { $this->P->addMode('strong',new Doku_Parser_Mode_Formatting('strong')); $this->P->parse('abc **a**b**c** def'); |