GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( eb0b53...726858 )
by Jan
02:20
created

GenericConfigurationTest   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2
Metric Value
wmc 10
lcom 1
cbo 2
dl 0
loc 76
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testGettersAndSetters() 0 10 1
A testSetRequestFactoryExeptsClosure() 0 4 1
A testSetRequestFactoryExeptsCallable() 0 4 1
A testSetRequestFactoryThrowExceptionIfArgumentIsNotCallable() 0 4 1
A testSetResponseTransformerFactoryExeptsClosure() 0 4 1
A testSetResponseTransformerExeptsCallable() 0 4 1
A testSetResponseTransformerFactoryThrowExceptionIfArgumentIsNotCallable() 0 4 1
A testCountryException() 0 5 1
A testCountrySetter() 0 7 1
1
<?php
2
/*
3
 * Copyright 2013 Jan Eichhorn <[email protected]>
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
namespace ApaiIO\Test\Configuration;
19
20
use ApaiIO\Configuration\GenericConfiguration;
21
22
class GenericConfigurationTest extends \PHPUnit_Framework_TestCase
23
{
24
    /**
25
     * @var \ApaiIO\Configuration\GenericConfiguration
26
     */
27
    private $genericConfiguration;
28
29
    protected function setUp()
30
    {
31
        $this->genericConfiguration = new GenericConfiguration();
32
        parent::setUp();
33
    }
34
    public function testGettersAndSetters()
35
    {
36
        $this->genericConfiguration->setAccessKey('ABC');
37
        $this->genericConfiguration->setSecretKey('DEF');
38
        $this->genericConfiguration->setAssociateTag('GHI');
39
40
        $this->assertSame('ABC', $this->genericConfiguration->getAccessKey());
41
        $this->assertSame('DEF', $this->genericConfiguration->getSecretKey());
42
        $this->assertSame('GHI', $this->genericConfiguration->getAssociateTag());
43
    }
44
45
    public function testSetRequestFactoryExeptsClosure()
46
    {
47
        $this->genericConfiguration->setRequestFactory(function(){});
48
    }
49
50
    public function testSetRequestFactoryExeptsCallable()
51
    {
52
        $this->genericConfiguration->setRequestFactory(array(__NAMESPACE__ . '\CallableClass', 'foo'));
53
    }
54
55
    /**
56
     * @expectedException InvalidArgumentException
57
     */
58
    public function testSetRequestFactoryThrowExceptionIfArgumentIsNotCallable()
59
    {
60
        $this->genericConfiguration->setRequestFactory("");
61
    }
62
63
    public function testSetResponseTransformerFactoryExeptsClosure()
64
    {
65
        $this->genericConfiguration->setResponseTransformerFactory(function(){});
66
    }
67
68
    public function testSetResponseTransformerExeptsCallable()
69
    {
70
        $this->genericConfiguration->setResponseTransformerFactory(array(__NAMESPACE__ . '\CallableClass', 'foo'));
71
    }
72
73
    /**
74
     * @expectedException InvalidArgumentException
75
     */
76
    public function testSetResponseTransformerFactoryThrowExceptionIfArgumentIsNotCallable()
77
    {
78
        $this->genericConfiguration->setResponseTransformerFactory("");
79
    }
80
81
    /**
82
     * @expectedException InvalidArgumentException
83
     */
84
    public function testCountryException()
85
    {
86
        $object = new GenericConfiguration();
87
        $object->setCountry('no country');
88
    }
89
90
    public function testCountrySetter()
91
    {
92
        $object = new GenericConfiguration();
93
        $object->setCountry('DE');
94
95
        $this->assertEquals('de', $object->getCountry());
96
    }
97
}
98
99
class CallableClass
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
100
{
101
    public static function foo()
102
    {
103
    }
104
}
105