-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathFollowsTest.php
39 lines (31 loc) · 1.23 KB
/
FollowsTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
namespace romanzipp\Twitch\Tests\Api;
use romanzipp\Twitch\Tests\TestCases\ApiTestCase;
class FollowsTest extends ApiTestCase
{
public function testMissingParameters()
{
$this->expectException(\InvalidArgumentException::class);
$this->twitch()->getUsersFollows();
}
public function testGetFollowsWithFrom()
{
$this->registerResult(
$result = $this->twitch()->getUsersFollows(['from_id' => 12826])
);
self::assertTrue($result->success(), $result->getErrorMessage());
self::assertNotEmpty($result->data());
self::assertHasProperties(['from_id', 'from_name', 'to_id', 'to_name', 'followed_at'], $result->shift());
self::assertEquals(12826, (int) $result->shift()->from_id);
}
public function testGetFollowsWithTo()
{
$this->registerResult(
$result = $this->twitch()->getUsersFollows(['to_id' => 12826])
);
self::assertTrue($result->success(), $result->getErrorMessage());
self::assertNotEmpty($result->data());
self::assertHasProperties(['from_id', 'from_name', 'to_id', 'to_name', 'followed_at'], $result->shift());
self::assertEquals(12826, (int) $result->shift()->to_id);
}
}