Skip to content

Commit 014dd65

Browse files
committed
Requested changes to createUserFollow and spec
1 parent 1b4495f commit 014dd65

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

spec/NewTwitchApi/Resources/UsersApiSpec.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ function it_should_create_a_follow(Client $guzzleClient, Response $response)
114114
function it_should_create_a_follow_with_notifications(Client $guzzleClient, Response $response)
115115
{
116116
$guzzleClient->send(new Request('POST', 'users/follows?from_id=123&to_id=321&allow_notifications=1', ['Authorization' => 'Bearer TEST_TOKEN']))->willReturn($response);
117-
$this->createUserFollow('TEST_TOKEN', '123', '321', 1)->shouldBeAnInstanceOf(ResponseInterface::class);
117+
$this->createUserFollow('TEST_TOKEN', '123', '321', true)->shouldBeAnInstanceOf(ResponseInterface::class);
118+
}
119+
120+
function it_should_create_a_follow_without_notifications(Client $guzzleClient, Response $response)
121+
{
122+
$guzzleClient->send(new Request('POST', 'users/follows?from_id=123&to_id=321&allow_notifications=0', ['Authorization' => 'Bearer TEST_TOKEN']))->willReturn($response);
123+
$this->createUserFollow('TEST_TOKEN', '123', '321', false)->shouldBeAnInstanceOf(ResponseInterface::class);
118124
}
119125
}

src/NewTwitchApi/Resources/UsersApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function createUserFollow(string $bearer, string $fromId, string $toId, b
114114

115115
$queryParamsMap[] = ['key' => 'to_id', 'value' => $toId];
116116

117-
if ($notifications) {
117+
if ($notifications !== null) {
118118
$queryParamsMap[] = ['key' => 'allow_notifications', 'value' => $notifications];
119119
}
120120

0 commit comments

Comments
 (0)