Skip to content

Commit

Permalink
Test disallowed array params
Browse files Browse the repository at this point in the history
  • Loading branch information
spaze committed Jan 20, 2023
1 parent f21e1fc commit cba53c5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/Calls/FunctionCallsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ protected function getRule(): Rule
'function' => '\Foo\Bar\Waldo\config()',
'disallowParams' => [
1 => 'string-key',
2 => [
'position' => 2,
'name' => 'flags',
'value' => [
'key' => 'disallow',
],
],
],
],
]
Expand Down Expand Up @@ -293,6 +300,10 @@ public function testRule(): void
'Calling Foo\Bar\Waldo\config() is forbidden, because reasons',
89,
],
[
'Calling Foo\Bar\Waldo\config() is forbidden, because reasons',
91,
],
]);
// Based on the configuration above, no errors in this file:
$this->analyse([__DIR__ . '/../src/disallowed-allow/functionCalls.php'], [
Expand Down
2 changes: 2 additions & 0 deletions tests/src/disallowed/functionCalls.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,5 @@

\Foo\Bar\Waldo\config(['key' => $value]);
\Foo\Bar\Waldo\config('string-key');
\Foo\Bar\Waldo\config('foo', ['key' => 'allow']);
\Foo\Bar\Waldo\config('foo', ['key' => 'disallow']);

0 comments on commit cba53c5

Please sign in to comment.