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 SleeperPlayerTest extends TestCase |
10
|
|
|
{ |
11
|
|
|
|
12
|
|
|
public function testUser() |
13
|
|
|
{ |
14
|
|
|
$data = file_get_contents(__DIR__ . '/data/players.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
|
|
|
$players = $client->players()->all(); |
|
|
|
|
21
|
|
|
$mThomas = (object) $players['3199']; |
22
|
|
|
|
23
|
|
|
$this->assertIsArray($players); |
24
|
|
|
$this->assertCount(4, $players); |
25
|
|
|
$this->assertIsObject($mThomas); |
26
|
|
|
$this->assertEquals('nfl', $mThomas->sport); |
27
|
|
|
$this->assertEquals('Michael Thomas', $mThomas->full_name); |
28
|
|
|
$this->assertEquals('PUP', $mThomas->injury_status); |
29
|
|
|
$this->assertEquals('Inactive', $mThomas->status); |
30
|
|
|
$this->assertEquals("6'3\"", $mThomas->height); |
31
|
|
|
$this->assertEquals(28, $mThomas->age); |
32
|
|
|
$this->assertEquals('212', $mThomas->weight); |
33
|
|
|
$this->assertEquals(5, $mThomas->years_exp); |
34
|
|
|
$this->assertEquals('NO', $mThomas->team); |
35
|
|
|
$this->assertEquals('WR', $mThomas->position); |
36
|
|
|
$this->assertEquals('3199', $mThomas->player_id); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
} |
40
|
|
|
|