Completed
Branch feature/add-scrutinizer (27b569)
by Matthias
02:05
created

testCanHandleMultipleExtensions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
namespace ComposerRequireCheckerTest\DefinedSymbolsLocator;
4
5
6
use ComposerRequireChecker\DefinedSymbolsLocator\LocateDefinedSymbolsFromExtensions;
7
8
class LocateDefinedSymbolsFromExtensionsTest extends \PHPUnit_Framework_TestCase
9
{
10
11
    /**
12
     * @var LocateDefinedSymbolsFromExtensions
13
     */
14
    private $locator;
15
16
    /**
17
     * {@inheritDoc}
18
     */
19
    protected function setUp()
20
    {
21
        $this->locator = new LocateDefinedSymbolsFromExtensions();
22
    }
23
24
    public function testThrowsExceptionForUnknownExtension()
25
    {
26
        $this->setExpectedException('ComposerRequireChecker\Exception\UnknownExtensionException');
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; use expectException() instead

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...
27
        $this->locator->__invoke(['unknown_extension_name']);
28
    }
29
30
    public function testReturnsFilledArray()
31
    {
32
        $symbols = $this->locator->__invoke(['Core']);
33
        $this->assertGreaterThan(1, count($symbols));
34
        $this->assertTrue(is_array($symbols));
35
    }
36
37
    public function testSymbolsContainConstants()
38
    {
39
        $symbols = $this->locator->__invoke(['Core']);
40
        $this->assertTrue(in_array('PHP_VERSION', $symbols));
41
    }
42
43
    public function testSymbolsContainFunctions()
44
    {
45
        $symbols = $this->locator->__invoke(['Core']);
46
        $this->assertTrue(in_array('strlen', $symbols));
47
    }
48
49
    public function testSymbolsContainClasses()
50
    {
51
        $symbols = $this->locator->__invoke(['Core']);
52
        $this->assertTrue(in_array('stdClass', $symbols));
53
    }
54
55
    public function testCanHandleMultipleExtensions()
56
    {
57
        $coreSymbols = $this->locator->__invoke(['Core']);
58
        $standardSymbols = $this->locator->__invoke(['standard']);
59
60
        $this->assertGreaterThan(1, count($coreSymbols));
61
        $this->assertGreaterThan(1, count($standardSymbols));
62
63
        $combinedSymbols = $this->locator->__invoke(['Core', 'standard']);
64
        $this->assertSame(array_merge($coreSymbols, $standardSymbols), $combinedSymbols);
65
    }
66
67
}
68