This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

pratyushpundir6424
pratyushpundir6424

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?

hugo.wijdeveld
hugo.wijdeveld

Found a solution yet? I'm having the same problem and I can't seem to find any documentation on this matter. You said that the "afterCreate" event is NOT triggered in phpunit. Is that a guess or do you know?

akshay.solutiontree27438
akshay.solutiontree27438

hey i want to create a model for save the form but i dont know where to create the model please help me out

akshay.solutiontree27438
akshay.solutiontree27438

hey i want to create a model for save the form but i dont know where to create the model please help me out

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.