unittest fixes
darcs-hash:20060804142243-9b6ab-d208f7f1a67a9958fda05c519c8407ad5e733cea.gz
This commit is contained in:
parent
ac900efc10
commit
03c4aec3c8
|
@ -2,6 +2,9 @@
|
|||
require_once DOKU_INC.'inc/utf8.php';
|
||||
require_once DOKU_INC.'inc/pageutils.php';
|
||||
|
||||
global $conf;
|
||||
if (!isset($conf['datadir'])) $conf['datadir'] = $conf['savedir'].'/pages';
|
||||
|
||||
class init_resolve_pageid_test extends UnitTestCase {
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
*/
|
||||
require_once DOKU_INC . 'inc/parser/parser.php';
|
||||
require_once DOKU_INC . 'inc/parser/handler.php';
|
||||
require_once DOKU_INC . 'inc/events.php';
|
||||
//require_once DOKU . 'parser/renderer.php';
|
||||
|
||||
//Mock::generate('Doku_Renderer');
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
<?php
|
||||
define('DOKU_UNITTEST',true);
|
||||
define('DOKU_TESTSCRIPT',$_SERVER['PHP_SELF']);
|
||||
|
||||
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
|
||||
define('DOKU_CONF',realpath(dirname(__FILE__).'/../conf').'/' );
|
||||
define('DOKU_CONF',realpath(dirname(__FILE__).'/../conf').'/');
|
||||
|
||||
require_once DOKU_CONF . 'dokuwiki.php';
|
||||
if(@file_exists(DOKU_CONF.'local.php')){ require_once(DOKU_CONF.'local.php'); }
|
||||
|
||||
$conf['lang'] = 'en';
|
||||
define('TEST_ROOT', dirname(__FILE__));
|
||||
define('TMPL_FILESCHEME_PATH', TEST_ROOT . '/filescheme/');
|
||||
|
@ -56,7 +62,7 @@ function DW_TESTS_PaintRunMore() {
|
|||
break;
|
||||
case DW_TESTS_OUTPUT_HTML:
|
||||
default:
|
||||
echo "<p><a href='" . $_SERVER['PHP_SELF'] . "'>Run more tests</a></p>";
|
||||
echo "<p><a href='" . DOKU_TESTSCRIPT . "'>Run more tests</a></p>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -94,8 +100,8 @@ function DW_TESTS_PaintSuiteHeader() {
|
|||
case DW_TESTS_OUTPUT_HTML:
|
||||
default:
|
||||
echo "<h1>Dokuwiki: Unit Test Suite</h1>\n";
|
||||
echo "<p><a href='index.php?show=groups'>Test groups</a>";
|
||||
echo " || <a href='index.php?show=cases'>Test cases</a></p>";
|
||||
echo "<p><a href='". DOKU_TESTSCRIPT ."?show=groups'>Test groups</a>";
|
||||
echo " || <a href='". DOKU_TESTSCRIPT ."?show=cases'>Test cases</a></p>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -140,25 +146,25 @@ EOD;
|
|||
}
|
||||
|
||||
/** OUTPUT STARTS HERE **/
|
||||
|
||||
// If it's a group test
|
||||
if (isset($_GET['group'])) {
|
||||
if ('all' == $_GET['group']) {
|
||||
TestManager::runAllTests(DW_TESTS_GetReporter());
|
||||
} else {
|
||||
TestManager::runGroupTest(ucfirst($_GET['group']),
|
||||
TEST_GROUPS,
|
||||
DW_TESTS_GetReporter());
|
||||
}
|
||||
DW_TESTS_PaintRunMore();
|
||||
exit();
|
||||
}
|
||||
|
||||
// If it's a single test case
|
||||
if (isset($_GET['case'])) {
|
||||
TestManager::runTestCase($_GET['case'], TEST_CASES, DW_TESTS_GetReporter());
|
||||
DW_TESTS_PaintRunMore();
|
||||
exit();
|
||||
|
||||
// If it's a group test
|
||||
if (isset($_GET['group'])) {
|
||||
if ('all' == $_GET['group']) {
|
||||
TestManager::runAllTests(DW_TESTS_GetReporter());
|
||||
} else {
|
||||
TestManager::runGroupTest(ucfirst($_GET['group']),
|
||||
TEST_GROUPS,
|
||||
DW_TESTS_GetReporter());
|
||||
}
|
||||
DW_TESTS_PaintRunMore();
|
||||
exit();
|
||||
}
|
||||
|
||||
// If it's a single test case
|
||||
if (isset($_GET['case'])) {
|
||||
TestManager::runTestCase($_GET['case'], TEST_CASES, DW_TESTS_GetReporter());
|
||||
DW_TESTS_PaintRunMore();
|
||||
exit();
|
||||
}
|
||||
|
||||
// Else it's the main page
|
||||
|
|
|
@ -47,7 +47,7 @@ class TestManager {
|
|||
require_once SIMPLE_TEST . 'web_tester.php';
|
||||
require_once SIMPLE_TEST . 'mock_objects.php';
|
||||
require_once 'web.inc.php';
|
||||
require_once 'mock_functions.php';
|
||||
require_once 'mock_functions.php';
|
||||
}
|
||||
|
||||
function runAllTests(&$reporter) {
|
||||
|
@ -286,7 +286,9 @@ class HTMLTestManager extends TestManager {
|
|||
"?case=" . urlencode($testcase) . "'>" .
|
||||
$testcase . "</a></li>\n";
|
||||
}
|
||||
return $buffer . "</ul>\n";
|
||||
|
||||
$buffer .= "</ul>\n";
|
||||
return $buffer;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
require_once(DOKU_INC.'inc/blowfish.php');
|
||||
require_once(DOKU_INC.'inc/mail.php');
|
||||
|
||||
global $auth;
|
||||
|
||||
// load the the backend auth functions and instantiate the auth object
|
||||
if (@file_exists(DOKU_INC.'inc/auth/'.$conf['authtype'].'.class.php')) {
|
||||
require_once(DOKU_INC.'inc/auth/basic.class.php');
|
||||
|
@ -54,11 +56,15 @@
|
|||
// do the login either by cookie or provided credentials
|
||||
if($conf['useacl']){
|
||||
// if no credentials were given try to use HTTP auth (for SSO)
|
||||
if(!$_REQUEST['u'] && !$_COOKIE[DOKU_COOKIE] && $_SERVER['PHP_AUTH_USER']){
|
||||
if(empty($_REQUEST['u']) && !$_COOKIE[DOKU_COOKIE] && $_SERVER['PHP_AUTH_USER']){
|
||||
$_REQUEST['u'] = $_SERVER['PHP_AUTH_USER'];
|
||||
$_REQUEST['p'] = $_SERVER['PHP_AUTH_PW'];
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['u'])) $_REQUEST['u'] = '';
|
||||
if (!isset($_REQUEST['p'])) $_REQUEST['p'] = '';
|
||||
if (!isset($_REQUEST['r'])) $_REQUEST['r'] = '';
|
||||
|
||||
// external trust mechanism in place?
|
||||
if(!is_null($auth) && $auth->canDo('external')){
|
||||
$auth->trustExternal($_REQUEST['u'],$_REQUEST['p'],$_REQUEST['r']);
|
||||
|
|
|
@ -198,4 +198,5 @@ function trigger_event($name, &$data, $action=NULL, $canPreventDefault=true) {
|
|||
}
|
||||
|
||||
// create the event handler
|
||||
global $EVENT_HANDLER;
|
||||
$EVENT_HANDLER = new Doku_Event_Handler();
|
||||
|
|
12
inc/init.php
12
inc/init.php
|
@ -25,12 +25,14 @@
|
|||
|
||||
//prepare config array()
|
||||
global $conf;
|
||||
$conf = array();
|
||||
if (!defined('DOKU_UNITTEST')) {
|
||||
$conf = array();
|
||||
|
||||
// load the config file(s)
|
||||
require_once(DOKU_CONF.'dokuwiki.php');
|
||||
if(@file_exists(DOKU_CONF.'local.php')){
|
||||
require_once(DOKU_CONF.'local.php');
|
||||
// load the config file(s)
|
||||
require_once(DOKU_CONF.'dokuwiki.php');
|
||||
if(@file_exists(DOKU_CONF.'local.php')){
|
||||
require_once(DOKU_CONF.'local.php');
|
||||
}
|
||||
}
|
||||
|
||||
//prepare language array
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
function getID($param='id',$clean=true){
|
||||
global $conf;
|
||||
|
||||
$id = $_REQUEST[$param];
|
||||
$id = isset($_REQUEST[$param]) ? $_REQUEST[$param] : null;
|
||||
|
||||
//construct page id from request URI
|
||||
if(empty($id) && $conf['userewrite'] == 2){
|
||||
|
@ -301,7 +301,11 @@ function resolve_pageid($ns,&$page,&$exists){
|
|||
$exists = false;
|
||||
|
||||
//keep hashlink if exists then clean both parts
|
||||
list($page,$hash) = split('#',$page,2);
|
||||
if (strpos($page,'#')) {
|
||||
list($page,$hash) = split('#',$page,2);
|
||||
} else {
|
||||
$hash = '';
|
||||
}
|
||||
$hash = cleanID($hash);
|
||||
$page = resolve_id($ns,$page,false); // resolve but don't clean, yet
|
||||
|
||||
|
|
|
@ -1341,7 +1341,7 @@ class Doku_Handler_Block {
|
|||
function Doku_Handler_Block(){
|
||||
global $DOKU_PLUGINS;
|
||||
//check if syntax plugins were loaded
|
||||
if(!is_array($DOKU_PLUGINS['syntax'])) return;
|
||||
if(empty($DOKU_PLUGINS['syntax'])) return;
|
||||
foreach($DOKU_PLUGINS['syntax'] as $n => $p){
|
||||
$ptype = $p->getPType();
|
||||
if($ptype == 'block'){
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
// plugin related constants
|
||||
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
|
||||
$plugin_types = array('admin','syntax','action');
|
||||
|
||||
/**
|
||||
|
@ -67,7 +68,7 @@ function &plugin_load($type,$name){
|
|||
|
||||
|
||||
//plugin already loaded?
|
||||
if($DOKU_PLUGINS[$type][$name] != null){
|
||||
if(!empty($DOKU_PLUGINS[$type][$name])){
|
||||
return $DOKU_PLUGINS[$type][$name];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue