Skip to content

[4.0] Change access to body of Response object #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 11 additions & 21 deletions Tests/Package/Activity/EventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @license GNU General Public License version 2 or later; see LICENSE
*/

namespace Joomla\Github\Tests;
namespace Joomla\Github\Tests\Package\Activity;

use Joomla\Github\Package\Activity\Events;
use Joomla\Github\Tests\Stub\GitHubTestCase;
Expand Down Expand Up @@ -62,8 +62,7 @@ public function testGetPublic()
->with('/events')
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -85,8 +84,7 @@ public function testGetRepository()
->with($path)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -108,8 +106,7 @@ public function testGetIssue()
->with($path)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -131,8 +128,7 @@ public function testGetNetwork()
->with($path)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -154,8 +150,7 @@ public function testGetOrg()
->with($path)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -177,8 +172,7 @@ public function testGetUser()
->with($path)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -200,8 +194,7 @@ public function testGetUserPublic()
->with($path)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -223,8 +216,7 @@ public function testGetByUser()
->with($path)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -246,8 +238,7 @@ public function testGetByUserPublic()
->with($path)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -269,8 +260,7 @@ public function testGetUserOrg()
->with($path)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand Down
3 changes: 1 addition & 2 deletions Tests/Package/Activity/FeedsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ public function testGetFeeds()
->with('/feeds')
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand Down
35 changes: 12 additions & 23 deletions Tests/Package/Activity/NotificationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @license GNU General Public License version 2 or later; see LICENSE
*/

namespace Joomla\Github\Tests;
namespace Joomla\Github\Tests\Package\Activity;

use Joomla\Github\Package\Activity\Notifications;
use Joomla\Github\Tests\Stub\GitHubTestCase;
Expand Down Expand Up @@ -54,8 +54,7 @@ public function testGetList()
->with('/notifications?all=1&participating=1&since=2005-08-17T00:00:00+00:00&before=2005-08-17T00:00:00+00:00', [], 0)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -79,8 +78,7 @@ public function testGetListRepository()
->with('/repos/{owner}/{repo}/notifications?' . $args, [], 0)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand Down Expand Up @@ -111,8 +109,7 @@ public function testMarkRead()
->with('/notifications', '{"unread":true,"read":true}', [], 0)
->willReturn($this->response);

$response = $this->response->getBody()->getContents();
$this->response->getBody()->rewind();
$response = (string) $this->response->getBody();

$this->assertEquals(
$response,
Expand All @@ -139,8 +136,7 @@ public function testMarkReadLastRead()
->with('/notifications', $data, [], 0)
->willReturn($this->response);

$response = $this->response->getBody()->getContents();
$this->response->getBody()->rewind();
$response = (string) $this->response->getBody();

$this->assertEquals(
$response,
Expand All @@ -166,8 +162,7 @@ public function testMarkReadRepository()
->with('/repos/joomla/joomla-platform/notifications', $data, [], 0)
->willReturn($this->response);

$response = $this->response->getBody()->getContents();
$this->response->getBody()->rewind();
$response = (string) $this->response->getBody();

$this->assertEquals(
$response,
Expand All @@ -194,8 +189,7 @@ public function testMarkReadRepositoryLastRead()
->with('/repos/joomla/joomla-platform/notifications', $data, [], 0)
->willReturn($this->response);

$response = $this->response->getBody()->getContents();
$this->response->getBody()->rewind();
$response = (string) $this->response->getBody();

$this->assertEquals(
$response,
Expand All @@ -217,8 +211,7 @@ public function testViewThread()
->with('/notifications/threads/1', [], 0)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -242,8 +235,7 @@ public function testMarkReadThread()
->with('/notifications/threads/1', '{"unread":true,"read":true}', [], 0)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -265,8 +257,7 @@ public function testGetThreadSubscription()
->with('/notifications/threads/1/subscription', [], 0)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -288,8 +279,7 @@ public function testSetThreadSubscription()
->with('/notifications/threads/1/subscription', '{"subscribed":true,"ignored":false}', [], 0)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -313,8 +303,7 @@ public function testDeleteThreadSubscription()
->with('/notifications/threads/1/subscription', [], 0)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand Down
26 changes: 9 additions & 17 deletions Tests/Package/Activity/StarringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @license GNU General Public License version 2 or later; see LICENSE
*/

namespace Joomla\Github\Tests;
namespace Joomla\Github\Tests\Package\Activity;

use Joomla\Github\Package\Activity\Starring;
use Joomla\Github\Tests\Stub\GitHubTestCase;
Expand Down Expand Up @@ -54,8 +54,7 @@ public function testGetList()
->with('/repos/joomla/joomla-platform/stargazers', [], 0)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -77,8 +76,7 @@ public function testGetRepositories()
->with('/user/starred?sort=created&direction=desc', [], 0)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -100,8 +98,7 @@ public function testGetRepositoriesWithName()
->with('/users/{user}/starred?sort=created&direction=desc', [], 0)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand Down Expand Up @@ -157,8 +154,7 @@ public function testCheck()
->with('/user/starred/joomla/joomla-platform', [], 0)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -182,8 +178,7 @@ public function testCheckFalse()
->with('/user/starred/joomla/joomla-platform', [], 0)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -209,8 +204,7 @@ public function testCheckUnexpected()
->with('/user/starred/joomla/joomla-platform', [], 0)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -234,8 +228,7 @@ public function testStar()
->with('/user/starred/joomla/joomla-platform', '', [], 0)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand All @@ -259,8 +252,7 @@ public function testUnstar()
->with('/user/starred/joomla/joomla-platform', [], 0)
->willReturn($this->response);

$response = json_decode($this->response->getBody()->getContents());
$this->response->getBody()->rewind();
$response = json_decode((string) $this->response->getBody());

$this->assertEquals(
$response,
Expand Down
Loading