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'); |
|
|
|
|
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
|
|
|
|
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.