From: Reini U. <ru...@us...> - 2004-07-09 12:29:37
|
Update of /cvsroot/phpwiki/phpwiki/tests/unit/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19442/lib Modified Files: DumpHtml.php HtmlParserTest.php InlineParserTest.php PageListTest.php SetupWiki.php Log Message: Properly save and restore the request args for each test. Improved DumpHtml test, fixed dumphtml for browser request. Index: DumpHtml.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/tests/unit/lib/DumpHtml.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -2 -b -p -d -r1.2 -r1.3 --- DumpHtml.php 8 Jul 2004 21:33:15 -0000 1.2 +++ DumpHtml.php 9 Jul 2004 12:29:26 -0000 1.3 @@ -7,22 +7,39 @@ require_once 'lib/loadsave.php'; require_once 'PHPUnit.php'; -class DumpHtml extends PHPUnit_TestCase { - // constructor of the test suite - function DumpHtml($name) { - $this->PHPUnit_TestCase($name); - } +class DumpHtml extends phpwiki_TestCase { + + function _dumpPage($pagename) { + global $request, $cur_dir; - function testRateIt() { - global $request; $request->setArg('directory','.dumphtml'); - $request->setArg('pages','RateIt'); + $request->setArg('pages',$pagename); + unlink($cur_dir."/.dumphtml/$pagename.html"); DumpHtmlToDir($request); + $this->assertTrue(file_exists($cur_dir."/.dumphtml/$pagename.html")); } - function testDumpHtml() { - global $request; + /* at first dump some problematic pages */ + function test01RateIt() { + $this->_dumpPage('RateIt'); + } + function test02OrphanedPages() { + $this->_dumpPage('OrphanedPages'); + } + function test03OldTextFormattingRules() { + $this->_dumpPage('OldTextFormattingRules'); + } + + /* finally all. esp. with start_debug=1 this needs some time... */ + function test99DumpHtml() { + global $request, $cur_dir; + $request->setArg('directory','.dumphtml'); + purge_dir($cur_dir."/.dumphtml"); + purge_dir($cur_dir."/.dumphtml/images"); + $request->setArg('pages',''); DumpHtmlToDir($request); + $this->assertTrue(file_exists($cur_dir."/.dumphtml/HomePage.html")); } + } Index: HtmlParserTest.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/tests/unit/lib/HtmlParserTest.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -2 -b -p -d -r1.1 -r1.2 --- HtmlParserTest.php 24 May 2004 17:33:17 -0000 1.1 +++ HtmlParserTest.php 9 Jul 2004 12:29:26 -0000 1.2 @@ -10,10 +10,5 @@ require_once 'PHPUnit.php'; define('USE_GLOBAL_SAX',false); // this seems to be a xml bug -class HtmlParserTest extends PHPUnit_TestCase { - - // constructor of the test suite - function HtmlParserTest($name) { - $this->PHPUnit_TestCase($name); - } +class HtmlParserTest extends phpwiki_TestCase { function testSimple() { Index: InlineParserTest.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/tests/unit/lib/InlineParserTest.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -2 -b -p -d -r1.3 -r1.4 --- InlineParserTest.php 1 Jul 2004 15:40:59 -0000 1.3 +++ InlineParserTest.php 9 Jul 2004 12:29:26 -0000 1.4 @@ -9,10 +9,5 @@ require_once 'lib/InlineParser.php'; require_once 'PHPUnit.php'; -class InlineParserTest extends PHPUnit_TestCase { - - // constructor of the test suite - function InlineParserTest($name) { - $this->PHPUnit_TestCase($name); - } +class InlineParserTest extends phpwiki_TestCase { function testNoWikiWords() { Index: PageListTest.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/tests/unit/lib/PageListTest.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -2 -b -p -d -r1.2 -r1.3 --- PageListTest.php 1 Jul 2004 15:41:54 -0000 1.2 +++ PageListTest.php 9 Jul 2004 12:29:26 -0000 1.3 @@ -4,9 +4,5 @@ require_once 'lib/PageList.php'; require_once 'PHPUnit.php'; -class PageListTest extends PHPUnit_TestCase { - // constructor of the test suite - function PageListTest($name) { - $this->PHPUnit_TestCase($name); - } +class PageListTest extends phpwiki_TestCase { function testPageList() { Index: SetupWiki.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/tests/unit/lib/SetupWiki.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -2 -b -p -d -r1.5 -r1.6 --- SetupWiki.php 8 Jul 2004 18:01:48 -0000 1.5 +++ SetupWiki.php 9 Jul 2004 12:29:26 -0000 1.6 @@ -7,8 +7,5 @@ require_once 'lib/loadsave.php'; require_once 'PHPUnit.php'; -class SetupWiki extends PHPUnit_TestCase { - function SetupWiki($name) { - $this->PHPUnit_TestCase($name); - } +class SetupWiki extends phpwiki_TestCase { function testImportOldMarkup() { @@ -22,4 +19,5 @@ class SetupWiki extends PHPUnit_TestCase $request->setArg('overwrite', 1); LoadAny($request, $request->getArg('source')); + $request->setArg('source', false); $this->assertTrue($dbi->isWikiPage($pagename)); } @@ -32,5 +30,5 @@ class SetupWiki extends PHPUnit_TestCase $dbi = $request->getDbh(); - //$dbi->deletePage('HomePage'); // possibly in cache + $dbi->deletePage('HomePage'); // possibly in cache $this->assertFalse($dbi->isWikiPage('HomePage')); @@ -38,4 +36,6 @@ class SetupWiki extends PHPUnit_TestCase $request->setArg('overwrite', 1); LoadAny($request, $request->getArg('source')); + $request->setArg('source', false); + $request->setArg('overwrite', false); $this->assertTrue($dbi->isWikiPage('HomePage')); |