]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - tests/unit/lib/plugin/AllPagesTest.php
minor test optimizations
[SourceForge/phpwiki.git] / tests / unit / lib / plugin / AllPagesTest.php
1 <?php
2
3 require_once 'lib/WikiPlugin.php';
4 require_once 'lib/plugin/AllPages.php';
5 require_once 'PHPUnit.php';
6
7 class AllPagesTest extends PHPUnit_TestCase {
8     // constructor of the test suite
9     function AllPagesTest($name) {
10        $this->PHPUnit_TestCase($name);
11     }
12
13     /**
14      * Test that we can instantiate and run AllPages plugin without error.
15      */
16     function testAllPages() {
17         global $request;
18
19         $lp = new WikiPlugin_AllPages();
20         $this->assertEquals("AllPages", $lp->getName());
21         $args = "";
22         if (!isa($request->_dbi, "WikiDB")) {
23                 // very very strange bug
24                         $request->_dbi = WikiDB::open($GLOBALS['db_params']);
25                 if (!isa($request->_dbi, "WikiDB")) {
26                         trigger_error("strange php bug\n",E_USER_WARNING);
27                         return;
28                 }
29             }
30         $result = $lp->run($request->getDbh(), $args, $request, "AllPages");
31         $this->assertType('object', $result, 'isa PageList');
32     }
33 }
34
35
36 ?>