Completed
Pull Request — master (#6)
by Chuck
05:28
created

testIfSpecificationIsSatisfied()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
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);
0 ignored issues
show
Bug introduced by
The method shouldReceive() does not seem to exist on object<Flyfinder\Specification\HasExtension>.

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.

Loading history...
55
        $this->isHidden->shouldReceive('isSatisfiedBy')->once()->andReturn(true);
0 ignored issues
show
Bug introduced by
The method shouldReceive() does not seem to exist on object<Flyfinder\Specification\IsHidden>.

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.

Loading history...
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);
0 ignored issues
show
Bug introduced by
The method shouldReceive() does not seem to exist on object<Flyfinder\Specification\HasExtension>.

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.

Loading history...
67
        $this->isHidden->shouldReceive('isSatisfiedBy')->once()->andReturn(false);
0 ignored issues
show
Bug introduced by
The method shouldReceive() does not seem to exist on object<Flyfinder\Specification\IsHidden>.

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.

Loading history...
68
69
        $this->assertFalse($this->fixture->isSatisfiedBy(['test']));
70
    }
71
}
72