testCreateThrowsExceptionWhenStrategyNotFound()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 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-2018 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 phpDocumentor\Reflection\Php;
14
15
use phpDocumentor\Reflection\Php\Factory\DummyFactoryStrategy;
16
use PHPUnit\Framework\TestCase;
17
18
/**
19
 * Test case for ProjectFactoryStrategies
20
 *
21
 * @coversDefaultClass phpDocumentor\Reflection\Php\ProjectFactoryStrategies
22
 */
23
class ProjectFactoryStrategiesTest extends TestCase
24
{
25
    /**
26
     * @covers ::__construct
27
     * @covers ::addStrategy
28
     */
29
    public function testStrategiesAreChecked()
30
    {
31
        new ProjectFactoryStrategies([new DummyFactoryStrategy()]);
32
        $this->assertTrue(true);
33
    }
34
35
    /**
36
     * @covers ::findMatching
37
     * @covers ::<private>
38
     */
39
    public function testFindMatching()
40
    {
41
        $strategy = new DummyFactoryStrategy();
42
        $container = new ProjectFactoryStrategies([$strategy]);
43
        $actual = $container->findMatching(['aa']);
44
45
        $this->assertSame($strategy, $actual);
46
    }
47
48
    /**
49
     * @covers ::findMatching
50
     * @covers ::<private>
51
     *
52
     * @expectedException \OutOfBoundsException
53
     */
54
    public function testCreateThrowsExceptionWhenStrategyNotFound()
55
    {
56
        $container = new ProjectFactoryStrategies([]);
57
        $container->findMatching(['aa']);
58
    }
59
}
60