From a756799ef4df0449244d41c2ecc7133c3fb8ce70 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Sat, 26 Mar 2011 17:04:00 +0100 Subject: move setUnittestConfig to TestBaseApi since it makes only sense to use it there --- tests/ajax/GetAdminTagsTest.php | 63 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 tests/ajax/GetAdminTagsTest.php (limited to 'tests/ajax/GetAdminTagsTest.php') diff --git a/tests/ajax/GetAdminTagsTest.php b/tests/ajax/GetAdminTagsTest.php new file mode 100644 index 0000000..5c941e8 --- /dev/null +++ b/tests/ajax/GetAdminTagsTest.php @@ -0,0 +1,63 @@ + + * @author Christian Weiske + * @author Eric Dane + * @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'; + +/** + * Unit tests for the ajax getadmintags.php script + * + * @category Bookmarking + * @package SemanticScuttle + * @author Christian Weiske + * @license GPL http://www.gnu.org/licenses/gpl.html + * @link http://sourceforge.net/projects/semanticscuttle + */ +class ajax_GetAdminTagsTest extends TestBaseApi +{ + protected $urlPart = 'ajax/getadmintags.php'; + + + public function testTags() + { + list($user1, $uname1) = $this->addUserData(); + $user2 = $this->addUser(); + $this->addBookmark($user1, null, 0, array('admintag', 'admintag2')); + $this->addBookmark($user2, null, 0, array('lusertag', 'lusertag2')); + + $this->setUnittestConfig( + array( + 'admin_users' => array($uname1) + ) + ); + + $req = $this->getRequest('?unittestMode=1'); + $res = $req->send(); + $this->assertEquals(200, $res->getStatus()); + $this->assertEquals( + 'application/json; charset=utf-8', + $res->getHeader('content-type') + ); + $data = json_decode($res->getBody()); + $this->assertInternalType('array', $data); + $this->assertEquals(2, count($data)); + $this->assertContains('admintag', $data); + $this->assertContains('admintag2', $data); + } + +} + + +?> \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 1dfff5d3d81fdb67e4c78136168801a488fcf139 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 28 Mar 2011 08:01:02 +0200 Subject: add tests for getadmintags beginsWith and limit parameters --- tests/ajax/GetAdminTagsTest.php | 79 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) (limited to 'tests/ajax/GetAdminTagsTest.php') diff --git a/tests/ajax/GetAdminTagsTest.php b/tests/ajax/GetAdminTagsTest.php index 5c941e8..6afe45c 100644 --- a/tests/ajax/GetAdminTagsTest.php +++ b/tests/ajax/GetAdminTagsTest.php @@ -57,6 +57,85 @@ class ajax_GetAdminTagsTest extends TestBaseApi $this->assertContains('admintag2', $data); } + public function testParameterBeginsWith() + { + list($user1, $uname1) = $this->addUserData(); + $this->addBookmark($user1, null, 0, array('foo', 'foobar', 'bar')); + + $this->setUnittestConfig( + array( + 'admin_users' => array($uname1) + ) + ); + + $req = $this->getRequest('?unittestMode=1&beginsWith=foo'); + $res = $req->send(); + $this->assertEquals(200, $res->getStatus()); + $this->assertEquals( + 'application/json; charset=utf-8', + $res->getHeader('content-type') + ); + $data = json_decode($res->getBody()); + $this->assertInternalType('array', $data); + $this->assertEquals(2, count($data)); + $this->assertContains('foo', $data); + $this->assertContains('foobar', $data); + } + + + + public function testParameterLimit() + { + list($user1, $uname1) = $this->addUserData(); + list($user2, $uname2) = $this->addUserData(); + $this->addBookmark($user1, null, 0, array('foo', 'foobar')); + $this->addBookmark($user2, null, 0, array('foo', 'bar')); + + $this->setUnittestConfig( + array( + 'admin_users' => array($uname1, $uname2) + ) + ); + + $req = $this->getRequest('?unittestMode=1&limit=1'); + $res = $req->send(); + $this->assertEquals(200, $res->getStatus()); + $this->assertEquals( + 'application/json; charset=utf-8', + $res->getHeader('content-type') + ); + $data = json_decode($res->getBody()); + $this->assertInternalType('array', $data); + $this->assertEquals(1, count($data)); + $this->assertContains('foo', $data); + + $req = $this->getRequest('?unittestMode=1&limit=2'); + $res = $req->send(); + $this->assertEquals(200, $res->getStatus()); + $this->assertEquals( + 'application/json; charset=utf-8', + $res->getHeader('content-type') + ); + $data = json_decode($res->getBody()); + $this->assertInternalType('array', $data); + $this->assertEquals(2, count($data)); + $this->assertContains('foo', $data); + + $req = $this->getRequest('?unittestMode=1&limit=3'); + $res = $req->send(); + $this->assertEquals(200, $res->getStatus()); + $this->assertEquals( + 'application/json; charset=utf-8', + $res->getHeader('content-type') + ); + $data = json_decode($res->getBody()); + $this->assertInternalType('array', $data); + $this->assertEquals(3, count($data)); + $this->assertContains('foo', $data); + $this->assertContains('foobar', $data); + $this->assertContains('bar', $data); + } + } -- cgit v1.2.3-54-g00ecf From a5bd7789297378be3fb8dc3814c6649ea82a88d8 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 28 Mar 2011 08:34:12 +0200 Subject: introduce assertResponseJson200 for API/ajax tests and use it --- tests/TestBaseApi.php | 19 +++++++++++++++++++ tests/ajax/GetAdminLinkedTagsTest.php | 20 +++----------------- tests/ajax/GetAdminTagsTest.php | 30 +++++------------------------- tests/ajax/GetContactTagsTest.php | 26 +++++--------------------- 4 files changed, 32 insertions(+), 63 deletions(-) (limited to 'tests/ajax/GetAdminTagsTest.php') diff --git a/tests/TestBaseApi.php b/tests/TestBaseApi.php index 2341ea1..f054973 100644 --- a/tests/TestBaseApi.php +++ b/tests/TestBaseApi.php @@ -172,6 +172,25 @@ class TestBaseApi extends TestBase + /** + * Verifies that the HTTP response has status code 200 and + * content-type application/json; charset=utf-8 + * + * @param HTTP_Request2_Response $res HTTP Response object + * + * @return void + */ + protected function assertResponseJson200(HTTP_Request2_Response $res) + { + $this->assertEquals(200, $res->getStatus()); + $this->assertEquals( + 'application/json; charset=utf-8', + $res->getHeader('content-type') + ); + } + + + /** * Writes a special unittest configuration file. * The unittest config file is read when a GET request with unittestMode=1 diff --git a/tests/ajax/GetAdminLinkedTagsTest.php b/tests/ajax/GetAdminLinkedTagsTest.php index 2552ea0..aded834 100644 --- a/tests/ajax/GetAdminLinkedTagsTest.php +++ b/tests/ajax/GetAdminLinkedTagsTest.php @@ -58,13 +58,7 @@ class ajax_GetAdminLinkedTagsTest extends TestBaseApi { $req = $this->getRequest(); $res = $req->send(); - - $this->assertEquals(200, $res->getStatus()); - $this->assertEquals( - 'application/json; charset=utf-8', - $res->getHeader('content-type') - ); - + $this->assertResponseJson200($res); $data = json_decode($res->getBody()); $this->assertInternalType('array', $data); @@ -99,11 +93,7 @@ class ajax_GetAdminLinkedTagsTest extends TestBaseApi ); $res = $this->getRequest('?tag=' . $menu2Tag)->send(); - $this->assertEquals(200, $res->getStatus()); - $this->assertEquals( - 'application/json; charset=utf-8', - $res->getHeader('content-type') - ); + $this->assertResponseJson200($res); $data = json_decode($res->getBody()); $this->assertInternalType('array', $data); @@ -139,11 +129,7 @@ class ajax_GetAdminLinkedTagsTest extends TestBaseApi ); $res = $this->getRequest('?tag=' . $menu2Tag)->send(); - $this->assertEquals(200, $res->getStatus()); - $this->assertEquals( - 'application/json; charset=utf-8', - $res->getHeader('content-type') - ); + $this->assertResponseJson200($res); $data = json_decode($res->getBody()); $this->assertInternalType('array', $data); diff --git a/tests/ajax/GetAdminTagsTest.php b/tests/ajax/GetAdminTagsTest.php index 6afe45c..80d702f 100644 --- a/tests/ajax/GetAdminTagsTest.php +++ b/tests/ajax/GetAdminTagsTest.php @@ -45,11 +45,7 @@ class ajax_GetAdminTagsTest extends TestBaseApi $req = $this->getRequest('?unittestMode=1'); $res = $req->send(); - $this->assertEquals(200, $res->getStatus()); - $this->assertEquals( - 'application/json; charset=utf-8', - $res->getHeader('content-type') - ); + $this->assertResponseJson200($res); $data = json_decode($res->getBody()); $this->assertInternalType('array', $data); $this->assertEquals(2, count($data)); @@ -70,12 +66,8 @@ class ajax_GetAdminTagsTest extends TestBaseApi $req = $this->getRequest('?unittestMode=1&beginsWith=foo'); $res = $req->send(); - $this->assertEquals(200, $res->getStatus()); - $this->assertEquals( - 'application/json; charset=utf-8', - $res->getHeader('content-type') - ); $data = json_decode($res->getBody()); + $this->assertResponseJson200($res); $this->assertInternalType('array', $data); $this->assertEquals(2, count($data)); $this->assertContains('foo', $data); @@ -99,11 +91,7 @@ class ajax_GetAdminTagsTest extends TestBaseApi $req = $this->getRequest('?unittestMode=1&limit=1'); $res = $req->send(); - $this->assertEquals(200, $res->getStatus()); - $this->assertEquals( - 'application/json; charset=utf-8', - $res->getHeader('content-type') - ); + $this->assertResponseJson200($res); $data = json_decode($res->getBody()); $this->assertInternalType('array', $data); $this->assertEquals(1, count($data)); @@ -111,11 +99,7 @@ class ajax_GetAdminTagsTest extends TestBaseApi $req = $this->getRequest('?unittestMode=1&limit=2'); $res = $req->send(); - $this->assertEquals(200, $res->getStatus()); - $this->assertEquals( - 'application/json; charset=utf-8', - $res->getHeader('content-type') - ); + $this->assertResponseJson200($res); $data = json_decode($res->getBody()); $this->assertInternalType('array', $data); $this->assertEquals(2, count($data)); @@ -123,11 +107,7 @@ class ajax_GetAdminTagsTest extends TestBaseApi $req = $this->getRequest('?unittestMode=1&limit=3'); $res = $req->send(); - $this->assertEquals(200, $res->getStatus()); - $this->assertEquals( - 'application/json; charset=utf-8', - $res->getHeader('content-type') - ); + $this->assertResponseJson200($res); $data = json_decode($res->getBody()); $this->assertInternalType('array', $data); $this->assertEquals(3, count($data)); diff --git a/tests/ajax/GetContactTagsTest.php b/tests/ajax/GetContactTagsTest.php index 682173b..559040f 100644 --- a/tests/ajax/GetContactTagsTest.php +++ b/tests/ajax/GetContactTagsTest.php @@ -36,11 +36,7 @@ class ajax_GetContactTagsTest extends TestBaseApi public function testNoUserLoggedIn() { $res = $this->getRequest()->send(); - $this->assertEquals(200, $res->getStatus()); - $this->assertEquals( - 'application/json; charset=utf-8', - $res->getHeader('content-type') - ); + $this->assertResponseJson200($res); $data = json_decode($res->getBody()); $this->assertInternalType('array', $data); $this->assertEquals(0, count($data)); @@ -59,11 +55,7 @@ class ajax_GetContactTagsTest extends TestBaseApi $this->addBookmark($user2, null, 0, array('user2tag')); $res = $req->send(); - $this->assertEquals(200, $res->getStatus()); - $this->assertEquals( - 'application/json; charset=utf-8', - $res->getHeader('content-type') - ); + $this->assertResponseJson200($res); $data = json_decode($res->getBody()); $this->assertInternalType('array', $data); $this->assertEquals(3, count($data)); @@ -78,11 +70,7 @@ class ajax_GetContactTagsTest extends TestBaseApi $this->addBookmark($uId, null, 0, array('foobar', 'barmann')); $res = $req->send(); - $this->assertEquals(200, $res->getStatus()); - $this->assertEquals( - 'application/json; charset=utf-8', - $res->getHeader('content-type') - ); + $this->assertResponseJson200($res); $data = json_decode($res->getBody()); $this->assertInternalType('array', $data); $this->assertEquals(1, count($data)); @@ -95,11 +83,7 @@ class ajax_GetContactTagsTest extends TestBaseApi $this->addBookmark($uId, null, 0, array('foo', 'bar', 'baz', 'omg')); $res = $req->send(); - $this->assertEquals(200, $res->getStatus()); - $this->assertEquals( - 'application/json; charset=utf-8', - $res->getHeader('content-type') - ); + $this->assertResponseJson200($res); $data = json_decode($res->getBody()); $this->assertInternalType('array', $data); $this->assertEquals(2, count($data)); @@ -107,7 +91,7 @@ class ajax_GetContactTagsTest extends TestBaseApi $req2 = $this->getRequest('?limit=3'); $req2->setCookieJar($req->getCookieJar()); $res = $req2->send(); - $this->assertEquals(200, $res->getStatus()); + $this->assertResponseJson200($res); $data = json_decode($res->getBody()); $this->assertInternalType('array', $data); $this->assertEquals(3, count($data)); -- cgit v1.2.3-54-g00ecf From bdebe6598c52a74f7040e3a11198b3554fa58f54 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 12 Apr 2011 09:29:59 +0200 Subject: 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 --- tests/AllTests.php | 25 ++----------------------- tests/Api/ExportCsvTest.php | 25 ------------------------- tests/Api/PostsAddTest.php | 25 ------------------------- tests/Api/PostsDeleteTest.php | 25 ------------------------- tests/Api/PostsUpdateTest.php | 25 ------------------------- tests/Bookmark2TagTest.php | 24 ------------------------ tests/BookmarkTest.php | 26 -------------------------- tests/CommonDescriptionTest.php | 25 ------------------------- tests/SearchHistoryTest.php | 27 --------------------------- tests/Tag2TagTest.php | 25 ------------------------- tests/TagTest.php | 26 -------------------------- tests/TagsCacheTest.php | 23 ----------------------- tests/UserArrayTest.php | 2 -- tests/UserTest.php | 29 ----------------------------- tests/VoteTest.php | 25 ------------------------- tests/ajax/GetAdminLinkedTagsTest.php | 26 -------------------------- tests/ajax/GetAdminTagsTest.php | 2 -- tests/ajax/GetContactTagsTest.php | 2 -- 18 files changed, 2 insertions(+), 385 deletions(-) (limited to 'tests/ajax/GetAdminTagsTest.php') diff --git a/tests/AllTests.php b/tests/AllTests.php index 4afcc6b..9e825e8 100644 --- a/tests/AllTests.php +++ b/tests/AllTests.php @@ -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(); -} - ?> \ No newline at end of file diff --git a/tests/Api/ExportCsvTest.php b/tests/Api/ExportCsvTest.php index 2bff8a5..681f0de 100644 --- a/tests/Api/ExportCsvTest.php +++ b/tests/Api/ExportCsvTest.php @@ -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(); -} ?> \ No newline at end of file diff --git a/tests/Api/PostsAddTest.php b/tests/Api/PostsAddTest.php index 1f21d04..53aa8e7 100644 --- a/tests/Api/PostsAddTest.php +++ b/tests/Api/PostsAddTest.php @@ -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(); -} ?> \ No newline at end of file diff --git a/tests/Api/PostsDeleteTest.php b/tests/Api/PostsDeleteTest.php index d9fb6cd..7ba1285 100644 --- a/tests/Api/PostsDeleteTest.php +++ b/tests/Api/PostsDeleteTest.php @@ -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(); -} ?> \ No newline at end of file diff --git a/tests/Api/PostsUpdateTest.php b/tests/Api/PostsUpdateTest.php index c497a55..51f8be2 100644 --- a/tests/Api/PostsUpdateTest.php +++ b/tests/Api/PostsUpdateTest.php @@ -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(); -} ?> \ No newline at end of file diff --git a/tests/Bookmark2TagTest.php b/tests/Bookmark2TagTest.php index fff4222..789540f 100644 --- a/tests/Bookmark2TagTest.php +++ b/tests/Bookmark2TagTest.php @@ -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(); -} ?> \ No newline at end of file diff --git a/tests/BookmarkTest.php b/tests/BookmarkTest.php index f54fe9a..e7ce488 100644 --- a/tests/BookmarkTest.php +++ b/tests/BookmarkTest.php @@ -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(); } ?> diff --git a/tests/CommonDescriptionTest.php b/tests/CommonDescriptionTest.php index 94f431d..7748cb3 100644 --- a/tests/CommonDescriptionTest.php +++ b/tests/CommonDescriptionTest.php @@ -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(); -} ?> diff --git a/tests/SearchHistoryTest.php b/tests/SearchHistoryTest.php index 69d1efa..f05dd29 100644 --- a/tests/SearchHistoryTest.php +++ b/tests/SearchHistoryTest.php @@ -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(); -} - ?> diff --git a/tests/Tag2TagTest.php b/tests/Tag2TagTest.php index 033fc91..0b73864 100644 --- a/tests/Tag2TagTest.php +++ b/tests/Tag2TagTest.php @@ -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(); -} ?> diff --git a/tests/TagTest.php b/tests/TagTest.php index 25d1a77..96f3f14 100644 --- a/tests/TagTest.php +++ b/tests/TagTest.php @@ -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(); -} ?> diff --git a/tests/TagsCacheTest.php b/tests/TagsCacheTest.php index 94200dd..1f69b58 100644 --- a/tests/TagsCacheTest.php +++ b/tests/TagsCacheTest.php @@ -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(); -} - ?> diff --git a/tests/UserArrayTest.php b/tests/UserArrayTest.php index cb53f15..a60e37f 100644 --- a/tests/UserArrayTest.php +++ b/tests/UserArrayTest.php @@ -11,8 +11,6 @@ * @link http://sourceforge.net/projects/semanticscuttle */ -require_once 'prepare.php'; - /** * Unit tests for the SemanticScuttle user array model. * diff --git a/tests/UserTest.php b/tests/UserTest.php index 49f3730..2f57112 100644 --- a/tests/UserTest.php +++ b/tests/UserTest.php @@ -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(); -} - ?> \ No newline at end of file diff --git a/tests/VoteTest.php b/tests/VoteTest.php index 1623826..0073678 100644 --- a/tests/VoteTest.php +++ b/tests/VoteTest.php @@ -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(); -} ?> \ No newline at end of file diff --git a/tests/ajax/GetAdminLinkedTagsTest.php b/tests/ajax/GetAdminLinkedTagsTest.php index aded834..43cb17a 100644 --- a/tests/ajax/GetAdminLinkedTagsTest.php +++ b/tests/ajax/GetAdminLinkedTagsTest.php @@ -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(); -} ?> \ No newline at end of file diff --git a/tests/ajax/GetAdminTagsTest.php b/tests/ajax/GetAdminTagsTest.php index 80d702f..8bf8a83 100644 --- a/tests/ajax/GetAdminTagsTest.php +++ b/tests/ajax/GetAdminTagsTest.php @@ -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'; /** diff --git a/tests/ajax/GetContactTagsTest.php b/tests/ajax/GetContactTagsTest.php index 559040f..268ed66 100644 --- a/tests/ajax/GetContactTagsTest.php +++ b/tests/ajax/GetContactTagsTest.php @@ -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'; /** -- cgit v1.2.3-54-g00ecf