From e7c5bdc77974eae03484386b09e6924822b8ac57 Mon Sep 17 00:00:00 2001 From: Philipp Date: Thu, 30 Dec 2021 20:02:53 +0100 Subject: [PATCH] Move DirectMessages/Inbox tests --- tests/legacy/ApiTest.php | 22 ----------- .../Api/Twitter/DirectMessages/InboxTest.php | 38 +++++++++++++++++++ 2 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 tests/src/Module/Api/Twitter/DirectMessages/InboxTest.php diff --git a/tests/legacy/ApiTest.php b/tests/legacy/ApiTest.php index 239e297d3e..5203e90a55 100644 --- a/tests/legacy/ApiTest.php +++ b/tests/legacy/ApiTest.php @@ -1226,17 +1226,6 @@ class ApiTest extends FixtureTest //self::assertArrayHasKey('direct_message', $result); } - /** - * Test the api_direct_messages_box() function. - * - * @return void - */ - public function testApiDirectMessagesBoxWithInbox() - { - //$result = api_direct_messages_box('json', 'inbox', 'false'); - //self::assertArrayHasKey('direct_message', $result); - } - /** * Test the api_direct_messages_box() function. * @@ -1292,17 +1281,6 @@ class ApiTest extends FixtureTest //self::assertArrayHasKey('direct_message', $result); } - /** - * Test the api_direct_messages_inbox() function. - * - * @return void - */ - public function testApiDirectMessagesInbox() - { - //$result = api_direct_messages_inbox('json'); - //self::assertArrayHasKey('direct_message', $result); - } - /** * Test the api_direct_messages_all() function. * diff --git a/tests/src/Module/Api/Twitter/DirectMessages/InboxTest.php b/tests/src/Module/Api/Twitter/DirectMessages/InboxTest.php new file mode 100644 index 0000000000..582729c8b9 --- /dev/null +++ b/tests/src/Module/Api/Twitter/DirectMessages/InboxTest.php @@ -0,0 +1,38 @@ +loadFixture(__DIR__ . '/../../../../../datasets/mail/mail.fixture.php', DI::dba()); + + $directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser()); + + $destroy = new Inbox($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); + + print_r($json); + + self::assertGreaterThan(0, count($json)); + + foreach ($json as $item) { + self::assertIsInt($item->id); + self::assertIsString($item->text); + } + } +}