Passed
Push — master ( eded69...cde57f )
by Ax
08:08
created

SleeperAvatarTest::testAvatar()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 13
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 21
rs 9.8333
1
<?php
2
3
use PHPUnit\Framework\TestCase;
4
use SchoppAx\Sleeper\SleeperClient;
5
use SchoppAx\Sleeper\Api\Avatars;
6
7
class SleeperAvatarTest extends TestCase
8
{
9
10
  public function testAvatar()
11
  {
12
    $value = __DIR__ . '/data/740715586f5fecd032030346acf139c5.png';
13
14
    $mock = $this->createMock(Avatars::class);
15
    $mock->expects($this->once())
16
      ->method('find')
17
      ->willReturnCallback(function($id) use ($value) {
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed. ( Ignorable by Annotation )

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

17
      ->willReturnCallback(function(/** @scrutinizer ignore-unused */ $id) use ($value) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
18
        return $value;
19
      });
20
21
    $client = $this->createPartialMock(SleeperClient::class, ['__call']);
22
    $client->expects($this->once())
23
      ->method('__call')
24
      ->willReturnCallback(function($name, $args) use ($mock) {
0 ignored issues
show
Unused Code introduced by
The parameter $args is not used and could be removed. ( Ignorable by Annotation )

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

24
      ->willReturnCallback(function($name, /** @scrutinizer ignore-unused */ $args) use ($mock) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $name is not used and could be removed. ( Ignorable by Annotation )

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

24
      ->willReturnCallback(function(/** @scrutinizer ignore-unused */ $name, $args) use ($mock) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
25
        return $mock;
26
      });
27
28
    $response = $client->avatars()->find('gg');
29
30
    $this->assertEquals('image/png', mime_content_type($response));
31
  }
32
33
}
34