Completed
Branch v1 (ffe92e)
by Julián
02:44
created

AbstractAdapterTest::testMissingParameter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
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
    /**
21
     * @var \Jgut\Tify\Adapter\AbstractAdapter
22
     */
23
    protected $adapter;
24
25
    public function setUp()
26
    {
27
        $this->adapter = $this->getMockForAbstractClass(AbstractAdapter::class, [], '', false);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockForAbstrac...ss, array(), '', false) of type object<PHPUnit_Framework_MockObject_MockObject> is incompatible with the declared type object<Jgut\Tify\Adapter\AbstractAdapter> of property $adapter.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
28
    }
29
30
    /**
31
     * @expectedException \Jgut\Tify\Exception\AdapterException
32
     * @expectedExceptionMessage Invalid parameter provided
33
     */
34
    public function testUndefinedParameter()
35
    {
36
        $this->getMockForAbstractClass(AbstractAdapter::class, [['undefined' => null]]);
37
    }
38
39
    /**
40
     * @expectedException \Jgut\Tify\Exception\AdapterException
41
     * @expectedExceptionMessageRegExp /^Missing parameters/
42
     */
43
    public function testMissingParameter()
44
    {
45
        $this->getMockForAbstractClass(AdapterMock::class);
46
    }
47
48
    public function testDefaults()
49
    {
50
        self::assertFalse($this->adapter->isSandbox());
51
    }
52
53
    public function testAccessorsMutators()
54
    {
55
        $this->adapter->setSandbox(true);
56
        self::assertTrue($this->adapter->isSandbox());
57
58
        $this->adapter->setSandbox(false);
59
        self::assertFalse($this->adapter->isSandbox());
60
    }
61
}
62