make tests run again (though they do not pass)

git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@389 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
cweiske 2009-10-03 23:18:49 +00:00
parent d5f09b7e4d
commit de031f043f
9 changed files with 71 additions and 48 deletions

View file

@ -11,11 +11,14 @@ if(isset($GLOBALS['debugMode'])) {
} }
// Determine the base URL as ROOT // Determine the base URL as ROOT
if (!isset($GLOBALS['root'])) { if (!isset($_SERVER['HTTP_HOST'])) {
//not set in unit tests
define('ROOT', 'http://localhost/');
} else if (!isset($GLOBALS['root'])) {
$pieces = explode('/', $_SERVER['SCRIPT_NAME']); $pieces = explode('/', $_SERVER['SCRIPT_NAME']);
$rootTmp = '/'; $rootTmp = '/';
foreach($pieces as $piece) { foreach ($pieces as $piece) {
//we eliminate possible sscuttle subfolders (like gsearch for example) //we eliminate possible sscuttle subfolders (like gsearch for example)
if ($piece != '' && !strstr($piece, '.php') && $piece != 'gsearch') { if ($piece != '' && !strstr($piece, '.php') && $piece != 'gsearch') {
$rootTmp .= $piece .'/'; $rootTmp .= $piece .'/';

58
tests/AllTests.php Normal file
View file

@ -0,0 +1,58 @@
<?php
/*
* To launch all tests, type the following line into the root directory
* of SemanticScuttle (where is the config.inc.php file) :
*
* phpunit --testdox-html tests/dox.html AllTests tests/allTests.php
*
* !!Check that $debugMode = false in config.inc.php to avoid unstable beahviours!!
*
* A dox.html file will be created into the tests/ directory providing a summary
* of tests according to agile development.
* */
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'AllTests::main');
}
require_once 'PHPUnit/Framework/TestSuite.php';
class AllTests extends PHPUnit_Framework_TestSuite
{
public static function main()
{
require_once 'PHPUnit/TextUI/TestRunner.php';
PHPUnit_TextUI_TestRunner::run(self::suite());
}
public static function suite()
{
$suite = new AllTests();
$tdir = dirname(__FILE__);
$suite->addTestFile($tdir . '/BookmarksTest.php');
$suite->addTestFile($tdir . '/Tag2TagTest.php');
$suite->addTestFile($tdir . '/TagsCacheTest.php');
$suite->addTestFile($tdir . '/CommonDescriptionTest.php');
$suite->addTestFile($tdir . '/SearchTest.php');
$suite->addTestFile($tdir . '/TagsTest.php');
return $suite;
}
protected function setUp()
{
global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype,
$tableprefix, $TEMPLATES_DIR, $filetypes, $debugMode;
require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php';
}
protected function tearDown()
{
}
}
if (PHPUnit_MAIN_METHOD == 'AllTests::main') {
AllTests::main();
}
?>

View file

@ -16,8 +16,9 @@ class BookmarksTest extends PHPUnit_Framework_TestCase
protected function setUp() protected function setUp()
{ {
global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix, $TEMPLATES_DIR, $filetypes, $debugMode; global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype,
require_once('./header.inc.php'); $tableprefix, $TEMPLATES_DIR, $filetypes, $debugMode;
require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php';
$this->us =SemanticScuttle_Service_Factory::getServiceInstance('User'); $this->us =SemanticScuttle_Service_Factory::getServiceInstance('User');
$this->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); $this->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark');

View file

@ -19,7 +19,7 @@ class CommonDescriptionTest extends PHPUnit_Framework_TestCase
protected function setUp() protected function setUp()
{ {
global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix; global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix;
require_once('./header.inc.php'); require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php';
$this->us =SemanticScuttle_Service_Factory::getServiceInstance('User'); $this->us =SemanticScuttle_Service_Factory::getServiceInstance('User');
$this->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); $this->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark');

View file

@ -18,7 +18,7 @@ class SearchTest extends PHPUnit_Framework_TestCase
protected function setUp() protected function setUp()
{ {
global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix; global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix;
require_once('./header.inc.php'); require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php';
$this->us =SemanticScuttle_Service_Factory::getServiceInstance('User'); $this->us =SemanticScuttle_Service_Factory::getServiceInstance('User');
$this->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); $this->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark');

View file

@ -17,7 +17,7 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase
protected function setUp() protected function setUp()
{ {
global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix; global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix;
require_once('./header.inc.php'); require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php';
$this->us =SemanticScuttle_Service_Factory::getServiceInstance('User'); $this->us =SemanticScuttle_Service_Factory::getServiceInstance('User');
$this->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); $this->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark');

View file

@ -17,7 +17,7 @@ class TagsCacheTest extends PHPUnit_Framework_TestCase
protected function setUp() protected function setUp()
{ {
global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix, $TEMPLATES_DIR, $debugMode; global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix, $TEMPLATES_DIR, $debugMode;
require_once('./header.inc.php'); require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php';
$this->us =SemanticScuttle_Service_Factory::getServiceInstance('User'); $this->us =SemanticScuttle_Service_Factory::getServiceInstance('User');
$this->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); $this->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark');

View file

@ -14,7 +14,7 @@ class TagsTest extends PHPUnit_Framework_TestCase
protected function setUp() protected function setUp()
{ {
global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix; global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix;
require_once('./header.inc.php'); require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php';
$this->ts =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); $this->ts =SemanticScuttle_Service_Factory::getServiceInstance('Tag');
$this->ts->deleteAll(); $this->ts->deleteAll();

View file

@ -1,39 +0,0 @@
<?php
/*
* To launch all tests, type the following line into the root directory
* of SemanticScuttle (where is the config.inc.php file) :
*
* phpunit --testdox-html tests/dox.html AllTests tests/allTests.php
*
* !!Check that $debugMode = false in config.inc.php to avoid unstable beahviours!!
*
* A dox.html file will be created into the tests/ directory providing a summary
* of tests according to agile development.
* */
class AllTests extends PHPUnit_Framework_TestSuite
{
public static function suite()
{
$suite = new AllTests();
$suite->addTestFile('tests/bookmarksTest.php');
$suite->addTestFile('tests/tag2TagTest.php');
$suite->addTestFile('tests/tagsCacheTest.php');
$suite->addTestFile('tests/commonDescriptionTest.php');
$suite->addTestFile('tests/searchTest.php');
$suite->addTestFile('tests/tagsTest.php');
return $suite;
}
protected function setUp()
{
global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix, $TEMPLATES_DIR, $filetypes, $debugMode;
require_once('./header.inc.php');
}
protected function tearDown()
{
}
}
?>