Passed
Push — master ( b16a12...abed16 )
by Ax
09:12
created

SleeperTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 19
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testLeague() 0 16 1
1
<?php
2
3
use PHPUnit\Framework\TestCase;
4
use SchoppAx\Sleeper\Sleeper;
5
use GuzzleHttp\Handler\MockHandler;
6
use GuzzleHttp\Psr7\Response;
7
use GuzzleHttp\Psr7\Request;
8
use GuzzleHttp\Exception\RequestException;
9
10
class SleeperTest extends TestCase
11
{
12
13
  public function testLeague()
14
  {
15
    $data = file_get_contents(__DIR__ . '/data/league.json');
16
    $response = new GuzzleHttp\Psr7\Response(200, [], $data);
17
    $mock = new GuzzleHttp\Handler\MockHandler([ $response, $response ]);
18
19
    $client = new Sleeper($mock);
20
21
    $league = (object) $client->leagues()->find('289646328504385536');
0 ignored issues
show
Bug introduced by
The method leagues() does not exist on SchoppAx\Sleeper\Sleeper. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

21
    $league = (object) $client->/** @scrutinizer ignore-call */ leagues()->find('289646328504385536');
Loading history...
22
23
    $this->assertIsObject($league);
24
    $this->assertEquals('289646328504385536', $league->league_id);
25
    $this->assertEquals('Sleeper Friends League', $league->name);
26
    $this->assertEquals('2018', $league->season);
27
    $this->assertCount(15, $league->roster_positions);
28
    $this->assertIsArray($league->settings);
29
  }
30
31
}
32