1 | <?php |
||
16 | class ObjectUtilitiesTest extends \PHPUnit_Framework_TestCase |
||
17 | { |
||
18 | /** |
||
19 | * @var ObjectUtilities |
||
20 | */ |
||
21 | protected $utility; |
||
22 | |||
23 | protected function setUp() |
||
32 | |||
33 | /** |
||
34 | * Test that a ReflectionClass is returned when a valid class name is provided |
||
35 | */ |
||
36 | public function testGetReflectionClass() |
||
40 | |||
41 | /** |
||
42 | * Test that ReflectionExceptions are handled gracefully for non existent classes |
||
43 | */ |
||
44 | public function testGetReflectionHandlesMissingClassesGracefully() |
||
48 | |||
49 | /** |
||
50 | * Test that a composer configured module name is returned for a valid SilverStripe module |
||
51 | */ |
||
52 | public function testGetModuleNameForValidClass() |
||
56 | |||
57 | /** |
||
58 | * Test that an empty string is returned gracefully if a module cannot be found |
||
59 | */ |
||
60 | public function testReturnEmptyStringWhenModuleNameCantBeFound() |
||
64 | |||
65 | /** |
||
66 | * Ensure that the project name can be retrieved from its composer configuration, and if it's the $project (mysite) |
||
67 | * then use the root directory composer.json |
||
68 | * |
||
69 | * @dataProvider composerConfigurationProvider |
||
70 | */ |
||
71 | public function testGetModuleNameFromComposerConfiguration($projectName, $folderName, $expected) |
||
78 | |||
79 | /** |
||
80 | * @return array[] |
||
81 | */ |
||
82 | public function composerConfigurationProvider() |
||
90 | |||
91 | /** |
||
92 | * Test that when an invalid class is passed to getModuleName it will return a blank string |
||
93 | */ |
||
94 | public function testGetModuleNameFromInvalidClassReturnsEmptyString() |
||
98 | |||
99 | /** |
||
100 | * Test that when the module's folder name is empty or missing, a blank string is returned |
||
101 | */ |
||
102 | public function testEmptyFolderNameInPathReturnsEmptyString() |
||
127 | |||
128 | /** |
||
129 | * Test that an unreadable composer file will return an empty array |
||
130 | */ |
||
131 | public function testHandleUnreadableComposerFile() |
||
138 | |||
139 | /** |
||
140 | * Test that when composer.json is empty an empty array is returned |
||
141 | */ |
||
142 | public function testEmptyComposerFile() |
||
150 | |||
151 | /** |
||
152 | * Test that if no composer.json file exists, an empty array is returned |
||
153 | */ |
||
154 | public function testHandleMissingComposerFile() |
||
158 | } |
||
159 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..