From 829c43ba3b29af74bf4cf23f30cc80b9f71b7c64 Mon Sep 17 00:00:00 2001 From: Philipp Date: Fri, 12 Nov 2021 22:09:03 +0100 Subject: [PATCH] Migrate Api\RateLimitStatus --- tests/legacy/ApiTest.php | 26 ----------------- .../Twitter/Account/RateLimitStatusTest.php | 28 +++++++++++++++++++ 2 files changed, 28 insertions(+), 26 deletions(-) create mode 100644 tests/src/Module/Api/Twitter/Account/RateLimitStatusTest.php diff --git a/tests/legacy/ApiTest.php b/tests/legacy/ApiTest.php index 800bc772e..3bf14a31b 100644 --- a/tests/legacy/ApiTest.php +++ b/tests/legacy/ApiTest.php @@ -2541,32 +2541,6 @@ class ApiTest extends FixtureTest } } - /** - * Test the api_format_items() function. - * - * @return void - */ - public function testApiAccountRateLimitStatus() - { - // @todo How to test the new API? - // $result = api_account_rate_limit_status('json'); - // self::assertEquals(150, $result['hash']['remaining_hits']); - // self::assertEquals(150, $result['hash']['hourly_limit']); - // self::assertIsInt($result['hash']['reset_time_in_seconds']); - } - - /** - * Test the api_format_items() function with an XML result. - * - * @return void - */ - public function testApiAccountRateLimitStatusWithXml() - { - // @todo How to test the new API? - // $result = api_account_rate_limit_status('xml'); - // self::assertXml($result, 'hash'); - } - /** * Test the api_lists_list() function. * diff --git a/tests/src/Module/Api/Twitter/Account/RateLimitStatusTest.php b/tests/src/Module/Api/Twitter/Account/RateLimitStatusTest.php new file mode 100644 index 000000000..46088d330 --- /dev/null +++ b/tests/src/Module/Api/Twitter/Account/RateLimitStatusTest.php @@ -0,0 +1,28 @@ + 'json']); + + $result = json_decode(ApiResponseDouble::getOutput()); + + self::assertEquals(150, $result->remaining_hits); + self::assertEquals(150, $result->hourly_limit); + self::assertIsInt($result->reset_time_in_seconds); + } + + public function testWithXml() + { + RateLimitStatus::rawContent(['extension' => 'xml']); + + self::assertXml(ApiResponseDouble::getOutput(), 'hash'); + } +}