+ add tests about getwebroot method.
This commit is contained in:
2
framework/tests/helper/.201.getwebroot.inbrowse.et
Normal file
2
framework/tests/helper/.201.getwebroot.inbrowse.et
Normal file
@@ -0,0 +1,2 @@
|
||||
/
|
||||
/zentao/
|
||||
8
framework/tests/helper/.202.getwebroot.inshell.et
Normal file
8
framework/tests/helper/.202.getwebroot.inshell.et
Normal 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/
|
||||
17
framework/tests/helper/201.getwebroot.inbrowse.php
Executable file
17
framework/tests/helper/201.getwebroot.inbrowse.php
Executable 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";
|
||||
43
framework/tests/helper/202.getwebroot.inshell.php
Executable file
43
framework/tests/helper/202.getwebroot.inshell.php
Executable 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";
|
||||
Reference in New Issue
Block a user