SchoppAx /
php-sleeper-api
| 1 | <?php |
||
| 2 | |||
| 3 | use PHPUnit\Framework\TestCase; |
||
| 4 | use SchoppAx\Sleeper\SleeperClient; |
||
| 5 | use GuzzleHttp\Handler\MockHandler; |
||
| 6 | use GuzzleHttp\Psr7\Response; |
||
| 7 | use GuzzleHttp\Psr7\Request; |
||
| 8 | |||
| 9 | class SleeperUserTest extends TestCase |
||
| 10 | { |
||
| 11 | |||
| 12 | public function testUser() |
||
| 13 | { |
||
| 14 | $data = file_get_contents(__DIR__ . '/data/user.json'); |
||
| 15 | $response = new GuzzleHttp\Psr7\Response(200, [], $data); |
||
| 16 | $mock = new GuzzleHttp\Handler\MockHandler([ $response, $response ]); |
||
| 17 | |||
| 18 | $client = new SleeperClient($mock); |
||
| 19 | |||
| 20 | $user = (object) $client->users()->find('2ksports'); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 21 | |||
| 22 | $this->assertIsObject($user); |
||
| 23 | $this->assertEquals('457511950237696', $user->user_id); |
||
| 24 | $this->assertEquals('2ksports', $user->username); |
||
| 25 | $this->assertEquals('2KSports', $user->display_name); |
||
| 26 | } |
||
| 27 | |||
| 28 | } |
||
| 29 |