{
$suite = new AllTests();
$tdir = dirname(__FILE__);
- $suite->addTestFile($tdir . '/BookmarksTest.php');
+ $suite->addTestFile($tdir . '/BookmarkTest.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');
+ $suite->addTestFile($tdir . '/SearchHistoryTest.php');
+ $suite->addTestFile($tdir . '/TagTest.php');
$suite->addTestFile($tdir . '/VoteTest.php');
return $suite;
}
<?php
-require_once 'PHPUnit/Framework.php';
-
-/*
- To launch this test, type the following line into a shell
- into the tests/ directory :
- phpunit BookmarksTest tests/boomarksTest.php
+/**
+ * SemanticScuttle - your social bookmark manager.
+ *
+ * PHP version 5.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license GPL http://www.gnu.org/licenses/gpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
*/
-class BookmarksTest extends PHPUnit_Framework_TestCase
+require_once 'prepare.php';
+
+if (!defined('PHPUnit_MAIN_METHOD')) {
+ define('PHPUnit_MAIN_METHOD', 'BookmarkTest::main');
+}
+
+/**
+ * Unit tests for the SemanticScuttle bookmark service.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license GPL http://www.gnu.org/licenses/gpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
+class BookmarkTest extends TestBase
{
protected $us;
protected $bs;
protected $ts;
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, $filetypes, $debugMode;
- require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php';
-
$this->us =SemanticScuttle_Service_Factory::get('User');
$this->bs =SemanticScuttle_Service_Factory::get('Bookmark');
$this->bs->deleteAll();
$this->assertEquals(1, $bookmarks['total']);
}*/
+
+
+ public function testDeleteBookmark()
+ {
+ //FIXME
+ }
+
+}
+
+
+if (PHPUnit_MAIN_METHOD == 'BookmarkTest::main') {
+ BookmarkTest::main();
}
?>
<?php
-require_once 'PHPUnit/Framework.php';
+/**
+ * SemanticScuttle - your social bookmark manager.
+ *
+ * PHP version 5.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license GPL http://www.gnu.org/licenses/gpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
-/*
-To launch this test, type the following line into a shell
-at the root of the scuttlePlus directory :
- phpunit CommonDescriptionTest tests/commonDescriptionTest.php
-*/
+require_once 'prepare.php';
-class CommonDescriptionTest extends PHPUnit_Framework_TestCase
+if (!defined('PHPUnit_MAIN_METHOD')) {
+ define('PHPUnit_MAIN_METHOD', 'CommonDescriptionTest::main');
+}
+
+/**
+ * Unit tests for the SemanticScuttle common description service.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license GPL http://www.gnu.org/licenses/gpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
+class CommonDescriptionTest extends TestBase
{
protected $us;
protected $bs;
protected $tts;
protected $tsts;
protected $cds;
+
+
+
+ /**
+ * 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;
- require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php';
-
- $this->us =SemanticScuttle_Service_Factory::get('User');
- $this->bs =SemanticScuttle_Service_Factory::get('Bookmark');
- $this->bs->deleteAll();
- $this->b2ts =SemanticScuttle_Service_Factory::get('Bookmark2Tag');
- $this->b2ts->deleteAll();
- $this->tts =SemanticScuttle_Service_Factory::get('Tag2Tag');
- $this->tts->deleteAll();
- $this->tsts =SemanticScuttle_Service_Factory::get('TagStat');
- $this->tsts->deleteAll();
- $this->cds =SemanticScuttle_Service_Factory::get('CommonDescription');
- $this->cds->deleteAll();
+ $this->us =SemanticScuttle_Service_Factory::get('User');
+ $this->bs =SemanticScuttle_Service_Factory::get('Bookmark');
+ $this->bs->deleteAll();
+ $this->b2ts =SemanticScuttle_Service_Factory::get('Bookmark2Tag');
+ $this->b2ts->deleteAll();
+ $this->tts =SemanticScuttle_Service_Factory::get('Tag2Tag');
+ $this->tts->deleteAll();
+ $this->tsts =SemanticScuttle_Service_Factory::get('TagStat');
+ $this->tsts->deleteAll();
+ $this->cds =SemanticScuttle_Service_Factory::get('CommonDescription');
+ $this->cds->deleteAll();
}
public function testModifyDescription()
}
}
+
+
+if (PHPUnit_MAIN_METHOD == 'CommonDescriptionTest::main') {
+ CommonDescriptionTest::main();
+}
?>
<?php
-require_once 'PHPUnit/Framework.php';
+/**
+ * SemanticScuttle - your social bookmark manager.
+ *
+ * PHP version 5.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license GPL http://www.gnu.org/licenses/gpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
-/*
-To launch this test, type the following line into a shell
-at the root of the scuttlePlus directory :
- phpunit SearchTest tests/searchTest.php
-*/
+require_once 'prepare.php';
-class SearchTest extends PHPUnit_Framework_TestCase
+if (!defined('PHPUnit_MAIN_METHOD')) {
+ define('PHPUnit_MAIN_METHOD', 'SearchHistoryTest::main');
+}
+
+/**
+ * Unit tests for the SemanticScuttle search history service.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license GPL http://www.gnu.org/licenses/gpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
+class SearchHistoryTest extends TestBase
{
protected $us;
protected $bs;
protected $b2ts;
protected $tts;
protected $shs;
+
+
+
+ /**
+ * 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;
- require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php';
-
$this->us =SemanticScuttle_Service_Factory::get('User');
$this->bs =SemanticScuttle_Service_Factory::get('Bookmark');
$this->bs->deleteAll();
$this->assertSame(2, count($searches));
}
}
+
+
+if (PHPUnit_MAIN_METHOD == 'SearchHistoryTest::main') {
+ SearchHistoryTest::main();
+}
+
?>
<?php
-require_once 'PHPUnit/Framework.php';
-
-/*
- To launch this test, type the following line into a shell
- at the root of the scuttlePlus directory :
- phpunit Tag2TagTest tests/tag2TagTest.php
+/**
+ * SemanticScuttle - your social bookmark manager.
+ *
+ * PHP version 5.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license GPL http://www.gnu.org/licenses/gpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
*/
-class Tag2TagTest extends PHPUnit_Framework_TestCase
+require_once 'prepare.php';
+
+if (!defined('PHPUnit_MAIN_METHOD')) {
+ define('PHPUnit_MAIN_METHOD', 'Tag2TagTest::main');
+}
+
+/**
+ * Unit tests for the SemanticScuttle tag2tag service.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license GPL http://www.gnu.org/licenses/gpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
+class Tag2TagTest extends TestBase
{
protected $us;
protected $bs;
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;
- require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php';
-
$this->us =SemanticScuttle_Service_Factory::get('User');
$this->bs =SemanticScuttle_Service_Factory::get('Bookmark');
$this->bs->deleteAll();
}*/
}
+
+if (PHPUnit_MAIN_METHOD == 'Tag2TagTest::main') {
+ Tag2TagTest::main();
+}
?>
<?php
-require_once 'PHPUnit/Framework.php';
-
-/*
- To launch this test, type the following line into a shell
- at the root of the scuttlePlus directory :
- phpunit TagsTest tests/tagsTest.php
+/**
+ * SemanticScuttle - your social bookmark manager.
+ *
+ * PHP version 5.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license GPL http://www.gnu.org/licenses/gpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
*/
-class TagsTest extends PHPUnit_Framework_TestCase
+require_once 'prepare.php';
+
+if (!defined('PHPUnit_MAIN_METHOD')) {
+ define('PHPUnit_MAIN_METHOD', 'TagTest::main');
+}
+
+/**
+ * Unit tests for the SemanticScuttle tag service.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license GPL http://www.gnu.org/licenses/gpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
+class TagTest extends TestBase
{
protected $ts;
+
+
+ /**
+ * 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;
- require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php';
-
$this->ts =SemanticScuttle_Service_Factory::get('Tag');
$this->ts->deleteAll();
$this->us =SemanticScuttle_Service_Factory::get('User');
}
}
+
+
+if (PHPUnit_MAIN_METHOD == 'TagTest::main') {
+ TagTest::main();
+}
?>
<?php
-require_once 'PHPUnit/Framework.php';
-
-/*
- To launch this test, type the following line into a shell
- at the root of the scuttlePlus directory :
- phpunit TagsCacheTest tests/tagsCacheTest.php
+/**
+ * SemanticScuttle - your social bookmark manager.
+ *
+ * PHP version 5.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @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 <cweiske@cweiske.de>
+ * @license GPL http://www.gnu.org/licenses/gpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
class TagsCacheTest extends PHPUnit_Framework_TestCase
{
protected $us;
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;
$this->assertEquals(array(), $tcs->getSynonyms('d', 1));
}
}
+
+if (PHPUnit_MAIN_METHOD == 'TagsCacheTest::main') {
+ TagsCacheTest::main();
+}
+
?>
--- /dev/null
+<?php
+/**
+ * SemanticScuttle - your social bookmark manager.
+ *
+ * PHP version 5.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license GPL http://www.gnu.org/licenses/gpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
+
+require_once 'PHPUnit/Framework.php';
+
+/**
+ * Base unittest class that provides several helper methods.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license GPL http://www.gnu.org/licenses/gpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
+class TestBase extends PHPUnit_Framework_TestCase
+{
+ /**
+ * Create a new bookmark.
+ *
+ * @return integer ID of bookmark
+ */
+ protected function addBookmark()
+ {
+ $bs = SemanticScuttle_Service_Factory::get('Bookmark');
+ $rand = rand();
+ $bid = $bs->addBookmark(
+ 'http://example.org/' . $rand,
+ 'unittest bookmark #' . $rand,
+ 'description',
+ null,
+ 0,
+ array('unittest')
+ );
+ return $bid;
+ }
+
+}
+
+?>
\ No newline at end of file
*/
require_once 'prepare.php';
-require_once 'PHPUnit/Framework.php';
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'VoteTest::main');
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
-class VoteTest extends PHPUnit_Framework_TestCase
+class VoteTest extends TestBase
{
/**
* Vote service instance to test.
- /**
- * Create a new bookmark.
- *
- * @return integer ID of bookmark
- */
- protected function addBookmark()
- {
- $bs = SemanticScuttle_Service_Factory::get('Bookmark');
- $rand = rand();
- $bid = $bs->addBookmark(
- 'http://example.org/' . $rand,
- 'unittest bookmark #' . $rand,
- 'description',
- null,
- 0,
- array('unittest')
- );
- return $bid;
- }
-
-
-
/**
* Test getVoting() when no votes have been cast.
*
$this->assertEquals(-1, $this->vs->getVote($bid, $uid));
}
-}//class VoteTest extends PHPUnit_Framework_TestCase
+}//class VoteTest extends TestBase
if (PHPUnit_MAIN_METHOD == 'VoteTest::main') {
$_SERVER['HTTP_HOST'] = 'http://localhost/';
define('UNIT_TEST_MODE', true);
-require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php'
+require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php';
+require_once dirname(__FILE__) . '/TestBase.php';
?>
\ No newline at end of file