Completed
Branch 2.x (c99d86)
by Julián
08:01
created

AbstractAdapterTest   A

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
1
<?php
2
3
/*
4
 * Unified push notification services abstraction (http://github.com/juliangut/tify).
5
 *
6
 * @license BSD-3-Clause
7
 * @link https://github.com/juliangut/tify
8
 * @author Julián Gutiérrez <[email protected]>
9
 */
10
11
namespace Jgut\Tify\Tests\Adapter;
12
13
use Jgut\Tify\Adapter\AbstractAdapter;
14
use Jgut\Tify\Tests\Stubs\AdapterStub;
15
16
/**
17
 * Abstract service adapter tests.
18
 */
19
class AbstractAdapterTest extends \PHPUnit_Framework_TestCase
20
{
21
    /**
22
     * @var AdapterStub
23
     */
24
    protected $adapter;
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function setUp()
30
    {
31
        $this->adapter = new AdapterStub(['param1' => 'value1']);
32
    }
33
34
    /**
35
     * @expectedException \Jgut\Tify\Exception\AdapterException
36
     * @expectedExceptionMessage Invalid parameter provided
37
     */
38
    public function testUndefinedParameter()
39
    {
40
        $this->getMockForAbstractClass(AbstractAdapter::class, [['undefined' => null]]);
41
    }
42
43
    /**
44
     * @expectedException \Jgut\Tify\Exception\AdapterException
45
     * @expectedExceptionMessageRegExp /^Missing parameters/
46
     */
47
    public function testMissingParameter()
48
    {
49
        $this->getMockForAbstractClass(AdapterStub::class);
50
    }
51
52
    public function testDefaults()
53
    {
54
        self::assertFalse($this->adapter->isSandbox());
55
    }
56
57
    public function testAccessorsMutators()
58
    {
59
        $this->adapter->setSandbox(true);
60
        self::assertTrue($this->adapter->isSandbox());
61
62
        $this->adapter->setSandbox(false);
63
        self::assertFalse($this->adapter->isSandbox());
64
    }
65
}
66