Completed
Pull Request — master (#6)
by Chuck
02:31
created

NotSpecificationTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
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
use Flyfinder\Specification\HasExtension;
18
19
/**
20
 * Test case for NotSpecification
21
 * @coversDefaultClass Flyfinder\Specification\NotSpecification
22
 */
23
class NotSpecificationTest extends TestCase
24
{
25
    /** @var HasExtension */
26
    private $hasExtension;
27
28
    /** @var NotSpecification */
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 = new NotSpecification($this->hasExtension);
38
    }
39
40
    public function tearDown()
41
    {
42
        m::close();
43
    }
44
45
    /**
46
     * @covers ::__construct
47
     * @covers ::isSatisfiedBy
48
     */
49
    public function testIfSpecificationIsSatisfied()
50
    {
51
        $this->hasExtension->shouldReceive('isSatisfiedBy')->once()->andReturn(false);
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...
52
53
        $this->assertTrue($this->fixture->isSatisfiedBy(['test']));
54
    }
55
56
    /**
57
     * @covers ::__construct
58
     * @covers ::isSatisfiedBy
59
     */
60
    public function testIfSpecificationIsNotSatisfied()
61
    {
62
        $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...
63
64
        $this->assertFalse($this->fixture->isSatisfiedBy(['test']));
65
    }
66
}
67