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
|
|
|
use Flyfinder\Specification\IsHidden; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Test case for OrSpecification |
22
|
|
|
* @coversDefaultClass Flyfinder\Specification\OrSpecification |
23
|
|
|
*/ |
24
|
|
|
class OrSpecificationTest extends TestCase |
25
|
|
|
{ |
26
|
|
|
/** @var HasExtension */ |
27
|
|
|
private $hasExtension; |
28
|
|
|
|
29
|
|
|
/** @var IsHidden */ |
30
|
|
|
private $isHidden; |
31
|
|
|
|
32
|
|
|
/** @var OrSpecification */ |
33
|
|
|
private $fixture; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Initializes the fixture for this test. |
37
|
|
|
*/ |
38
|
|
|
public function setUp() |
39
|
|
|
{ |
40
|
|
|
$this->hasExtension = m::mock('Flyfinder\Specification\HasExtension'); |
41
|
|
|
$this->isHidden = m::mock('Flyfinder\Specification\IsHidden'); |
42
|
|
|
$this->fixture = new OrSpecification($this->hasExtension, $this->isHidden); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function tearDown() |
46
|
|
|
{ |
47
|
|
|
m::close(); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @covers ::__construct |
52
|
|
|
* @covers ::isSatisfiedBy |
53
|
|
|
*/ |
54
|
|
|
public function testIfSpecificationIsSatisfied() |
55
|
|
|
{ |
56
|
|
|
$this->hasExtension->shouldReceive('isSatisfiedBy')->once()->andReturn(false); |
|
|
|
|
57
|
|
|
$this->isHidden->shouldReceive('isSatisfiedBy')->once()->andReturn(true); |
|
|
|
|
58
|
|
|
|
59
|
|
|
$this->assertTrue($this->fixture->isSatisfiedBy(['test'])); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @covers ::__construct |
64
|
|
|
* @covers ::isSatisfiedBy |
65
|
|
|
*/ |
66
|
|
|
public function testIfSpecificationIsNotSatisfied() |
67
|
|
|
{ |
68
|
|
|
$this->hasExtension->shouldReceive('isSatisfiedBy')->once()->andReturn(false); |
|
|
|
|
69
|
|
|
$this->isHidden->shouldReceive('isSatisfiedBy')->once()->andReturn(false); |
|
|
|
|
70
|
|
|
|
71
|
|
|
$this->assertFalse($this->fixture->isSatisfiedBy(['test'])); |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.