add all controllers logic

This commit is contained in:
root
2026-03-11 17:53:15 -04:00
parent 3e6c577085
commit 2ef71cc92b
421 changed files with 12009 additions and 5211 deletions
@@ -0,0 +1,39 @@
<?php
namespace Tests\Unit\Services\Frontend;
use App\Services\Email\EmailDispatchService;
use App\Services\Frontend\ContactSubmissionService;
use App\Services\System\GlobalConfigService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;
class ContactSubmissionServiceTest extends TestCase
{
use RefreshDatabase;
public function test_submit_creates_contact_record(): void
{
DB::table('configuration')->insert([
['config_key' => 'school_year', 'config_value' => '2025-2026'],
['config_key' => 'semester', 'config_value' => 'Fall'],
]);
$emailService = $this->createMock(EmailDispatchService::class);
$emailService->method('send')->willReturn(false);
$service = new ContactSubmissionService($emailService, new GlobalConfigService());
$result = $service->submit([
'email' => 'contact@example.com',
'message' => 'Hello from unit test',
]);
$this->assertNotNull($result['record']);
$this->assertDatabaseHas('contactus', [
'subject' => 'Contact Us Form Submission',
'semester' => 'Fall',
]);
}
}