Page MenuHomeDevCentral

[DO NOT MERGE] Use Laravel WithoutEvents test trait
AbandonedPublic

Authored by dereckson on Jan 9 2016, 15:16.
Tags
None
Referenced Files
F20827982: D199.id471.diff
Mon, Jan 12, 10:32
Unknown Object (File)
Sat, Jan 3, 15:01
Unknown Object (File)
Thu, Dec 25, 20:52
Unknown Object (File)
Mon, Dec 15, 05:25
Unknown Object (File)
Sat, Dec 13, 20:48
Unknown Object (File)
Dec 13 2025, 01:49
Unknown Object (File)
Dec 10 2025, 02:54
Unknown Object (File)
Dec 6 2025, 00:40
Subscribers
None

Details

Reviewers
None
Summary

D195 introduced TestCase::disableEvents, as the Laravel methods
MocksApplicationServices::expectEvents and ::withoutEvents don't
mock the listen method.

We can use the Laravel implementation now it has been fixed at
the framework level.

Test Plan

phpunit --no-coverage

Diff Detail

Repository
rNOTIF Notifications center
Lint
Lint Passed
Unit
Tests Passed
Branch
use-laravel-events-mock
Build Status
Buildable 261
Build 261: arc lint + arc unit

Event Timeline

dereckson retitled this revision from to [DO NOT MERGE] Use Laravel WithoutEvents test trait.
dereckson updated this object.
dereckson edited the test plan for this revision. (Show Details)

Upstream not interested by the change, but provides a simpler solution.

TestCase::disableEvents()
$this->withoutEvents();
Events::shouldReceive('listen');
[RuntimeException]                                                                             
Error Output: PHP Fatal error:  Class 'Events' not found in /home/ubuntu/workspace/notificati  
ons/tests/TestCase.php on line 44