+ add tests about getwebroot method.

This commit is contained in:
wangyidong
2013-02-21 01:22:52 +00:00
parent b8d97728b0
commit b6f3f93ff8
4 changed files with 70 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
/
/zentao/

View File

@@ -0,0 +1,8 @@
http://localhost webRoot is /
http://localhost/ webRoot is /
http://localhost/my/ webRoot is /
http://localhost/my-todo.html webRoot is /
http://localhost/index.php?m=my&f=index webRoot is /
http://localhost/zentao/my/ webRoot is /zentao/
http://localhost/zentao/my-todo.html webRoot is /zentao/
http://localhost/zentao/index.php?m=my&f=index webRoot is /zentao/

View File

@@ -0,0 +1,17 @@
#!/usr/bin/env php
<?php
<<<TC
title: testing the getWebRoot method.
TC;
/* Include the helper class. */
include '../../helper.class.php';
/* Create two objects named obj and obj2. */
$_SERVER['SCRIPT_NAME'] = '/index.php';
$webRoot = getWebRoot();
echo $webRoot . "\n";
$_SERVER['SCRIPT_NAME'] = '/zentao/index.php';
$webRoot = getWebRoot();
echo $webRoot . "\n";

View File

@@ -0,0 +1,43 @@
#!/usr/bin/env php
<?php
<<<TC
title: testing the getWebRoot method.
TC;
/* Include the helper class. */
include '../../helper.class.php';
/* Create two objects named obj and obj2. */
define('IN_SHELL', true);
$_SERVER['argv'][1] = 'http://localhost';
$webRoot = getWebRoot();
echo 'http://localhost webRoot is ' . $webRoot . "\n";
$_SERVER['argv'][1] = 'http://localhost/';
$webRoot = getWebRoot();
echo 'http://localhost/ webRoot is ' . $webRoot . "\n";
$_SERVER['argv'][1] = 'http://localhost/my/';
$webRoot = getWebRoot();
echo 'http://localhost/my/ webRoot is ' . $webRoot . "\n";
$_SERVER['argv'][1] = 'http://localhost/my-todo.html';
$webRoot = getWebRoot();
echo 'http://localhost/my-todo.html webRoot is ' . $webRoot . "\n";
$_SERVER['argv'][1] = 'http://localhost/index.php?m=my&f=index';
$webRoot = getWebRoot();
echo 'http://localhost/index.php?m=my&f=index webRoot is ' . $webRoot . "\n";
$_SERVER['argv'][1] = 'http://localhost/zentao/my/';
$webRoot = getWebRoot();
echo 'http://localhost/zentao/my/ webRoot is ' . $webRoot . "\n";
$_SERVER['argv'][1] = 'http://localhost/zentao/my-todo.html';
$webRoot = getWebRoot();
echo 'http://localhost/zentao/my-todo.html webRoot is ' . $webRoot . "\n";
$_SERVER['argv'][1] = 'http://localhost/zentao/index.php?m=my&f=index';
$webRoot = getWebRoot();
echo 'http://localhost/zentao/index.php?m=my&f=index webRoot is ' . $webRoot . "\n";