shouldReceive('send') ->once() ->with( 'user@example.com', 'Welcome to Al Rahma Sunday School!', Mockery::type('string'), 'registration' ) ->andReturn(true); $service = new UserEventService($emailService); $result = $service->handleNewAccountAdded([ 'firstname' => 'Test', 'lastname' => 'User', 'email' => 'user@example.com', ]); $this->assertTrue($result); } public function test_handle_new_account_requires_email(): void { $emailService = Mockery::mock(EmailService::class); $emailService->shouldNotReceive('send'); $service = new UserEventService($emailService); $result = $service->handleNewAccountAdded([ 'firstname' => 'Test', 'lastname' => 'User', ]); $this->assertFalse($result); } }