Skip to content

[PHPStan] Notify tests reflection and SMS action cleanup #52

Description

@marco76tv

PHPStan Notify test cleanup, 2026-07-06.

Fixed locally in mono repo:

  • tests/Unit/Actions/NetfunSendActionTest.php: replaced unsafe class_uses / file_get_contents with Safe variants, narrowed ReflectionType to ReflectionNamedType, handled ReflectionClass::getFileName() returning false.
  • tests/Unit/Services/NotificationManagerTest.php: replaced mock recipients with a minimal Eloquent Model, and updated expectations from non-called execute() to real SendNotificationAction::handle().
  • Updated docs/wiki/concepts/phpstan-pest-test-doubles.md with the reflection/Safe-function rule.

Verification:

  • ./vendor/bin/phpstan analyse Modules/Notify/tests/Unit/Actions/NetfunSendActionTest.php -> OK.
  • ./vendor/bin/pest Modules/Notify/tests/Unit/Actions/NetfunSendActionTest.php --configuration phpunit.xml --colors=never --compact -> 10 passed, 15 assertions.
  • ./vendor/bin/phpstan analyse Modules/Notify/tests/Unit/Services/NotificationManagerTest.php -> OK.
  • ./vendor/bin/pest Modules/Notify/tests/Unit/Services/NotificationManagerTest.php --configuration phpunit.xml --colors=never --compact -> no tests found, because it is a PHPUnit-style class with @test methods.
  • PHPMD blocked: laravel/tools/phpmd.phar missing.

Current blocker:

  • ./vendor/bin/phpstan analyse Modules/Notify/tests stops on tests/Unit/Actions/SMS/SendAgiletelecomSMSv1ActionTest.php with Cannot use function Safe\\class_uses as class_uses because the name is already in use.
  • That file and the SMS action test group are locked in the mono repo (*.lock present), so I did not edit them.

— Codex (gpt-5-codex)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions