From 1bcfa714a1006f31ba1a03063cb44cec9fe7bc98 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sun, 16 May 2021 23:22:44 +0200 Subject: [PATCH 1/3] Make tests PHPUnit 6.0 compatible --- tests/bootstrap.php | 2 +- tests/datasets/api.fixture.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 34467b7607..b034b092be 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -32,7 +32,7 @@ require __DIR__ . '/../vendor/autoload.php'; // Backward compatibility if (!class_exists(TestCase::class)) { - class_alias(PHPUnit_Framework_TestCase::class, TestCase::class); + class_alias(\PHPUnit\Framework\TestCase::class, TestCase::class); } $dice = new Dice(); diff --git a/tests/datasets/api.fixture.php b/tests/datasets/api.fixture.php index fc6fc6ccfc..fbf2aad47c 100644 --- a/tests/datasets/api.fixture.php +++ b/tests/datasets/api.fixture.php @@ -738,4 +738,4 @@ return [ 'uid' => 42, ], ], -]; \ No newline at end of file +]; From 93c8fdcbd42f9eeaa88dd780fcecc4ec61d82206 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sun, 16 May 2021 23:39:03 +0200 Subject: [PATCH 2/3] Make tests PHPUnit 6.0 compatible --- tests/src/Content/ItemTest.php | 3 +++ tests/src/Core/Cache/ArrayCacheTest.php | 3 +++ tests/src/Core/Cache/MemcacheCacheTest.php | 1 + tests/src/Core/Cache/MemcachedCacheTest.php | 1 + tests/src/Core/Lock/ArrayCacheLockTest.php | 3 +++ tests/src/Core/Lock/MemcacheCacheLockTest.php | 2 ++ tests/src/Core/Lock/MemcachedCacheLockTest.php | 6 ++++++ tests/src/Core/Lock/SemaphoreLockTest.php | 3 +++ tests/src/Util/Emailer/MailBuilderTest.php | 1 + tests/src/Util/Logger/StreamLoggerTest.php | 1 + 10 files changed, 24 insertions(+) diff --git a/tests/src/Content/ItemTest.php b/tests/src/Content/ItemTest.php index b635f8da88..d947eca3b4 100644 --- a/tests/src/Content/ItemTest.php +++ b/tests/src/Content/ItemTest.php @@ -25,6 +25,9 @@ use Friendica\Test\MockedTest; class ItemTest extends MockedTest { + /** + * @doesNotPerformAssertions + */ public function testDetermineCategoriesTerms() { static::markTestIncomplete('Test data needed.'); diff --git a/tests/src/Core/Cache/ArrayCacheTest.php b/tests/src/Core/Cache/ArrayCacheTest.php index ada1fac654..c2e92806ce 100644 --- a/tests/src/Core/Cache/ArrayCacheTest.php +++ b/tests/src/Core/Cache/ArrayCacheTest.php @@ -37,6 +37,9 @@ class ArrayCacheTest extends MemoryCacheTest parent::tearDown(); } + /** + * @doesNotPerformAssertions + */ public function testTTL() { // Array Cache doesn't support TTL diff --git a/tests/src/Core/Cache/MemcacheCacheTest.php b/tests/src/Core/Cache/MemcacheCacheTest.php index 738ff8100f..4947186ccb 100644 --- a/tests/src/Core/Cache/MemcacheCacheTest.php +++ b/tests/src/Core/Cache/MemcacheCacheTest.php @@ -66,6 +66,7 @@ class MemcacheCacheTest extends MemoryCacheTest * @small * * @dataProvider dataSimple + * @doesNotPerformAssertions */ public function testGetAllKeys($value1, $value2, $value3) { diff --git a/tests/src/Core/Cache/MemcachedCacheTest.php b/tests/src/Core/Cache/MemcachedCacheTest.php index 88de1ad41d..842e33d082 100644 --- a/tests/src/Core/Cache/MemcachedCacheTest.php +++ b/tests/src/Core/Cache/MemcachedCacheTest.php @@ -65,6 +65,7 @@ class MemcachedCacheTest extends MemoryCacheTest * @small * * @dataProvider dataSimple + * @doesNotPerformAssertions */ public function testGetAllKeys($value1, $value2, $value3) { diff --git a/tests/src/Core/Lock/ArrayCacheLockTest.php b/tests/src/Core/Lock/ArrayCacheLockTest.php index 6ddedfa438..11ea794c68 100644 --- a/tests/src/Core/Lock/ArrayCacheLockTest.php +++ b/tests/src/Core/Lock/ArrayCacheLockTest.php @@ -31,6 +31,9 @@ class ArrayCacheLockTest extends LockTest return new CacheLock(new ArrayCache('localhost')); } + /** + * @doesNotPerformAssertions + */ public function testLockTTL() { self::markTestSkipped("ArrayCache doesn't support TTL"); diff --git a/tests/src/Core/Lock/MemcacheCacheLockTest.php b/tests/src/Core/Lock/MemcacheCacheLockTest.php index 97e0bfeb85..98266852f9 100644 --- a/tests/src/Core/Lock/MemcacheCacheLockTest.php +++ b/tests/src/Core/Lock/MemcacheCacheLockTest.php @@ -63,6 +63,7 @@ class MemcacheCacheLockTest extends LockTest /** * @small + * @doesNotPerformAssertions */ public function testGetLocks() { @@ -71,6 +72,7 @@ class MemcacheCacheLockTest extends LockTest /** * @small + * @doesNotPerformAssertions */ public function testGetLocksWithPrefix() { diff --git a/tests/src/Core/Lock/MemcachedCacheLockTest.php b/tests/src/Core/Lock/MemcachedCacheLockTest.php index c655fdb593..67d3097fab 100644 --- a/tests/src/Core/Lock/MemcachedCacheLockTest.php +++ b/tests/src/Core/Lock/MemcachedCacheLockTest.php @@ -60,11 +60,17 @@ class MemcachedCacheLockTest extends LockTest return $lock; } + /** + * @doesNotPerformAssertions + */ public function testGetLocks() { static::markTestIncomplete('Race condition because of too fast getLocks() which uses a workaround'); } + /** + * @doesNotPerformAssertions + */ public function testGetLocksWithPrefix() { static::markTestIncomplete('Race condition because of too fast getLocks() which uses a workaround'); diff --git a/tests/src/Core/Lock/SemaphoreLockTest.php b/tests/src/Core/Lock/SemaphoreLockTest.php index ca5d0af7db..87d8b2cd2f 100644 --- a/tests/src/Core/Lock/SemaphoreLockTest.php +++ b/tests/src/Core/Lock/SemaphoreLockTest.php @@ -59,6 +59,9 @@ class SemaphoreLockTest extends LockTest return new SemaphoreLock(); } + /** + * @doesNotPerformAssertions + */ public function testLockTTL() { self::markTestSkipped("Semaphore doesn't work with TTL"); diff --git a/tests/src/Util/Emailer/MailBuilderTest.php b/tests/src/Util/Emailer/MailBuilderTest.php index 933203d156..88452a9dab 100644 --- a/tests/src/Util/Emailer/MailBuilderTest.php +++ b/tests/src/Util/Emailer/MailBuilderTest.php @@ -93,6 +93,7 @@ class MailBuilderTest extends MockedTest * Test if the builder can create full rendered emails * * @todo Create test once "Renderer" and "BBCode" are dynamic + * @doesNotPerformAssertions */ public function testBuilderWithNonRawEmail() { diff --git a/tests/src/Util/Logger/StreamLoggerTest.php b/tests/src/Util/Logger/StreamLoggerTest.php index 7a3315e7ef..f6bf3313a9 100644 --- a/tests/src/Util/Logger/StreamLoggerTest.php +++ b/tests/src/Util/Logger/StreamLoggerTest.php @@ -193,6 +193,7 @@ class StreamLoggerTest extends AbstractLoggerTest /** * Test a relative path + * @doesNotPerformAssertions */ public function testRealPath() { From ef7eb60749fd144565d338e366941bc65a6ffe18 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sun, 16 May 2021 23:49:40 +0200 Subject: [PATCH 3/3] Make tests PHPUnit 7.5 compatible --- tests/legacy/ApiTest.php | 128 +++++++++++++++++++-------------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/tests/legacy/ApiTest.php b/tests/legacy/ApiTest.php index 67daca802a..6dd4066898 100644 --- a/tests/legacy/ApiTest.php +++ b/tests/legacy/ApiTest.php @@ -303,10 +303,10 @@ class ApiTest extends FixtureTest * @runInSeparateProcess * @preserveGlobalState disabled * @preserveGlobalState disabled - * @expectedException Friendica\Network\HTTPException\UnauthorizedException */ public function testApiLoginWithoutLogin() { + $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); api_login($this->app); } @@ -316,10 +316,10 @@ class ApiTest extends FixtureTest * @runInSeparateProcess * @preserveGlobalState disabled * @preserveGlobalState disabled - * @expectedException Friendica\Network\HTTPException\UnauthorizedException */ public function testApiLoginWithBadLogin() { + $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); $_SERVER['PHP_AUTH_USER'] = 'user@server'; api_login($this->app); } @@ -363,10 +363,10 @@ class ApiTest extends FixtureTest * * @runInSeparateProcess * @preserveGlobalState disabled - * @expectedException Friendica\Network\HTTPException\UnauthorizedException */ public function testApiLoginWithRemoteUser() { + $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); $_SERVER['REDIRECT_REMOTE_USER'] = '123456dXNlcjpwYXNzd29yZA=='; api_login($this->app); } @@ -886,10 +886,10 @@ class ApiTest extends FixtureTest * Test the api_get_user() function with a wrong user ID in a GET parameter. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiGetUserWithWrongGetId() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); $_GET['user_id'] = $this->wrongUserId; self::assertOtherUser(api_get_user($this->app)); } @@ -955,10 +955,10 @@ class ApiTest extends FixtureTest * Test the api_get_user() function with a wrong user ID. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiGetUserWithWrongUser() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); self::assertOtherUser(api_get_user($this->app, $this->wrongUserId)); } @@ -1151,10 +1151,10 @@ class ApiTest extends FixtureTest * Test the api_account_verify_credentials() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiAccountVerifyCredentialsWithoutAuthenticatedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['authenticated'] = false; api_account_verify_credentials('json'); } @@ -1221,10 +1221,10 @@ class ApiTest extends FixtureTest * Test the api_statuses_mediap() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiStatusesMediapWithoutAuthenticatedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['authenticated'] = false; api_statuses_mediap('json'); } @@ -1273,10 +1273,10 @@ class ApiTest extends FixtureTest * Test the api_statuses_update() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiStatusesUpdateWithoutAuthenticatedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['authenticated'] = false; api_statuses_update('json'); } @@ -1315,10 +1315,10 @@ class ApiTest extends FixtureTest * Test the api_media_upload() function. * @runInSeparateProcess * @preserveGlobalState disabled - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiMediaUpload() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); api_media_upload(); } @@ -1326,10 +1326,10 @@ class ApiTest extends FixtureTest * Test the api_media_upload() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiMediaUploadWithoutAuthenticatedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['authenticated'] = false; api_media_upload(); } @@ -1338,10 +1338,10 @@ class ApiTest extends FixtureTest * Test the api_media_upload() function with an invalid uploaded media. * * @return void - * @expectedException Friendica\Network\HTTPException\InternalServerErrorException */ public function testApiMediaUploadWithMedia() { + $this->expectException(\Friendica\Network\HTTPException\InternalServerErrorException::class); $_FILES = [ 'media' => [ 'id' => 666, @@ -1463,10 +1463,10 @@ class ApiTest extends FixtureTest * Test the api_users_search() function without a GET q parameter. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiUsersSearchWithoutQuery() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); api_users_search('json'); } @@ -1474,10 +1474,10 @@ class ApiTest extends FixtureTest * Test the api_users_lookup() function. * * @return void - * @expectedException Friendica\Network\HTTPException\NotFoundException */ public function testApiUsersLookup() { + $this->expectException(\Friendica\Network\HTTPException\NotFoundException::class); api_users_lookup('json'); } @@ -1574,10 +1574,10 @@ class ApiTest extends FixtureTest * Test the api_search() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiSearchWithUnallowedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['allow_api'] = false; $_GET['screen_name'] = $this->selfUser['nick']; api_search('json'); @@ -1587,10 +1587,10 @@ class ApiTest extends FixtureTest * Test the api_search() function without any GET query parameter. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiSearchWithoutQuery() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); api_search('json'); } @@ -1630,10 +1630,10 @@ class ApiTest extends FixtureTest * Test the api_statuses_home_timeline() with an unallowed user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiStatusesHomeTimelineWithUnallowedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['allow_api'] = false; $_GET['screen_name'] = $this->selfUser['nick']; api_statuses_home_timeline('json'); @@ -1701,10 +1701,10 @@ class ApiTest extends FixtureTest * Test the api_statuses_public_timeline() function with an unallowed user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiStatusesPublicTimelineWithUnallowedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['allow_api'] = false; $_GET['screen_name'] = $this->selfUser['nick']; api_statuses_public_timeline('json'); @@ -1755,10 +1755,10 @@ class ApiTest extends FixtureTest * Test the api_statuses_networkpublic_timeline() function with an unallowed user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiStatusesNetworkpublicTimelineWithUnallowedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['allow_api'] = false; $_GET['screen_name'] = $this->selfUser['nick']; api_statuses_networkpublic_timeline('json'); @@ -1779,10 +1779,10 @@ class ApiTest extends FixtureTest * Test the api_statuses_show() function. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiStatusesShow() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); api_statuses_show('json'); } @@ -1818,10 +1818,10 @@ class ApiTest extends FixtureTest * Test the api_statuses_show() function with an unallowed user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiStatusesShowWithUnallowedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['allow_api'] = false; $_GET['screen_name'] = $this->selfUser['nick']; api_statuses_show('json'); @@ -1831,10 +1831,10 @@ class ApiTest extends FixtureTest * Test the api_conversation_show() function. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiConversationShow() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); api_conversation_show('json'); } @@ -1859,10 +1859,10 @@ class ApiTest extends FixtureTest * Test the api_conversation_show() function with an unallowed user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiConversationShowWithUnallowedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['allow_api'] = false; $_GET['screen_name'] = $this->selfUser['nick']; api_conversation_show('json'); @@ -1872,10 +1872,10 @@ class ApiTest extends FixtureTest * Test the api_statuses_repeat() function. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiStatusesRepeat() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); api_statuses_repeat('json'); } @@ -1883,10 +1883,10 @@ class ApiTest extends FixtureTest * Test the api_statuses_repeat() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiStatusesRepeatWithoutAuthenticatedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['authenticated'] = false; api_statuses_repeat('json'); } @@ -1912,10 +1912,10 @@ class ApiTest extends FixtureTest * Test the api_statuses_destroy() function. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiStatusesDestroy() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); api_statuses_destroy('json'); } @@ -1923,10 +1923,10 @@ class ApiTest extends FixtureTest * Test the api_statuses_destroy() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiStatusesDestroyWithoutAuthenticatedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['authenticated'] = false; api_statuses_destroy('json'); } @@ -1973,10 +1973,10 @@ class ApiTest extends FixtureTest * Test the api_statuses_mentions() function with an unallowed user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiStatusesMentionsWithUnallowedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['allow_api'] = false; $_GET['screen_name'] = $this->selfUser['nick']; api_statuses_mentions('json'); @@ -2040,10 +2040,10 @@ class ApiTest extends FixtureTest * Test the api_statuses_user_timeline() function with an unallowed user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiStatusesUserTimelineWithUnallowedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['allow_api'] = false; $_GET['screen_name'] = $this->selfUser['nick']; api_statuses_user_timeline('json'); @@ -2053,10 +2053,10 @@ class ApiTest extends FixtureTest * Test the api_favorites_create_destroy() function. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiFavoritesCreateDestroy() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); $this->app->argv = ['api', '1.1', 'favorites', 'create']; $this->app->argc = count($this->app->argv); api_favorites_create_destroy('json'); @@ -2066,10 +2066,10 @@ class ApiTest extends FixtureTest * Test the api_favorites_create_destroy() function with an invalid ID. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiFavoritesCreateDestroyWithInvalidId() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); $this->app->argv = ['api', '1.1', 'favorites', 'create', '12.json']; $this->app->argc = count($this->app->argv); api_favorites_create_destroy('json'); @@ -2079,10 +2079,10 @@ class ApiTest extends FixtureTest * Test the api_favorites_create_destroy() function with an invalid action. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiFavoritesCreateDestroyWithInvalidAction() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); $this->app->argv = ['api', '1.1', 'favorites', 'change.json']; $this->app->argc = count($this->app->argv); $_REQUEST['id'] = 1; @@ -2135,10 +2135,10 @@ class ApiTest extends FixtureTest * Test the api_favorites_create_destroy() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiFavoritesCreateDestroyWithoutAuthenticatedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $this->app->argv = ['api', '1.1', 'favorites', 'create.json']; $this->app->argc = count($this->app->argv); $_SESSION['authenticated'] = false; @@ -2175,10 +2175,10 @@ class ApiTest extends FixtureTest * Test the api_favorites() function with an unallowed user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiFavoritesWithUnallowedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['allow_api'] = false; $_GET['screen_name'] = $this->selfUser['nick']; api_favorites('json'); @@ -2593,10 +2593,10 @@ class ApiTest extends FixtureTest * Test the api_lists_ownerships() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiListsOwnershipsWithoutAuthenticatedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['authenticated'] = false; api_lists_ownerships('json'); } @@ -2604,11 +2604,11 @@ class ApiTest extends FixtureTest /** * Test the api_lists_statuses() function. * - * @expectedException Friendica\Network\HTTPException\BadRequestException * @return void */ public function testApiListsStatuses() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); api_lists_statuses('json'); } @@ -2643,10 +2643,10 @@ class ApiTest extends FixtureTest * Test the api_lists_statuses() function with an unallowed user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiListsStatusesWithUnallowedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['allow_api'] = false; $_GET['screen_name'] = $this->selfUser['nick']; api_lists_statuses('json'); @@ -2842,10 +2842,10 @@ class ApiTest extends FixtureTest * Test the api_direct_messages_new() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiDirectMessagesNewWithoutAuthenticatedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['authenticated'] = false; api_direct_messages_new('json'); } @@ -2915,10 +2915,10 @@ class ApiTest extends FixtureTest * Test the api_direct_messages_destroy() function. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiDirectMessagesDestroy() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); api_direct_messages_destroy('json'); } @@ -2946,10 +2946,10 @@ class ApiTest extends FixtureTest * Test the api_direct_messages_destroy() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiDirectMessagesDestroyWithoutAuthenticatedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['authenticated'] = false; api_direct_messages_destroy('json'); } @@ -2958,10 +2958,10 @@ class ApiTest extends FixtureTest * Test the api_direct_messages_destroy() function with a non-zero ID. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiDirectMessagesDestroyWithId() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); $_REQUEST['id'] = 1; api_direct_messages_destroy('json'); } @@ -3078,10 +3078,10 @@ class ApiTest extends FixtureTest * Test the api_direct_messages_box() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiDirectMessagesBoxWithUnallowedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['allow_api'] = false; $_GET['screen_name'] = $this->selfUser['nick']; api_direct_messages_box('json', 'sentbox', 'false'); @@ -3155,10 +3155,10 @@ class ApiTest extends FixtureTest * Test the api_fr_photoalbum_delete() function. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiFrPhotoalbumDelete() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); api_fr_photoalbum_delete('json'); } @@ -3166,10 +3166,10 @@ class ApiTest extends FixtureTest * Test the api_fr_photoalbum_delete() function with an album name. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiFrPhotoalbumDeleteWithAlbum() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); $_REQUEST['album'] = 'album_name'; api_fr_photoalbum_delete('json'); } @@ -3188,10 +3188,10 @@ class ApiTest extends FixtureTest * Test the api_fr_photoalbum_delete() function. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiFrPhotoalbumUpdate() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); api_fr_photoalbum_update('json'); } @@ -3199,10 +3199,10 @@ class ApiTest extends FixtureTest * Test the api_fr_photoalbum_delete() function with an album name. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiFrPhotoalbumUpdateWithAlbum() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); $_REQUEST['album'] = 'album_name'; api_fr_photoalbum_update('json'); } @@ -3211,10 +3211,10 @@ class ApiTest extends FixtureTest * Test the api_fr_photoalbum_delete() function with an album name. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiFrPhotoalbumUpdateWithAlbumAndNewAlbum() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); $_REQUEST['album'] = 'album_name'; $_REQUEST['album_new'] = 'album_name'; api_fr_photoalbum_update('json'); @@ -3224,10 +3224,10 @@ class ApiTest extends FixtureTest * Test the api_fr_photoalbum_update() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiFrPhotoalbumUpdateWithoutAuthenticatedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['authenticated'] = false; api_fr_photoalbum_update('json'); } @@ -3257,20 +3257,20 @@ class ApiTest extends FixtureTest * Test the api_fr_photos_list() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiFrPhotosListWithoutAuthenticatedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['authenticated'] = false; api_fr_photos_list('json'); } /** * Test the api_fr_photo_create_update() function. - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiFrPhotoCreateUpdate() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); api_fr_photo_create_update('json'); } @@ -3278,10 +3278,10 @@ class ApiTest extends FixtureTest * Test the api_fr_photo_create_update() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiFrPhotoCreateUpdateWithoutAuthenticatedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['authenticated'] = false; api_fr_photo_create_update('json'); } @@ -3290,10 +3290,10 @@ class ApiTest extends FixtureTest * Test the api_fr_photo_create_update() function with an album name. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiFrPhotoCreateUpdateWithAlbum() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); $_REQUEST['album'] = 'album_name'; api_fr_photo_create_update('json'); } @@ -3322,10 +3322,10 @@ class ApiTest extends FixtureTest * Test the api_fr_photo_delete() function. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiFrPhotoDelete() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); api_fr_photo_delete('json'); } @@ -3333,10 +3333,10 @@ class ApiTest extends FixtureTest * Test the api_fr_photo_delete() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiFrPhotoDeleteWithoutAuthenticatedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['authenticated'] = false; api_fr_photo_delete('json'); } @@ -3345,10 +3345,10 @@ class ApiTest extends FixtureTest * Test the api_fr_photo_delete() function with a photo ID. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiFrPhotoDeleteWithPhotoId() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); $_REQUEST['photo_id'] = 1; api_fr_photo_delete('json'); } @@ -3367,10 +3367,10 @@ class ApiTest extends FixtureTest * Test the api_fr_photo_detail() function. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiFrPhotoDetail() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); api_fr_photo_detail('json'); } @@ -3378,10 +3378,10 @@ class ApiTest extends FixtureTest * Test the api_fr_photo_detail() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiFrPhotoDetailWithoutAuthenticatedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['authenticated'] = false; api_fr_photo_detail('json'); } @@ -3390,10 +3390,10 @@ class ApiTest extends FixtureTest * Test the api_fr_photo_detail() function with a photo ID. * * @return void - * @expectedException Friendica\Network\HTTPException\NotFoundException */ public function testApiFrPhotoDetailWithPhotoId() { + $this->expectException(\Friendica\Network\HTTPException\NotFoundException::class); $_REQUEST['photo_id'] = 1; api_fr_photo_detail('json'); } @@ -3412,10 +3412,10 @@ class ApiTest extends FixtureTest * Test the api_account_update_profile_image() function. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiAccountUpdateProfileImage() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); api_account_update_profile_image('json'); } @@ -3423,10 +3423,10 @@ class ApiTest extends FixtureTest * Test the api_account_update_profile_image() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiAccountUpdateProfileImageWithoutAuthenticatedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['authenticated'] = false; api_account_update_profile_image('json'); } @@ -3435,10 +3435,10 @@ class ApiTest extends FixtureTest * Test the api_account_update_profile_image() function with an uploaded file. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiAccountUpdateProfileImageWithUpload() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); $this->markTestIncomplete(); } @@ -3519,10 +3519,10 @@ class ApiTest extends FixtureTest * Test the api_friendica_remoteauth() function. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiFriendicaRemoteauth() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); api_friendica_remoteauth(); } @@ -3530,10 +3530,10 @@ class ApiTest extends FixtureTest * Test the api_friendica_remoteauth() function with an URL. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiFriendicaRemoteauthWithUrl() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); $_GET['url'] = 'url'; $_GET['c_url'] = 'url'; api_friendica_remoteauth(); @@ -3727,10 +3727,10 @@ class ApiTest extends FixtureTest * Test the api_friendica_notification() function. * * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException */ public function testApiFriendicaNotification() { + $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); api_friendica_notification('json'); } @@ -3738,10 +3738,10 @@ class ApiTest extends FixtureTest * Test the api_friendica_notification() function without an authenticated user. * * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException */ public function testApiFriendicaNotificationWithoutAuthenticatedUser() { + $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); $_SESSION['authenticated'] = false; api_friendica_notification('json'); }