|
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); |
|
|
|
|
|
|
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
|
|
|
|
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..