Completed
Push — master ( 8e5551...30910b )
by GBProd
02:20
created

RegistryTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstruct() 0 6 1
A isSatisfiedBy() 0 4 1
A testGetBuilderThrowsOutOfRangeExceptionIfBuilderNotRegistred() 0 8 1
A testGetBuilderReturnsAssociatedBuilder() 0 13 1
1
<?php
2
3
namespace Tests\GBProd\ElasticaSpecification;
4
5
use GBProd\ElasticaSpecification\ExpressionBuilder\Builder;
6
use GBProd\ElasticaSpecification\Registry;
7
use GBProd\Specification\Specification;
8
9
/**
10
 * Tests for registry
11
 *
12
 * @author gbprod <[email protected]>
13
 */
14
class RegistryTest extends \PHPUnit_Framework_TestCase implements Specification
15
{
16
    public function testConstruct()
17
    {
18
        $registry = new Registry();
19
20
        $this->assertInstanceOf(Registry::class, $registry);
21
    }
22
23
    public function isSatisfiedBy($candidate)
24
    {
25
        return true;
26
    }
27
28
    public function testGetBuilderThrowsOutOfRangeExceptionIfBuilderNotRegistred()
29
    {
30
        $registry = new Registry();
31
32
        $this->setExpectedException(\OutOfRangeException::class);
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
33
34
        $registry->getBuilder($this);
35
    }
36
37
    public function testGetBuilderReturnsAssociatedBuilder()
38
    {
39
        $registry = new Registry();
40
41
        $builder = $this->prophesize(Builder::class)->reveal();
42
43
        $registry->register(self::class, $builder);
44
45
        $this->assertEquals(
46
            $builder,
47
            $registry->getBuilder($this)
48
        );
49
    }
50
}
51