Completed
Pull Request — master (#74)
by Ernest
01:33
created

PackageTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 23
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A it_gets_details_for_an_package_by_id() 0 11 1
A checkPackageClasses() 0 4 1
1
<?php
2
3
require_once 'BaseTester.php';
4
5
/** @group Package */
6
class PackageTest extends BaseTester
7
{
8
    /** @test */
9
    public function it_gets_details_for_an_package_by_id()
10
    {
11
        $details = $this->steamClient->package()->packageDetails($this->packageId);
12
13
        $this->assertCount(1, $details);
14
15
        $detail = $details->first();
0 ignored issues
show
Documentation Bug introduced by
The method first does not exist on object<Syntax\SteamApi\Steam\Package>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
16
17
        $this->checkPackageProperties($detail);
18
        $this->checkPackageClasses($detail);
19
    }
20
21
    /**
22
     * @param $detail
23
     */
24
    private function checkPackageClasses($detail)
25
    {
26
        $this->assertInstanceOf('Syntax\SteamApi\Containers\Package', $detail);
27
    }
28
}
29