Skip to content
Snippets Groups Projects
Commit aac682fb authored by Guy Brand's avatar Guy Brand
Browse files

Fix Unit Test

- README: test unit is under _test/
- form: use security token
- form: reordered elements
- pageid: playground start page (broken since ns autolinking?)

darcs-hash:20080302184514-19e2d-087390c75f1e60e369162219f253a7ed513ce1f6.gz
parent 73056168
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,7 @@ You can run the tests in three ways. From the command line: ...@@ -53,7 +53,7 @@ You can run the tests in three ways. From the command line:
Using a web browser; Using a web browser;
http://localhost/dokuwiki/test/index.php http://localhost/dokuwiki/_test/index.php
As remote tests run on a remote serveri (specified in tests.ini with REMOTE_TEST_URL) and driven locally from the command line using; As remote tests run on a remote serveri (specified in tests.ini with REMOTE_TEST_URL) and driven locally from the command line using;
......
...@@ -21,19 +21,20 @@ class form_test extends UnitTestCase { ...@@ -21,19 +21,20 @@ class form_test extends UnitTestCase {
$realoutput = '<form action="/test" method="post" '; $realoutput = '<form action="/test" method="post" ';
$realoutput .= 'accept-charset="'.$lang['encoding'].'" id="dw__testform">'; $realoutput .= 'accept-charset="'.$lang['encoding'].'" id="dw__testform">';
$realoutput .= "\n"; $realoutput .= "\n";
$realoutput .= '<div class="no"><input type="hidden" name="summary" value="changes &amp;c" /></div>'; $realoutput .= '<div class="no"><input type="hidden" name="sectok" value="'.getSecurityToken().'" />';
$realoutput .= '<input type="hidden" name="summary" value="changes &amp;c" /></div>';
$realoutput .= "\n"; $realoutput .= "\n";
$realoutput .= "<fieldset ><legend>Test</legend>\n"; $realoutput .= "<fieldset ><legend>Test</legend>\n";
$realoutput .= '<label class="block" for="text__id"><span>Text</span> '; $realoutput .= '<label class="block" for="text__id"><span>Text</span> ';
$realoutput .= '<input type="text" class="edit" id="text__id" name="t" value="v" /></label><br />'; $realoutput .= '<input type="text" id="text__id" name="t" value="v" class="edit" /></label><br />';
$realoutput .= "\n"; $realoutput .= "\n";
$realoutput .= '<label class="simple" for="check__id">'; $realoutput .= '<label class="simple" for="check__id">';
$realoutput .= '<input type="checkbox" id="check__id" name="r" value="1" /> '; $realoutput .= '<input type="checkbox" id="check__id" name="r" value="1" /> ';
$realoutput .= '<span>Check</span></label>'; $realoutput .= '<span>Check</span></label>';
$realoutput .= "\n"; $realoutput .= "\n";
$realoutput .= '<input class="button" name="do[save]" type="submit" value="Save" accesskey="s" title="Save [ALT+S]" />'; $realoutput .= '<input name="do[save]" type="submit" value="Save" class="button" accesskey="s" title="Save [ALT+S]" />';
$realoutput .= "\n"; $realoutput .= "\n";
$realoutput .= '<input class="button" name="do[cancel]" type="submit" value="Cancel" />'; $realoutput .= '<input name="do[cancel]" type="submit" value="Cancel" class="button" />';
$realoutput .= "\n"; $realoutput .= "\n";
$realoutput .= "</fieldset>\n</form>\n"; $realoutput .= "</fieldset>\n</form>\n";
return $realoutput; return $realoutput;
...@@ -45,6 +46,7 @@ class form_test extends UnitTestCase { ...@@ -45,6 +46,7 @@ class form_test extends UnitTestCase {
$form->printForm(); $form->printForm();
$output = ob_get_contents(); $output = ob_get_contents();
ob_end_clean(); ob_end_clean();
$form->addHidden('sectok', getSecurityToken());
$this->assertEqual($output,$this->_realoutput()); $this->assertEqual($output,$this->_realoutput());
} }
...@@ -56,7 +58,8 @@ class form_test extends UnitTestCase { ...@@ -56,7 +58,8 @@ class form_test extends UnitTestCase {
'_class'=>'block', '_class'=>'block',
'id'=>'text__id', 'id'=>'text__id',
'name'=>'t', 'name'=>'t',
'value'=>'v')); 'value'=>'v',
'class'=>'edit'));
$e2 =& $form->getElementAt(99); $e2 =& $form->getElementAt(99);
$this->assertEqual($e2, array('_elem'=>'closefieldset')); $this->assertEqual($e2, array('_elem'=>'closefieldset'));
} }
......
...@@ -48,7 +48,7 @@ class init_resolve_pageid_test extends UnitTestCase { ...@@ -48,7 +48,7 @@ class init_resolve_pageid_test extends UnitTestCase {
$tests[] = array('foo','.:','foo:start'); $tests[] = array('foo','.:','foo:start');
$tests[] = array('','foo:','foo:start'); $tests[] = array('','foo:','foo:start');
$tests[] = array('foo','foo:','foo:start'); $tests[] = array('foo','foo:','foo:start');
$tests[] = array('foo','playground:','playground:playground'); $tests[] = array('foo','playground:','playground:start');
foreach($tests as $test){ foreach($tests as $test){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment