]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
make tests run again (though they do not pass)
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Sat, 3 Oct 2009 23:18:49 +0000 (23:18 +0000)
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Sat, 3 Oct 2009 23:18:49 +0000 (23:18 +0000)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@389 b3834d28-1941-0410-a4f8-b48e95affb8f

src/SemanticScuttle/constants.php
tests/AllTests.php [new file with mode: 0644]
tests/BookmarksTest.php [moved from tests/bookmarksTest.php with 94% similarity]
tests/CommonDescriptionTest.php [moved from tests/commonDescriptionTest.php with 97% similarity]
tests/SearchTest.php [moved from tests/searchTest.php with 97% similarity]
tests/Tag2TagTest.php [moved from tests/tag2TagTest.php with 99% similarity]
tests/TagsCacheTest.php [moved from tests/tagsCacheTest.php with 98% similarity]
tests/TagsTest.php [moved from tests/tagsTest.php with 97% similarity]
tests/allTests.php [deleted file]

index 4940af89536c1832392a99128ccf3feb385cbc61..e37f41c30d34df37d7738b1b2d45f0996cfe1731 100644 (file)
@@ -11,11 +11,14 @@ if(isset($GLOBALS['debugMode'])) {
 }
 
 // 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']);
        
        $rootTmp = '/';
-       foreach($pieces as $piece) {
+       foreach ($pieces as $piece) {
                //we eliminate possible sscuttle subfolders (like gsearch for example)
                if ($piece != '' && !strstr($piece, '.php') && $piece != 'gsearch') {
                        $rootTmp .= $piece .'/';
diff --git a/tests/AllTests.php b/tests/AllTests.php
new file mode 100644 (file)
index 0000000..1526da8
--- /dev/null
@@ -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();
+}
+
+?>
\ No newline at end of file
similarity index 94%
rename from tests/bookmarksTest.php
rename to tests/BookmarksTest.php
index 3bff35dd4a6e86e08d5dd61d7dec36b866d1c901..fd9ed760e5644917e48b1d9ce24d471c5dea525c 100644 (file)
@@ -16,8 +16,9 @@ class BookmarksTest extends PHPUnit_Framework_TestCase
 
        protected function setUp()
        {
-               global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix, $TEMPLATES_DIR, $filetypes, $debugMode;
-               require_once('./header.inc.php');
+               global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype,
+            $tableprefix, $TEMPLATES_DIR, $filetypes, $debugMode;
+               require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php';
 
                $this->us =SemanticScuttle_Service_Factory::getServiceInstance('User');
                $this->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark');
similarity index 97%
rename from tests/commonDescriptionTest.php
rename to tests/CommonDescriptionTest.php
index f73b6468bfa0a2ffd4e6ce191a8b979f8ddb09c0..87d09d175c3ac84bf5c19554e9d7d9f4503a88e0 100644 (file)
@@ -19,7 +19,7 @@ class CommonDescriptionTest extends PHPUnit_Framework_TestCase
     protected function setUp()
     {
         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->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark');
similarity index 97%
rename from tests/searchTest.php
rename to tests/SearchTest.php
index 1dce7dcead6bc763e6887c6c953a4c9ef5dc9223..e03b4d9a70005c0481e8798f9467891b0a0a0a71 100644 (file)
@@ -18,7 +18,7 @@ class SearchTest extends PHPUnit_Framework_TestCase
     protected function setUp()
     {
         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->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark');
similarity index 99%
rename from tests/tag2TagTest.php
rename to tests/Tag2TagTest.php
index ab3114c6f767b47ed322d57e8619dd2f864084b5..24c0ae106a11d181b1d99a20f0398ec14e6d7357 100644 (file)
@@ -17,7 +17,7 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase
        protected function setUp()
        {
                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->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark');
similarity index 98%
rename from tests/tagsCacheTest.php
rename to tests/TagsCacheTest.php
index 7673565a37af7c442da28ad1144958522b7423e5..f401ab63b49b705c1a4bc604aa6a803b98887d63 100644 (file)
@@ -17,7 +17,7 @@ class TagsCacheTest extends PHPUnit_Framework_TestCase
        protected function setUp()
        {
                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->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark');
similarity index 97%
rename from tests/tagsTest.php
rename to tests/TagsTest.php
index d4957c9040b99067563deda50906a27e7e1cf923..bb904e113cd4df56478b60d4dd35a2432bf348e0 100644 (file)
@@ -14,7 +14,7 @@ class TagsTest extends PHPUnit_Framework_TestCase
        protected function setUp()
        {
                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->deleteAll();
diff --git a/tests/allTests.php b/tests/allTests.php
deleted file mode 100644 (file)
index 843911c..0000000
+++ /dev/null
@@ -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()
-    {
-    }
-}
-?>
\ No newline at end of file