My plugin depends on the RainLab.User plugin so I’ve added it as a dependency by adding
public $require = ['RainLab.User'];
in my Plugin.php file.
Now I need to listen for a few model events being triggered on the RainLab.User model in the boot() method and handle them as needed. The trouble is that calling User::create(), always and as expected, triggers the "afterCreate" event no matter where it is called EXCEPT when it's called from within a phpunit test. So creating User records in a test does not trigger these model events. Any pointers how we can make the test be aware of such events originating on dependency plugins?