AbstractAdapterTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 41
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testUndefinedParameter() 0 4 1
A testMissingParameter() 0 4 1
A testDefaults() 0 4 1
A testAccessorsMutators() 0 8 1
1
<?php
2
/**
3
 * Push notification services abstraction (http://github.com/juliangut/tify)
4
 *
5
 * @link https://github.com/juliangut/tify for the canonical source repository
6
 *
7
 * @license https://github.com/juliangut/tify/blob/master/LICENSE
8
 */
9
10
namespace Jgut\Tify\Tests\Adapter;
11
12
use Jgut\Tify\Adapter\AbstractAdapter;
13
use Jgut\Tify\Tests\Mock\AdapterMock;
14
15
/**
16
 * Abstract adapter tests.
17
 */
18
class AbstractAdapterTest extends \PHPUnit_Framework_TestCase
19
{
20
    protected $adapter;
21
22
    public function setUp()
23
    {
24
        $this->adapter = $this->getMockForAbstractClass(AbstractAdapter::class, [], '', false);
25
    }
26
27
    /**
28
     * @expectedException \Jgut\Tify\Exception\AdapterException
29
     * @expectedExceptionMessage Invalid parameter provided
30
     */
31
    public function testUndefinedParameter()
32
    {
33
        $this->getMockForAbstractClass(AbstractAdapter::class, [['undefined' => null]]);
34
    }
35
36
    /**
37
     * @expectedException \Jgut\Tify\Exception\AdapterException
38
     * @expectedExceptionMessageRegExp /^Missing parameters/
39
     */
40
    public function testMissingParameter()
41
    {
42
        $this->getMockForAbstractClass(AdapterMock::class);
43
    }
44
45
    public function testDefaults()
46
    {
47
        self::assertFalse($this->adapter->isSandbox());
48
    }
49
50
    public function testAccessorsMutators()
51
    {
52
        $this->adapter->setSandbox(true);
53
        self::assertTrue($this->adapter->isSandbox());
54
55
        $this->adapter->setSandbox(false);
56
        self::assertFalse($this->adapter->isSandbox());
57
    }
58
}
59