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

NotSpecificationTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 44
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A tearDown() 0 4 1
A testIfSpecificationIsSatisfied() 0 6 1
A testIfSpecificationIsNotSatisfied() 0 6 1
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 NotSpecification
20
 * @coversDefaultClass Flyfinder\Specification\NotSpecification
21
 */
22
class NotSpecificationTest extends TestCase
23
{
24
    /** @var HasExtension */
25
    private $hasExtension;
26
27
    /** @var NotSpecification */
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 = new NotSpecification($this->hasExtension);
37
    }
38
39
    public function tearDown()
40
    {
41
        m::close();
42
    }
43
44
    /**
45
     * @covers ::__construct
46
     * @covers ::isSatisfiedBy
47
     */
48
    public function testIfSpecificationIsSatisfied()
49
    {
50
        $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...
51
52
        $this->assertTrue($this->fixture->isSatisfiedBy(['test']));
53
    }
54
55
    /**
56
     * @covers ::__construct
57
     * @covers ::isSatisfiedBy
58
     */
59
    public function testIfSpecificationIsNotSatisfied()
60
    {
61
        $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...
62
63
        $this->assertFalse($this->fixture->isSatisfiedBy(['test']));
64
    }
65
}
66