Skip to content

Commit 1fd056d

Browse files
authored
Complete the current test suite (#250)
- Add to the specs the registered classes and functions recorded via the keys `'registered-classes'` and `'registered-functions'`. This should not change the current behaviour but makes it easier to test this part of the whitelisting feature. - Add a check to ensure the keys used in `'meta'` or a spec definition are all valid - Add the missing `'registered-functions'` where appropriate - Moved the specs testing from `PhpScoperTest` to `PhpScoperSpecTest` to make it more readable - Do not record the functions return types (which can be identifiers or names as well)
2 parents 56adc81 + 6c172ad commit 1fd056d

File tree

135 files changed

+752
-225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+752
-225
lines changed

specs/binary/simple.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
'whitelist' => [],
2121
'whitelist-global-constants' => true,
2222
'whitelist-global-functions' => true,
23+
'registered-classes' => [],
24+
'registered-functions' => [],
2325
],
2426

2527
'Some statements made directly in the global namespace' => <<<'PHP'

specs/class-FQ.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
'whitelist' => [],
2121
'whitelist-global-constants' => true,
2222
'whitelist-global-functions' => true,
23+
'registered-classes' => [],
24+
'registered-functions' => [],
2325
],
2426

2527
'Different kind of whitelisted class constant calls in the global scope' => [

specs/class-const/global-scope-single-level-with-single-level-use-statement-and-alias.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
'whitelist' => [],
2121
'whitelist-global-constants' => true,
2222
'whitelist-global-functions' => true,
23+
'registered-classes' => [],
24+
'registered-functions' => [],
2325
],
2426

2527
'Constant call on a aliased class which is imported via an aliased use statement and which belongs to the global namespace' => [

specs/class-const/global-scope-single-level-with-single-level-use-statement.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
'whitelist' => [],
2121
'whitelist-global-constants' => true,
2222
'whitelist-global-functions' => true,
23+
'registered-classes' => [],
24+
'registered-functions' => [],
2325
],
2426

2527
'Constant call on a class which is imported via a use statement and which belongs to the global namespace' => [

specs/class-const/global-scope-single-level.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
'whitelist' => [],
2121
'whitelist-global-constants' => true,
2222
'whitelist-global-functions' => true,
23+
'registered-classes' => [],
24+
'registered-functions' => [],
2325
],
2426

2527
'Constant call on a class belonging to the global namespace' => [

specs/class-const/global-scope-two-level-with-single-level-use-and-alias.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
'whitelist' => [],
2121
'whitelist-global-constants' => true,
2222
'whitelist-global-functions' => true,
23+
'registered-classes' => [],
24+
'registered-functions' => [],
2325
],
2426

2527
'Constant call on a namespaced class partially imported with an aliased use statement' => [

specs/class-const/global-scope-two-level-with-single-level-use.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
'whitelist' => [],
2121
'whitelist-global-constants' => true,
2222
'whitelist-global-functions' => true,
23+
'registered-classes' => [],
24+
'registered-functions' => [],
2325
],
2426

2527
'Constant call on a namespaced class partially imported with a use statement' => [

specs/class-const/global-scope-two-level.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
'whitelist' => [],
2121
'whitelist-global-constants' => true,
2222
'whitelist-global-functions' => true,
23+
'registered-classes' => [],
24+
'registered-functions' => [],
2325
],
2426

2527
'Constant call on a namespaced class' => [

specs/class-const/namespace-scope-single-level-with-single-level-use-statement-and-alias.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
'whitelist' => [],
2121
'whitelist-global-constants' => true,
2222
'whitelist-global-functions' => true,
23+
'registered-classes' => [],
24+
'registered-functions' => [],
2325
],
2426

2527
'Constant call on a aliased class which is imported via an aliased use statement and which belongs to the global namespace' => [

specs/class-const/namespace-scope-single-level.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
'whitelist' => [],
2121
'whitelist-global-constants' => true,
2222
'whitelist-global-functions' => true,
23+
'registered-classes' => [],
24+
'registered-functions' => [],
2325
],
2426

2527
'Constant call on a class belonging to the global namespace or the current namespace' => [

0 commit comments

Comments
 (0)