Skip to content

Commit

Permalink
Add test for internal error when calling undefined functions (#273)
Browse files Browse the repository at this point in the history
Follow up to #272
  • Loading branch information
IanDelMar authored Dec 2, 2024
1 parent f7beb13 commit 6686dc2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/HookCallbackRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function testRule(): void
$this->analyse(
[
__DIR__ . '/data/hook-callback.php',
__DIR__ . '/data/internal-error.php',
],
self::EXPECTED_ERRORS
);
Expand Down
1 change: 1 addition & 0 deletions tests/HookDocsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function testRule(): void
$this->analyse(
[
__DIR__ . '/data/hook-docs.php',
__DIR__ . '/data/internal-error.php',
],
[
[
Expand Down
7 changes: 7 additions & 0 deletions tests/data/internal-error.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

/*
* Intentionally call an undefined function to ensure it does not trigger an internal error.
* Related issue: https://github.com/szepeviktor/phpstan-wordpress/issues/271
*/
callingUndefinedFunction();

0 comments on commit 6686dc2

Please sign in to comment.