use bootstrap file declared in phpunit.xml and do not include it in every single test file. also get rid of the PHPUnit_MAIN_METHOD declarations since using phpunit directly is preferred

This commit is contained in:
Christian Weiske 2011-04-12 09:29:59 +02:00
parent 90f29d6e67
commit bdebe6598c
18 changed files with 2 additions and 385 deletions

View File

@ -12,23 +12,15 @@
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'AllTests::main');
}
require_once 'prepare.php';
/**
* SemanticScuttle unit tests.
*
* To launch this tests, you need PHPUnit 3.
* Run them with:
* $ php tests/AllTests.php
* $ cd tests; phpunit .
* or single files like:
* $ php tests/BookmarkTest.php
*
* You also may use phpunit directly:
* $ phpunit tests/AllTests.php
* $ cd tests; phpunit BookmarkTest.php
*
* @category Bookmarking
* @package SemanticScuttle
@ -40,14 +32,6 @@ require_once 'prepare.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();
@ -74,9 +58,4 @@ class AllTests extends PHPUnit_Framework_TestSuite
{
}
}
if (PHPUnit_MAIN_METHOD == 'AllTests::main') {
AllTests::main();
}
?>

View File

@ -12,14 +12,8 @@
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
require_once dirname(__FILE__) . '/../prepare.php';
require_once 'HTTP/Request2.php';
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Api_ExportCsvTest::main');
}
/**
* Unit tests for the SemanticScuttle csv export API
*
@ -39,21 +33,6 @@ class Api_ExportCsvTest extends TestBaseApi
/**
* 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__)
);
}
/**
* Test if authentication is required when sending no auth data
*/
@ -280,8 +259,4 @@ class Api_ExportCsvTest extends TestBaseApi
return $ar;
}
}
if (PHPUnit_MAIN_METHOD == 'Api_ExportCsvTest::main') {
Api_ExportCsvTest::main();
}
?>

View File

@ -12,14 +12,8 @@
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
require_once dirname(__FILE__) . '/../prepare.php';
require_once 'HTTP/Request2.php';
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Api_PostsAddTest::main');
}
/**
* Unit tests for the SemanticScuttle post addition API.
*
@ -37,21 +31,6 @@ class Api_PostsAddTest extends TestBaseApi
/**
* 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__)
);
}
/**
* Test if authentication is required when sending no auth data
*/
@ -428,8 +407,4 @@ TXT;
$this->assertEquals($title2, $data['bookmarks'][0]['bTitle']);
}
}
if (PHPUnit_MAIN_METHOD == 'Api_PostsAddTest::main') {
Api_PostsAddTest::main();
}
?>

View File

@ -12,14 +12,8 @@
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
require_once dirname(__FILE__) . '/../prepare.php';
require_once 'HTTP/Request2.php';
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Api_PostsDeleteTest::main');
}
/**
* Unit tests for the SemanticScuttle post deletion API.
*
@ -37,21 +31,6 @@ class Api_PostsDeleteTest extends TestBaseApi
/**
* 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__)
);
}
/**
* Test if authentication is required when sending no auth data
*/
@ -296,8 +275,4 @@ class Api_PostsDeleteTest extends TestBaseApi
}
}
if (PHPUnit_MAIN_METHOD == 'Api_PostsDeleteTest::main') {
Api_PostsDeleteTest::main();
}
?>

View File

@ -12,14 +12,8 @@
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
require_once dirname(__FILE__) . '/../prepare.php';
require_once 'HTTP/Request2.php';
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Api_PostsUpdateTest::main');
}
/**
* Unit tests for the SemanticScuttle last-update time API.
*
@ -37,21 +31,6 @@ class Api_PostsUpdateTest extends TestBaseApi
/**
* 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__)
);
}
/**
* Test if authentication is required when sending no auth data
*/
@ -128,8 +107,4 @@ class Api_PostsUpdateTest extends TestBaseApi
}
}
if (PHPUnit_MAIN_METHOD == 'Api_PostsUpdateTest::main') {
Api_PostsUpdateTest::main();
}
?>

View File

@ -12,11 +12,6 @@
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Bookmark2TagTest::main');
}
require_once 'prepare.php';
/**
* Unit tests for the SemanticScuttle bookmark-tag combination service.
@ -58,21 +53,6 @@ class Bookmark2TagTest extends TestBase
/**
* 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()
{
$this->us = SemanticScuttle_Service_Factory::get('User');
@ -628,8 +608,4 @@ class Bookmark2TagTest extends TestBase
$this->assertContains(array('tag' => 'usable', 'bCount' => '2'), $arTags);
}
}
if (PHPUnit_MAIN_METHOD == 'Bookmark2TagTest::main') {
Bookmark2TagTest::main();
}
?>

View File

@ -12,11 +12,6 @@
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'BookmarkTest::main');
}
require_once 'prepare.php';
/**
* Unit tests for the SemanticScuttle bookmark service.
@ -37,22 +32,6 @@ class BookmarkTest extends TestBase
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()
{
$this->us = SemanticScuttle_Service_Factory::get('User');
@ -1344,10 +1323,5 @@ class BookmarkTest extends TestBase
}
if (PHPUnit_MAIN_METHOD == 'BookmarkTest::main') {
BookmarkTest::main();
}
?>

View File

@ -12,11 +12,6 @@
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'CommonDescriptionTest::main');
}
require_once 'prepare.php';
/**
* Unit tests for the SemanticScuttle common description service.
@ -39,21 +34,6 @@ class CommonDescriptionTest extends TestBase
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()
{
$this->us =SemanticScuttle_Service_Factory::get('User');
@ -128,9 +108,4 @@ class CommonDescriptionTest extends TestBase
}
}
if (PHPUnit_MAIN_METHOD == 'CommonDescriptionTest::main') {
CommonDescriptionTest::main();
}
?>

View File

@ -12,11 +12,6 @@
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'SearchHistoryTest::main');
}
require_once 'prepare.php';
/**
* Unit tests for the SemanticScuttle search history service.
@ -38,22 +33,6 @@ class SearchHistoryTest extends TestBase
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__)
);
}
/**
* Set up all services
*
@ -391,10 +370,4 @@ class SearchHistoryTest extends TestBase
$this->assertEquals(0, $this->shs->countSearches());
}
}
if (PHPUnit_MAIN_METHOD == 'SearchHistoryTest::main') {
SearchHistoryTest::main();
}
?>

View File

@ -12,11 +12,6 @@
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Tag2TagTest::main');
}
require_once 'prepare.php';
/**
* Unit tests for the SemanticScuttle tag2tag service.
@ -37,22 +32,6 @@ class Tag2TagTest extends TestBase
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()
{
$this->us =SemanticScuttle_Service_Factory::get('User');
@ -550,8 +529,4 @@ class Tag2TagTest extends TestBase
}*/
}
if (PHPUnit_MAIN_METHOD == 'Tag2TagTest::main') {
Tag2TagTest::main();
}
?>

View File

@ -12,11 +12,6 @@
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'TagTest::main');
}
require_once 'prepare.php';
/**
* Unit tests for the SemanticScuttle tag service.
@ -34,22 +29,6 @@ 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()
{
$this->ts =SemanticScuttle_Service_Factory::get('Tag');
@ -109,9 +88,4 @@ class TagTest extends TestBase
}
}
if (PHPUnit_MAIN_METHOD == 'TagTest::main') {
TagTest::main();
}
?>

View File

@ -12,11 +12,6 @@
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'TagsCacheTest::main');
}
require_once 'prepare.php';
/**
* Unit tests for the SemanticScuttle tags cache service.
@ -38,19 +33,6 @@ class TagsCacheTest extends PHPUnit_Framework_TestCase
/**
* 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()
{
$this->us =SemanticScuttle_Service_Factory::get('User');
@ -207,9 +189,4 @@ class TagsCacheTest extends PHPUnit_Framework_TestCase
$this->assertEquals(array(), $tcs->getSynonyms('d', 1));
}
}
if (PHPUnit_MAIN_METHOD == 'TagsCacheTest::main') {
TagsCacheTest::main();
}
?>

View File

@ -11,8 +11,6 @@
* @link http://sourceforge.net/projects/semanticscuttle
*/
require_once 'prepare.php';
/**
* Unit tests for the SemanticScuttle user array model.
*

View File

@ -12,11 +12,6 @@
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'UserTest::main');
}
require_once 'prepare.php';
/**
* Unit tests for the SemanticScuttle user service.
@ -31,24 +26,6 @@ require_once 'prepare.php';
*/
class UserTest extends TestBase
{
/**
* 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()
{
$this->us = SemanticScuttle_Service_Factory::get('User');
@ -200,10 +177,4 @@ class UserTest extends TestBase
}
}
if (PHPUnit_MAIN_METHOD == 'UserTest::main') {
UserTest::main();
}
?>

View File

@ -10,11 +10,6 @@
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'VoteTest::main');
}
require_once 'prepare.php';
/**
* Unit tests for the SemanticScuttle voting system.
@ -43,21 +38,6 @@ class VoteTest extends TestBase
/**
* 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('VoteTest')
);
}
public function setUp()
{
$GLOBALS['enableVoting'] = true;
@ -553,9 +533,4 @@ class VoteTest extends TestBase
}
}//class VoteTest extends TestBase
if (PHPUnit_MAIN_METHOD == 'VoteTest::main') {
VoteTest::main();
}
?>

View File

@ -12,14 +12,8 @@
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
require_once dirname(__FILE__) . '/../prepare.php';
require_once 'HTTP/Request2.php';
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'ajax_GetAdminLinkedTagsTest::main');
}
/**
* Unit tests for the ajax linked admin tags script
*
@ -34,22 +28,6 @@ class ajax_GetAdminLinkedTagsTest extends TestBaseApi
protected $urlPart = 'ajax/getadminlinkedtags.php';
/**
* 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__)
);
}
/**
* Verify that we get the configured root tags if
* we do not pass any parameters
@ -139,8 +117,4 @@ class ajax_GetAdminLinkedTagsTest extends TestBaseApi
$this->assertEquals('adminsubtag', $data[0]->data->title);
}
}
if (PHPUnit_MAIN_METHOD == 'ajax_GetAdminLinkedTagsTest::main') {
ajax_GetAdminLinkedTagsTest::main();
}
?>

View File

@ -12,8 +12,6 @@
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
require_once dirname(__FILE__) . '/../prepare.php';
require_once 'HTTP/Request2.php';
/**

View File

@ -12,8 +12,6 @@
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
require_once dirname(__FILE__) . '/../prepare.php';
require_once 'HTTP/Request2.php';
/**