1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of phpDocumentor. |
4
|
|
|
* |
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
6
|
|
|
* file that was distributed with this source code. |
7
|
|
|
* |
8
|
|
|
* @copyright 2010-2015 Mike van Riel<[email protected]> |
9
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT |
10
|
|
|
* @link http://phpdoc.org |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace Flyfinder\Specification; |
14
|
|
|
|
15
|
|
|
use PHPUnit\Framework\TestCase; |
16
|
|
|
use Mockery as m; |
17
|
|
|
use Flyfinder\Specification\HasExtension; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Test case for CompositeSpecification |
21
|
|
|
* @coversDefaultClass Flyfinder\Specification\CompositeSpecification |
22
|
|
|
*/ |
23
|
|
|
class CompositeSpecificationTest extends TestCase |
24
|
|
|
{ |
25
|
|
|
/** @var HasExtension */ |
26
|
|
|
private $hasExtension; |
27
|
|
|
|
28
|
|
|
/** @var CompositeSpecification */ |
29
|
|
|
private $fixture; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Initializes the fixture for this test. |
33
|
|
|
*/ |
34
|
|
|
public function setUp() |
35
|
|
|
{ |
36
|
|
|
$this->hasExtension = m::mock('Flyfinder\Specification\HasExtension'); |
37
|
|
|
$this->fixture = $this->getMockForAbstractClass('Flyfinder\Specification\CompositeSpecification'); |
|
|
|
|
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function tearDown() |
41
|
|
|
{ |
42
|
|
|
m::close(); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @covers ::andSpecification |
47
|
|
|
* @uses Flyfinder\Specification\AndSpecification |
48
|
|
|
*/ |
49
|
|
|
public function testAndSpecification() |
50
|
|
|
{ |
51
|
|
|
$this->assertInstanceOf( |
52
|
|
|
'Flyfinder\Specification\AndSpecification', |
53
|
|
|
$this->fixture->andSpecification($this->hasExtension) |
54
|
|
|
); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @covers ::orSpecification |
59
|
|
|
* @uses Flyfinder\Specification\OrSpecification |
60
|
|
|
*/ |
61
|
|
|
public function testOrSpecification() |
62
|
|
|
{ |
63
|
|
|
$this->assertInstanceOf( |
64
|
|
|
'Flyfinder\Specification\OrSpecification', |
65
|
|
|
$this->fixture->orSpecification($this->hasExtension) |
66
|
|
|
); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @covers ::notSpecification |
71
|
|
|
* @uses Flyfinder\Specification\NotSpecification |
72
|
|
|
*/ |
73
|
|
|
public function testNotSpecification() |
74
|
|
|
{ |
75
|
|
|
$this->assertInstanceOf( |
76
|
|
|
'Flyfinder\Specification\NotSpecification', |
77
|
|
|
$this->fixture->notSpecification() |
78
|
|
|
); |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|
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..