From 95e3583c68429ee306104599bec410973723175c Mon Sep 17 00:00:00 2001 From: Philipp Date: Thu, 30 Dec 2021 20:04:32 +0100 Subject: [PATCH] Move DirectMessages/All tests --- tests/legacy/ApiTest.php | 22 ------------ .../Api/Twitter/DirectMessages/AllTest.php | 36 +++++++++++++++++++ .../Api/Twitter/DirectMessages/InboxTest.php | 2 -- 3 files changed, 36 insertions(+), 24 deletions(-) create mode 100644 tests/src/Module/Api/Twitter/DirectMessages/AllTest.php diff --git a/tests/legacy/ApiTest.php b/tests/legacy/ApiTest.php index 5203e90a55..c4b6c373fe 100644 --- a/tests/legacy/ApiTest.php +++ b/tests/legacy/ApiTest.php @@ -1215,17 +1215,6 @@ class ApiTest extends FixtureTest //self::assertArrayHasKey('direct_message', $result); } - /** - * Test the api_direct_messages_box() function. - * - * @return void - */ - public function testApiDirectMessagesBoxWithAll() - { - //$result = api_direct_messages_box('json', 'all', 'false'); - //self::assertArrayHasKey('direct_message', $result); - } - /** * Test the api_direct_messages_box() function. * @@ -1281,17 +1270,6 @@ class ApiTest extends FixtureTest //self::assertArrayHasKey('direct_message', $result); } - /** - * Test the api_direct_messages_all() function. - * - * @return void - */ - public function testApiDirectMessagesAll() - { - //$result = api_direct_messages_all('json'); - //self::assertArrayHasKey('direct_message', $result); - } - /** * Test the api_direct_messages_conversation() function. * diff --git a/tests/src/Module/Api/Twitter/DirectMessages/AllTest.php b/tests/src/Module/Api/Twitter/DirectMessages/AllTest.php new file mode 100644 index 0000000000..52021c71b9 --- /dev/null +++ b/tests/src/Module/Api/Twitter/DirectMessages/AllTest.php @@ -0,0 +1,36 @@ +loadFixture(__DIR__ . '/../../../../../datasets/mail/mail.fixture.php', DI::dba()); + + $directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser()); + + $destroy = new All($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']); + $response = $destroy->run(); + + $json = $this->toJson($response); + + self::assertGreaterThan(0, count($json)); + + foreach ($json as $item) { + self::assertIsInt($item->id); + self::assertIsString($item->text); + } + } +} diff --git a/tests/src/Module/Api/Twitter/DirectMessages/InboxTest.php b/tests/src/Module/Api/Twitter/DirectMessages/InboxTest.php index 582729c8b9..42c0b59785 100644 --- a/tests/src/Module/Api/Twitter/DirectMessages/InboxTest.php +++ b/tests/src/Module/Api/Twitter/DirectMessages/InboxTest.php @@ -26,8 +26,6 @@ class InboxTest extends ApiTest $json = $this->toJson($response); - print_r($json); - self::assertGreaterThan(0, count($json)); foreach ($json as $item) {