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

testGetBuilderThrowsOutOfRangeExceptionIfBuilderNotRegistred()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
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