Passed
Push — master ( 744134...9f7edb )
by Ax
01:44
created

SleeperUserTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testUser() 0 14 1
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
The method users() does not exist on SchoppAx\Sleeper\SleeperClient. 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

20
    $user = (object) $client->/** @scrutinizer ignore-call */ users()->find('2ksports');
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