add controllers, servoices

This commit is contained in:
root
2026-03-09 02:52:13 -04:00
parent c8de5f7edc
commit d76c871cb7
501 changed files with 34439 additions and 21843 deletions
@@ -0,0 +1,52 @@
<?php
namespace Tests\Unit\Services\Users;
use App\Services\EmailService;
use App\Services\Users\UserEventService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Mockery;
use Tests\TestCase;
class UserEventServiceTest extends TestCase
{
use RefreshDatabase;
public function test_handle_new_account_sends_email(): void
{
$emailService = Mockery::mock(EmailService::class);
$emailService->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);
}
}