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 AndSpecification |
20
|
|
|
* @coversDefaultClass Flyfinder\Specification\AndSpecification |
21
|
|
|
*/ |
22
|
|
|
class AndSpecificationTest extends TestCase |
23
|
|
|
{ |
24
|
|
|
/** @var HasExtension */ |
25
|
|
|
private $hasExtension; |
26
|
|
|
|
27
|
|
|
/** @var IsHidden */ |
28
|
|
|
private $isHidden; |
29
|
|
|
|
30
|
|
|
/** @var AndSpecification */ |
31
|
|
|
private $fixture; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Initializes the fixture for this test. |
35
|
|
|
*/ |
36
|
|
|
public function setUp() |
37
|
|
|
{ |
38
|
|
|
$this->hasExtension = m::mock('Flyfinder\Specification\HasExtension'); |
39
|
|
|
$this->isHidden = m::mock('Flyfinder\Specification\IsHidden'); |
40
|
|
|
$this->fixture = new AndSpecification($this->hasExtension, $this->isHidden); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function tearDown() |
44
|
|
|
{ |
45
|
|
|
m::close(); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @covers ::__construct |
50
|
|
|
* @covers ::isSatisfiedBy |
51
|
|
|
*/ |
52
|
|
|
public function testIfSpecificationIsSatisfied() |
53
|
|
|
{ |
54
|
|
|
$this->hasExtension->shouldReceive('isSatisfiedBy')->once()->andReturn(true); |
|
|
|
|
55
|
|
|
$this->isHidden->shouldReceive('isSatisfiedBy')->once()->andReturn(true); |
|
|
|
|
56
|
|
|
|
57
|
|
|
$this->assertTrue($this->fixture->isSatisfiedBy(['test'])); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @covers ::__construct |
62
|
|
|
* @covers ::isSatisfiedBy |
63
|
|
|
*/ |
64
|
|
|
public function testIfSpecificationIsNotSatisfied() |
65
|
|
|
{ |
66
|
|
|
$this->hasExtension->shouldReceive('isSatisfiedBy')->once()->andReturn(true); |
|
|
|
|
67
|
|
|
$this->isHidden->shouldReceive('isSatisfiedBy')->once()->andReturn(false); |
|
|
|
|
68
|
|
|
|
69
|
|
|
$this->assertFalse($this->fixture->isSatisfiedBy(['test'])); |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
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.