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
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Test case for CompositeSpecification |
20
|
|
|
* @coversDefaultClass Flyfinder\Specification\CompositeSpecification |
21
|
|
|
*/ |
22
|
|
|
class CompositeSpecificationTest extends TestCase |
23
|
|
|
{ |
24
|
|
|
/** @var HasExtension */ |
25
|
|
|
private $hasExtension; |
26
|
|
|
|
27
|
|
|
/** @var m::MockObject|CompositeSpecification */ |
28
|
|
|
private $fixture; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Initializes the fixture for this test. |
32
|
|
|
*/ |
33
|
|
|
public function setUp() |
34
|
|
|
{ |
35
|
|
|
$this->hasExtension = m::mock('Flyfinder\Specification\HasExtension'); |
36
|
|
|
$this->fixture = $this->getMockForAbstractClass('Flyfinder\Specification\CompositeSpecification'); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function tearDown() |
40
|
|
|
{ |
41
|
|
|
m::close(); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @covers ::andSpecification |
46
|
|
|
* @uses Flyfinder\Specification\AndSpecification |
47
|
|
|
*/ |
48
|
|
|
public function testAndSpecification() |
49
|
|
|
{ |
50
|
|
|
$this->assertInstanceOf( |
51
|
|
|
'Flyfinder\Specification\AndSpecification', |
52
|
|
|
$this->fixture->andSpecification($this->hasExtension) |
53
|
|
|
); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @covers ::orSpecification |
58
|
|
|
* @uses Flyfinder\Specification\OrSpecification |
59
|
|
|
*/ |
60
|
|
|
public function testOrSpecification() |
61
|
|
|
{ |
62
|
|
|
$this->assertInstanceOf( |
63
|
|
|
'Flyfinder\Specification\OrSpecification', |
64
|
|
|
$this->fixture->orSpecification($this->hasExtension) |
65
|
|
|
); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @covers ::notSpecification |
70
|
|
|
* @uses Flyfinder\Specification\NotSpecification |
71
|
|
|
*/ |
72
|
|
|
public function testNotSpecification() |
73
|
|
|
{ |
74
|
|
|
$this->assertInstanceOf( |
75
|
|
|
'Flyfinder\Specification\NotSpecification', |
76
|
|
|
$this->fixture->notSpecification() |
77
|
|
|
); |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|