From 05defe72d8739c0642c506175c0ad4de2293fb99 Mon Sep 17 00:00:00 2001 From: cweiske Date: Sun, 25 Oct 2009 15:31:31 +0000 Subject: introduce testbase class and make all tests runnable standalone git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@410 b3834d28-1941-0410-a4f8-b48e95affb8f --- tests/TagsCacheTest.php | 51 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 6 deletions(-) (limited to 'tests/TagsCacheTest.php') diff --git a/tests/TagsCacheTest.php b/tests/TagsCacheTest.php index 8e15f2d..9230f1c 100644 --- a/tests/TagsCacheTest.php +++ b/tests/TagsCacheTest.php @@ -1,12 +1,31 @@ + * @license GPL http://www.gnu.org/licenses/gpl.html + * @link http://sourceforge.net/projects/semanticscuttle */ +require_once 'prepare.php'; + +if (!defined('PHPUnit_MAIN_METHOD')) { + define('PHPUnit_MAIN_METHOD', 'TagsCacheTest::main'); +} + +/** + * Unit tests for the SemanticScuttle tags cache service. + * + * @category Bookmarking + * @package SemanticScuttle + * @author Christian Weiske + * @license GPL http://www.gnu.org/licenses/gpl.html + * @link http://sourceforge.net/projects/semanticscuttle + */ class TagsCacheTest extends PHPUnit_Framework_TestCase { protected $us; @@ -14,6 +33,21 @@ class TagsCacheTest extends PHPUnit_Framework_TestCase protected $b2ts; protected $tts; + + + /** + * Used to run this test class standalone + * + * @return void + */ + public static function main() + { + require_once 'PHPUnit/TextUI/TestRunner.php'; + PHPUnit_TextUI_TestRunner::run( + new PHPUnit_Framework_TestSuite(__CLASS__) + ); + } + protected function setUp() { global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix, $TEMPLATES_DIR, $debugMode; @@ -173,4 +207,9 @@ class TagsCacheTest extends PHPUnit_Framework_TestCase $this->assertEquals(array(), $tcs->getSynonyms('d', 1)); } } + +if (PHPUnit_MAIN_METHOD == 'TagsCacheTest::main') { + TagsCacheTest::main(); +} + ?> -- cgit v1.2.3-54-g00ecf