AbstractAdapterTest::testDefaults()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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