add projet
This commit is contained in:
@@ -0,0 +1,243 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Models\AdditionalCharge;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdditionalChargeTest extends TestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
Schema::dropIfExists('additional_charges');
|
||||
Schema::dropIfExists('invoices');
|
||||
Schema::dropIfExists('users');
|
||||
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('firstname')->nullable();
|
||||
$table->string('lastname')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('invoices', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('invoice_number')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('additional_charges', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('parent_id')->nullable();
|
||||
$table->unsignedBigInteger('invoice_id')->nullable();
|
||||
$table->string('school_year', 20);
|
||||
$table->string('semester', 20);
|
||||
$table->string('charge_type', 20);
|
||||
$table->string('title');
|
||||
$table->text('description')->nullable();
|
||||
$table->decimal('amount', 10, 2);
|
||||
$table->date('due_date')->nullable();
|
||||
$table->string('status', 20);
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function test_scope_by_parent_term_filters_status_and_orders_desc(): void
|
||||
{
|
||||
$parentId = 1;
|
||||
|
||||
AdditionalCharge::create([
|
||||
'parent_id' => $parentId,
|
||||
'invoice_id' => null,
|
||||
'school_year' => '2024-2025',
|
||||
'semester' => 'Fall',
|
||||
'charge_type' => 'extra',
|
||||
'title' => 'Older',
|
||||
'description' => null,
|
||||
'amount' => 10.00,
|
||||
'due_date' => '2024-09-01',
|
||||
'status' => 'pending',
|
||||
'created_by' => null,
|
||||
]);
|
||||
|
||||
$latest = AdditionalCharge::create([
|
||||
'parent_id' => $parentId,
|
||||
'invoice_id' => null,
|
||||
'school_year' => '2024-2025',
|
||||
'semester' => 'Fall',
|
||||
'charge_type' => 'extra',
|
||||
'title' => 'Latest',
|
||||
'description' => null,
|
||||
'amount' => 20.00,
|
||||
'due_date' => '2024-10-01',
|
||||
'status' => 'pending',
|
||||
'created_by' => null,
|
||||
]);
|
||||
|
||||
AdditionalCharge::create([
|
||||
'parent_id' => $parentId,
|
||||
'invoice_id' => null,
|
||||
'school_year' => '2024-2025',
|
||||
'semester' => 'Fall',
|
||||
'charge_type' => 'extra',
|
||||
'title' => 'Applied',
|
||||
'description' => null,
|
||||
'amount' => 5.00,
|
||||
'due_date' => '2024-08-01',
|
||||
'status' => 'applied',
|
||||
'created_by' => null,
|
||||
]);
|
||||
|
||||
$results = AdditionalCharge::query()
|
||||
->byParentTerm($parentId, '2024-2025', 'Fall', 'pending')
|
||||
->get();
|
||||
|
||||
$this->assertCount(2, $results);
|
||||
$this->assertSame($latest->id, $results->first()->id);
|
||||
$this->assertSame('pending', $results->first()->status);
|
||||
}
|
||||
|
||||
public function test_mark_applied_updates_status_and_invoice(): void
|
||||
{
|
||||
$invoiceId = 1;
|
||||
|
||||
$first = AdditionalCharge::create([
|
||||
'parent_id' => 1,
|
||||
'invoice_id' => null,
|
||||
'school_year' => '2024-2025',
|
||||
'semester' => 'Fall',
|
||||
'charge_type' => 'extra',
|
||||
'title' => 'Charge 1',
|
||||
'description' => null,
|
||||
'amount' => 15.00,
|
||||
'due_date' => null,
|
||||
'status' => 'pending',
|
||||
'created_by' => null,
|
||||
]);
|
||||
|
||||
$second = AdditionalCharge::create([
|
||||
'parent_id' => 1,
|
||||
'invoice_id' => null,
|
||||
'school_year' => '2024-2025',
|
||||
'semester' => 'Fall',
|
||||
'charge_type' => 'extra',
|
||||
'title' => 'Charge 2',
|
||||
'description' => null,
|
||||
'amount' => 25.00,
|
||||
'due_date' => null,
|
||||
'status' => 'pending',
|
||||
'created_by' => null,
|
||||
]);
|
||||
|
||||
$model = new AdditionalCharge();
|
||||
$result = $model->markApplied([$first->id, (string) $second->id], $invoiceId);
|
||||
|
||||
$this->assertTrue($result);
|
||||
$this->assertSame('applied', $first->refresh()->status);
|
||||
$this->assertSame($invoiceId, $first->invoice_id);
|
||||
$this->assertSame('applied', $second->refresh()->status);
|
||||
$this->assertSame($invoiceId, $second->invoice_id);
|
||||
}
|
||||
|
||||
public function test_list_all_for_term_falls_back_to_year(): void
|
||||
{
|
||||
$parentId = 1;
|
||||
$invoiceId = 1;
|
||||
|
||||
DB::table('users')->insert([
|
||||
'id' => $parentId,
|
||||
'firstname' => 'Sara',
|
||||
'lastname' => 'Khan',
|
||||
]);
|
||||
|
||||
DB::table('invoices')->insert([
|
||||
'id' => $invoiceId,
|
||||
'invoice_number' => 'INV-1',
|
||||
]);
|
||||
|
||||
AdditionalCharge::create([
|
||||
'parent_id' => $parentId,
|
||||
'invoice_id' => $invoiceId,
|
||||
'school_year' => '2024-2025',
|
||||
'semester' => 'Fall',
|
||||
'charge_type' => 'extra',
|
||||
'title' => 'Fee',
|
||||
'description' => null,
|
||||
'amount' => 30.00,
|
||||
'due_date' => null,
|
||||
'status' => 'pending',
|
||||
'created_by' => null,
|
||||
]);
|
||||
|
||||
$paginator = (new AdditionalCharge())->listAllForTerm('2024-2025', 'Spring', null, null, 50, true);
|
||||
|
||||
$this->assertSame(1, $paginator->total());
|
||||
$first = $paginator->items()[0];
|
||||
$this->assertSame('Khan, Sara', $first->parent_name);
|
||||
$this->assertSame('INV-1', $first->invoice_number);
|
||||
}
|
||||
|
||||
public function test_list_all_for_term_filters_by_search_query(): void
|
||||
{
|
||||
$parentId = 1;
|
||||
$invoiceId = 1;
|
||||
|
||||
DB::table('users')->insert([
|
||||
'id' => $parentId,
|
||||
'firstname' => 'Amina',
|
||||
'lastname' => 'Hassan',
|
||||
]);
|
||||
|
||||
DB::table('invoices')->insert([
|
||||
'id' => $invoiceId,
|
||||
'invoice_number' => 'INV-2025-001',
|
||||
]);
|
||||
|
||||
AdditionalCharge::create([
|
||||
'parent_id' => $parentId,
|
||||
'invoice_id' => $invoiceId,
|
||||
'school_year' => '2024-2025',
|
||||
'semester' => 'Fall',
|
||||
'charge_type' => 'extra',
|
||||
'title' => 'Math Club Fee',
|
||||
'description' => 'After school enrichment',
|
||||
'amount' => 30.00,
|
||||
'due_date' => null,
|
||||
'status' => 'pending',
|
||||
'created_by' => null,
|
||||
]);
|
||||
|
||||
AdditionalCharge::create([
|
||||
'parent_id' => $parentId,
|
||||
'invoice_id' => $invoiceId,
|
||||
'school_year' => '2024-2025',
|
||||
'semester' => 'Fall',
|
||||
'charge_type' => 'extra',
|
||||
'title' => 'Science Lab',
|
||||
'description' => 'Lab supplies',
|
||||
'amount' => 20.00,
|
||||
'due_date' => null,
|
||||
'status' => 'pending',
|
||||
'created_by' => null,
|
||||
]);
|
||||
|
||||
$paginator = (new AdditionalCharge())->listAllForTerm('2024-2025', 'Fall', null, 'Math', 50, true);
|
||||
|
||||
$this->assertSame(1, $paginator->total());
|
||||
$this->assertSame('Math Club Fee', $paginator->items()[0]->title);
|
||||
|
||||
$byDescription = (new AdditionalCharge())->listAllForTerm('2024-2025', 'Fall', null, 'enrichment', 50, true);
|
||||
$this->assertSame(1, $byDescription->total());
|
||||
$this->assertSame('Math Club Fee', $byDescription->items()[0]->title);
|
||||
|
||||
$byParentName = (new AdditionalCharge())->listAllForTerm('2024-2025', 'Fall', null, 'Hassan', 50, true);
|
||||
$this->assertSame(2, $byParentName->total());
|
||||
|
||||
$byInvoice = (new AdditionalCharge())->listAllForTerm('2024-2025', 'Fall', null, 'INV-2025-001', 50, true);
|
||||
$this->assertSame(2, $byInvoice->total());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Models\AdminNotificationSubject;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminNotificationSubjectModelTest extends TestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
Schema::dropIfExists('admin_notification_subjects');
|
||||
Schema::dropIfExists('users');
|
||||
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('firstname')->nullable();
|
||||
$table->string('lastname')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('admin_notification_subjects', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('admin_id')->index();
|
||||
$table->string('subject');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function test_admin_relationship_returns_user(): void
|
||||
{
|
||||
DB::table('users')->insert([
|
||||
'id' => 10,
|
||||
'firstname' => 'Aisha',
|
||||
'lastname' => 'Saleh',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
$subject = AdminNotificationSubject::create([
|
||||
'admin_id' => 10,
|
||||
'subject' => 'Weekly Summary',
|
||||
]);
|
||||
|
||||
$this->assertNotNull($subject->admin);
|
||||
$admin = $subject->admin;
|
||||
$adminId = is_array($admin) ? ($admin['id'] ?? null) : $admin->id;
|
||||
$this->assertSame(10, $adminId);
|
||||
}
|
||||
|
||||
public function test_timestamps_are_set_on_create(): void
|
||||
{
|
||||
DB::table('users')->insert([
|
||||
'id' => 1,
|
||||
'firstname' => 'Fatima',
|
||||
'lastname' => 'Ali',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
$subject = AdminNotificationSubject::create([
|
||||
'admin_id' => 1,
|
||||
'subject' => 'New Subject',
|
||||
]);
|
||||
|
||||
$fresh = $subject->fresh();
|
||||
$createdAt = is_array($fresh) ? ($fresh['created_at'] ?? null) : $fresh->created_at;
|
||||
$updatedAt = is_array($fresh) ? ($fresh['updated_at'] ?? null) : $fresh->updated_at;
|
||||
|
||||
$this->assertNotNull($createdAt);
|
||||
$this->assertNotNull($updatedAt);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Models\AttendanceCommentTemplate;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AttendanceCommentTemplateModelTest extends TestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
Schema::dropIfExists('attendance_comment_template');
|
||||
|
||||
Schema::create('attendance_comment_template', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->decimal('min_score', 5, 2);
|
||||
$table->decimal('max_score', 5, 2);
|
||||
$table->text('template_text');
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function test_get_active_templates_filters_and_orders(): void
|
||||
{
|
||||
AttendanceCommentTemplate::create([
|
||||
'min_score' => 0,
|
||||
'max_score' => 60,
|
||||
'template_text' => 'Needs improvement.',
|
||||
'is_active' => 1,
|
||||
]);
|
||||
|
||||
AttendanceCommentTemplate::create([
|
||||
'min_score' => 61,
|
||||
'max_score' => 80,
|
||||
'template_text' => 'Good progress.',
|
||||
'is_active' => 0,
|
||||
]);
|
||||
|
||||
AttendanceCommentTemplate::create([
|
||||
'min_score' => 81,
|
||||
'max_score' => 100,
|
||||
'template_text' => 'Excellent work.',
|
||||
'is_active' => 1,
|
||||
]);
|
||||
|
||||
$model = new AttendanceCommentTemplate();
|
||||
$results = $model->getActiveTemplates();
|
||||
|
||||
$this->assertCount(2, $results);
|
||||
$this->assertSame(81, $results[0]['min_score']);
|
||||
$this->assertSame(0, $results[1]['min_score']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Models\AttendanceData;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AttendanceDataTest extends TestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
Schema::dropIfExists('attendance_data');
|
||||
|
||||
Schema::create('attendance_data', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('class_id');
|
||||
$table->unsignedBigInteger('class_section_id');
|
||||
$table->unsignedBigInteger('student_id');
|
||||
$table->char('school_id', 36);
|
||||
$table->date('date');
|
||||
$table->string('status', 20)->default('present');
|
||||
$table->text('reason')->nullable();
|
||||
$table->string('is_reported', 10)->default('no');
|
||||
$table->string('is_notified', 10)->default('no');
|
||||
$table->string('semester', 25);
|
||||
$table->string('school_year', 9);
|
||||
$table->unsignedBigInteger('modified_by')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function test_get_attendance_by_class_and_get_attendance(): void
|
||||
{
|
||||
AttendanceData::create([
|
||||
'class_id' => 1,
|
||||
'class_section_id' => 2,
|
||||
'school_id' => 1,
|
||||
'student_id' => 10,
|
||||
'date' => '2024-09-01',
|
||||
'status' => 'present',
|
||||
'reason' => null,
|
||||
'is_reported' => 'no',
|
||||
'is_notified' => 'no',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2024-2025',
|
||||
'modified_by' => null,
|
||||
]);
|
||||
|
||||
AttendanceData::create([
|
||||
'class_id' => 2,
|
||||
'class_section_id' => 2,
|
||||
'school_id' => 1,
|
||||
'student_id' => 11,
|
||||
'date' => '2024-09-01',
|
||||
'status' => 'present',
|
||||
'reason' => null,
|
||||
'is_reported' => 'no',
|
||||
'is_notified' => 'no',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2024-2025',
|
||||
'modified_by' => null,
|
||||
]);
|
||||
|
||||
$model = new AttendanceData();
|
||||
$rows = $model->getAttendanceByClass(1, 2, '2024-09-01');
|
||||
$this->assertCount(1, $rows);
|
||||
|
||||
$row = $model->getAttendance(10, 2, '2024-09-01');
|
||||
$this->assertNotNull($row);
|
||||
$this->assertSame(10, $row['student_id']);
|
||||
}
|
||||
|
||||
public function test_unreported_term_rows_filters_unreported(): void
|
||||
{
|
||||
DB::table('attendance_data')->insert([
|
||||
[
|
||||
'class_id' => 1,
|
||||
'class_section_id' => 1,
|
||||
'school_id' => 1,
|
||||
'student_id' => 1,
|
||||
'date' => '2024-09-01',
|
||||
'status' => 'absent',
|
||||
'reason' => null,
|
||||
'is_reported' => 'no',
|
||||
'is_notified' => 'no',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2024-2025',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'class_id' => 1,
|
||||
'class_section_id' => 1,
|
||||
'school_id' => 1,
|
||||
'student_id' => 2,
|
||||
'date' => '2024-09-02',
|
||||
'status' => 'absent',
|
||||
'reason' => null,
|
||||
'is_reported' => 'yes',
|
||||
'is_notified' => 'no',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2024-2025',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'class_id' => 1,
|
||||
'class_section_id' => 1,
|
||||
'school_id' => 1,
|
||||
'student_id' => 3,
|
||||
'date' => '2024-09-03',
|
||||
'status' => 'absent',
|
||||
'reason' => null,
|
||||
'is_reported' => 'no',
|
||||
'is_notified' => 'no',
|
||||
'semester' => 'Spring',
|
||||
'school_year' => '2024-2025',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
]);
|
||||
|
||||
$model = new AttendanceData();
|
||||
$rows = $model->unreportedTermRows([1, 2, 3], '2024-2025', 'Fall');
|
||||
|
||||
$this->assertCount(1, $rows);
|
||||
$this->assertSame(1, $rows[0]['student_id']);
|
||||
}
|
||||
|
||||
public function test_get_unreported_absences_and_lates_groups_rows(): void
|
||||
{
|
||||
DB::table('attendance_data')->insert([
|
||||
[
|
||||
'class_id' => 1,
|
||||
'class_section_id' => 1,
|
||||
'school_id' => 1,
|
||||
'student_id' => 10,
|
||||
'date' => '2024-09-01',
|
||||
'status' => 'absent',
|
||||
'reason' => null,
|
||||
'is_reported' => 'no',
|
||||
'is_notified' => 'no',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2024-2025',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'class_id' => 1,
|
||||
'class_section_id' => 1,
|
||||
'school_id' => 1,
|
||||
'student_id' => 10,
|
||||
'date' => '2024-09-02',
|
||||
'status' => 'late',
|
||||
'reason' => null,
|
||||
'is_reported' => 'no',
|
||||
'is_notified' => 'no',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2024-2025',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'class_id' => 1,
|
||||
'class_section_id' => 1,
|
||||
'school_id' => 1,
|
||||
'student_id' => 10,
|
||||
'date' => '2024-09-03',
|
||||
'status' => 'absent',
|
||||
'reason' => null,
|
||||
'is_reported' => 'yes',
|
||||
'is_notified' => 'no',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2024-2025',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
]);
|
||||
|
||||
$model = new AttendanceData();
|
||||
$rows = $model->getUnreportedAbsencesAndLates('2024-2025', 'Fall');
|
||||
|
||||
$this->assertArrayHasKey(10, $rows);
|
||||
$this->assertSame(1, $rows[10]['counts']['absences']);
|
||||
$this->assertSame(1, $rows[10]['counts']['lates']);
|
||||
$this->assertSame(2, $rows[10]['counts']['total']);
|
||||
}
|
||||
|
||||
public function test_mark_reported_and_notified_updates_flags(): void
|
||||
{
|
||||
DB::table('attendance_data')->insert([
|
||||
'class_id' => 1,
|
||||
'class_section_id' => 1,
|
||||
'school_id' => 1,
|
||||
'student_id' => 20,
|
||||
'date' => '2024-09-10',
|
||||
'status' => 'absent',
|
||||
'reason' => null,
|
||||
'is_reported' => 'no',
|
||||
'is_notified' => 'no',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2024-2025',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
$model = new AttendanceData();
|
||||
$result = $model->markReportedAndNotified(20, ['2024-09-10'], 'Fall', '2024-2025');
|
||||
|
||||
$this->assertTrue($result);
|
||||
|
||||
$row = DB::table('attendance_data')->where('student_id', 20)->first();
|
||||
$this->assertSame('yes', $row->is_reported);
|
||||
$this->assertSame('yes', $row->is_notified);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Models\AttendanceDay;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AttendanceDayTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_get_or_create_draft_creates_once_and_reuses(): void
|
||||
{
|
||||
$a = AttendanceDay::getOrCreateDraft(10, '2026-02-23', 'Fall', '2025-2026', 5);
|
||||
$b = AttendanceDay::getOrCreateDraft(10, '2026-02-23', 'Fall', '2025-2026', 7);
|
||||
|
||||
$this->assertSame($a->id, $b->id);
|
||||
$this->assertSame('draft', $a->status);
|
||||
|
||||
$this->assertDatabaseCount('attendance_day', 1);
|
||||
$this->assertDatabaseHas('attendance_day', [
|
||||
'id' => $a->id,
|
||||
'class_section_id' => 10,
|
||||
'date' => '2026-02-23',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
'status' => 'draft',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_find_by_section_date_returns_model_or_null(): void
|
||||
{
|
||||
$found = AttendanceDay::findBySectionDate(1, '2026-02-23', 'Fall', '2025-2026');
|
||||
$this->assertNull($found);
|
||||
|
||||
$row = AttendanceDay::getOrCreateDraft(1, '2026-02-23', 'Fall', '2025-2026');
|
||||
$found2 = AttendanceDay::findBySectionDate(1, '2026-02-23', 'Fall', '2025-2026');
|
||||
|
||||
$this->assertNotNull($found2);
|
||||
$this->assertSame($row->id, $found2->id);
|
||||
}
|
||||
|
||||
public function test_submit_sets_submitted_fields(): void
|
||||
{
|
||||
$row = AttendanceDay::getOrCreateDraft(2, '2026-02-23', 'Fall', '2025-2026');
|
||||
|
||||
$ok = $row->submit(99, '2026-03-01 10:00:00');
|
||||
$this->assertTrue($ok);
|
||||
|
||||
$row->refresh();
|
||||
$this->assertSame('submitted', $row->status);
|
||||
$this->assertSame(99, $row->submitted_by);
|
||||
$this->assertNotNull($row->submitted_at);
|
||||
$this->assertNotNull($row->auto_publish_at);
|
||||
}
|
||||
|
||||
public function test_finalize_is_alias_to_submit(): void
|
||||
{
|
||||
$row = AttendanceDay::getOrCreateDraft(3, '2026-02-23', 'Fall', '2025-2026');
|
||||
|
||||
$row->finalize(101);
|
||||
$row->refresh();
|
||||
|
||||
$this->assertSame('submitted', $row->status);
|
||||
$this->assertSame(101, $row->submitted_by);
|
||||
$this->assertNotNull($row->submitted_at);
|
||||
}
|
||||
|
||||
public function test_publish_sets_published_fields(): void
|
||||
{
|
||||
$row = AttendanceDay::getOrCreateDraft(4, '2026-02-23', 'Fall', '2025-2026');
|
||||
|
||||
$row->publish(55);
|
||||
$row->refresh();
|
||||
|
||||
$this->assertSame('published', $row->status);
|
||||
$this->assertSame(55, $row->published_by);
|
||||
$this->assertNotNull($row->published_at);
|
||||
}
|
||||
|
||||
public function test_reopen_sets_reopen_fields_and_status(): void
|
||||
{
|
||||
$row = AttendanceDay::getOrCreateDraft(5, '2026-02-23', 'Fall', '2025-2026');
|
||||
$row->publish(1);
|
||||
|
||||
$row->reopen(2, 'draft', 'Fix absences');
|
||||
$row->refresh();
|
||||
|
||||
$this->assertSame('draft', $row->status);
|
||||
$this->assertSame(2, $row->reopened_by);
|
||||
$this->assertNotNull($row->reopened_at);
|
||||
$this->assertSame('Fix absences', $row->reopen_reason);
|
||||
}
|
||||
|
||||
public function test_reopen_rejects_invalid_status(): void
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
|
||||
$row = AttendanceDay::getOrCreateDraft(6, '2026-02-23', 'Fall', '2025-2026');
|
||||
$row->reopen(2, 'published'); // invalid
|
||||
}
|
||||
|
||||
public function test_is_finalized_true_for_published_or_legacy_finalized(): void
|
||||
{
|
||||
$row = AttendanceDay::getOrCreateDraft(7, '2026-02-23', 'Fall', '2025-2026');
|
||||
$row->publish(1);
|
||||
|
||||
$this->assertTrue(AttendanceDay::isFinalized(7, '2026-02-23', 'Fall', '2025-2026'));
|
||||
$this->assertFalse(AttendanceDay::isFinalized(7, '2026-02-24', 'Fall', '2025-2026'));
|
||||
|
||||
// legacy "finalized"
|
||||
AttendanceDay::query()->create([
|
||||
'class_section_id' => 8,
|
||||
'date' => '2026-02-23',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
'status' => 'finalized',
|
||||
'created_at' => now('UTC'),
|
||||
'updated_at' => now('UTC'),
|
||||
]);
|
||||
|
||||
$this->assertTrue(AttendanceDay::isFinalized(8, '2026-02-23', 'Fall', '2025-2026'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\AttendanceEmailTemplate;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AttendanceEmailTemplateTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_get_template_returns_exact_active_variant_when_available(): void
|
||||
{
|
||||
AttendanceEmailTemplate::query()->create([
|
||||
'code' => 'attendance_absent',
|
||||
'variant' => 'default',
|
||||
'subject' => 'Default Subject',
|
||||
'body_html' => '<p>Default</p>',
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
AttendanceEmailTemplate::query()->create([
|
||||
'code' => 'attendance_absent',
|
||||
'variant' => 'answered',
|
||||
'subject' => 'Parent Subject',
|
||||
'body_html' => '<p>Parent</p>',
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
$result = (new AttendanceEmailTemplate())->getTemplate('attendance_absent', 'answered');
|
||||
|
||||
$this->assertIsArray($result);
|
||||
$this->assertSame('answered', $result['variant']);
|
||||
$this->assertSame('Parent Subject', $result['subject']);
|
||||
}
|
||||
|
||||
public function test_get_template_falls_back_to_default_when_requested_variant_missing(): void
|
||||
{
|
||||
AttendanceEmailTemplate::query()->create([
|
||||
'code' => 'attendance_late',
|
||||
'variant' => 'default',
|
||||
'subject' => 'Late Default',
|
||||
'body_html' => '<p>Late default</p>',
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
$result = (new AttendanceEmailTemplate())->getTemplate('attendance_late', 'answered');
|
||||
|
||||
$this->assertIsArray($result);
|
||||
$this->assertSame('default', $result['variant']);
|
||||
$this->assertSame('Late Default', $result['subject']);
|
||||
}
|
||||
|
||||
public function test_get_template_ignores_inactive_exact_variant_and_uses_active_default(): void
|
||||
{
|
||||
AttendanceEmailTemplate::query()->create([
|
||||
'code' => 'attendance_present',
|
||||
'variant' => 'no_answer',
|
||||
'subject' => 'Inactive SMS',
|
||||
'body_html' => '<p>Inactive</p>',
|
||||
'is_active' => false,
|
||||
]);
|
||||
|
||||
AttendanceEmailTemplate::query()->create([
|
||||
'code' => 'attendance_present',
|
||||
'variant' => 'default',
|
||||
'subject' => 'Active Default',
|
||||
'body_html' => '<p>Active</p>',
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
$result = (new AttendanceEmailTemplate())->getTemplate('attendance_present', 'no_answer');
|
||||
|
||||
$this->assertIsArray($result);
|
||||
$this->assertSame('default', $result['variant']);
|
||||
$this->assertSame('Active Default', $result['subject']);
|
||||
}
|
||||
|
||||
public function test_get_template_returns_null_when_no_active_template_exists(): void
|
||||
{
|
||||
AttendanceEmailTemplate::query()->create([
|
||||
'code' => 'attendance_unknown',
|
||||
'variant' => 'default',
|
||||
'subject' => 'Inactive Default',
|
||||
'body_html' => '<p>Inactive</p>',
|
||||
'is_active' => false,
|
||||
]);
|
||||
|
||||
$result = (new AttendanceEmailTemplate())->getTemplate('attendance_unknown', 'anything');
|
||||
|
||||
$this->assertNull($result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\AttendanceRecord;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class AttendanceRecordTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new AttendanceRecord();
|
||||
|
||||
$this->assertSame('attendance_record', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["class_section_id", "student_id", "school_id", "total_absence", "total_late", "total_presence", "total_attendance", "semester", "school_year", "modified_by", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(AttendanceRecord::class, new AttendanceRecord());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\AttendanceTracking;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class AttendanceTrackingTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new AttendanceTracking();
|
||||
|
||||
$this->assertSame('attendance_tracking', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["student_id", "date", "is_reported", "reason", "note", "is_notified", "notif_counter", "semester", "school_year", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(AttendanceTracking::class, new AttendanceTracking());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\AuthorizedUser;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class AuthorizedUserTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new AuthorizedUser();
|
||||
|
||||
$this->assertSame('authorized_users', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["user_id", "authorized_user_id", "firstname", "lastname", "phone_number", "gender", "email", "relation_to_user", "token", "status", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(AuthorizedUser::class, new AuthorizedUser());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\BadgePrintLog;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class BadgePrintLogTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new BadgePrintLog();
|
||||
|
||||
$this->assertSame('badge_print_logs', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["user_id", "printed_by", "school_year", "printed_at", "role", "class_section_name", "copies"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(BadgePrintLog::class, new BadgePrintLog());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Calendar;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class CalendarTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Calendar();
|
||||
|
||||
$this->assertSame('calendar_events', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["title", "date", "description", "notify_parent", "notify_admin", "notify_teacher", "no_school", "semester", "school_year", "notification_sent", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Calendar::class, new Calendar());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\ClassPrepAdjustment;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ClassPrepAdjustmentTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new ClassPrepAdjustment();
|
||||
|
||||
$this->assertSame('class_prep_adjustments', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["class_section_id", "item_name", "adjustment", "adjustable", "school_year", "created_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(ClassPrepAdjustment::class, new ClassPrepAdjustment());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\ClassPreparationLog;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ClassPreparationLogTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new ClassPreparationLog();
|
||||
|
||||
$this->assertSame('class_preparation_log', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["class_section_id", "class_section", "school_year", "prep_data", "created_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(ClassPreparationLog::class, new ClassPreparationLog());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\ClassProgressAttachment;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ClassProgressAttachmentTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new ClassProgressAttachment();
|
||||
|
||||
$this->assertSame('class_progress_attachments', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["report_id", "file_path", "original_name", "mime_type", "file_size", "created_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(ClassProgressAttachment::class, new ClassProgressAttachment());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\ClassProgressReport;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ClassProgressReportTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new ClassProgressReport();
|
||||
|
||||
$this->assertSame('class_progress_reports', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["class_section_id", "teacher_id", "week_start", "week_end", "subject", "unit_title", "materials", "covered", "homework", "assessment", "status", "status_notes", "class_notes", "next_week_plan", "support_needed", "flags_json", "attachment_path", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(ClassProgressReport::class, new ClassProgressReport());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\ClassSection;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ClassSectionTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new ClassSection();
|
||||
|
||||
$this->assertSame('classSection', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["class_id", "class_section_id", "class_section_name", "created_at", "updated_at", "semester", "school_year"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(ClassSection::class, new ClassSection());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\ClassModel as SchoolClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ClassTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new SchoolClass();
|
||||
|
||||
$this->assertSame('classes', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["class_name", "schedule", "capacity", "semester", "school_year"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(SchoolClass::class, new SchoolClass());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\CommunicationLog;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class CommunicationLogTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new CommunicationLog();
|
||||
|
||||
$this->assertSame('communication_logs', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["student_id", "family_id", "student_name", "template_key", "subject", "body", "recipients", "cc", "bcc", "attachments", "status", "error_message", "sent_by", "metadata"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(CommunicationLog::class, new CommunicationLog());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\CompetitionClassWinner;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class CompetitionClassWinnerTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new CompetitionClassWinner();
|
||||
|
||||
$this->assertSame('competition_class_winners', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["competition_id", "class_section_id", "winners_override", "created_at", "updated_at", "question_count", "prize_1", "prize_2", "prize_3", "prize_4", "prize_5", "prize_6"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(CompetitionClassWinner::class, new CompetitionClassWinner());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\CompetitionScore;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class CompetitionScoreTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new CompetitionScore();
|
||||
|
||||
$this->assertSame('competition_scores', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["competition_id", "student_id", "class_section_id", "score", "notes", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(CompetitionScore::class, new CompetitionScore());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Competition;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class CompetitionTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Competition();
|
||||
|
||||
$this->assertSame('competitions', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["title", "semester", "school_year", "class_section_id", "start_date", "end_date", "winners_count", "prize_per_point", "is_published", "published_at", "created_by", "created_at", "updated_at", "deleted_at", "is_locked", "locked_at", "locked_by"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Competition::class, new Competition());
|
||||
$this->assertContains(SoftDeletes::class, class_uses_recursive(Competition::class));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\CompetitionWinner;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class CompetitionWinnerTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new CompetitionWinner();
|
||||
|
||||
$this->assertSame('competition_winners', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["competition_id", "student_id", "class_section_id", "rank", "score", "prize_amount", "created_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(CompetitionWinner::class, new CompetitionWinner());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Configuration;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ConfigurationTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Configuration();
|
||||
|
||||
$this->assertSame('configuration', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["config_key", "config_value"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Configuration::class, new Configuration());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\ContactUs;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ContactUsTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new ContactUs();
|
||||
|
||||
$this->assertSame('contactus', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["sender_id", "reciever_id", "subject", "message", "created_at", "updated_at", "semester", "school_year"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(ContactUs::class, new ContactUs());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\CurrentFlag;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class CurrentFlagTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new CurrentFlag();
|
||||
|
||||
$this->assertSame('current_flag', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["student_id", "student_name", "grade", "flag", "flag_datetime", "flag_state", "updated_by_open", "open_description", "updated_by_closed", "close_description", "action_taken", "updated_by_canceled", "cancel_description", "semester", "school_year", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(CurrentFlag::class, new CurrentFlag());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\DiscountUsage;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class DiscountUsageTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new DiscountUsage();
|
||||
|
||||
$this->assertSame('discount_usages', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["voucher_id", "invoice_id", "parent_id", "discount_amount", "description", "school_year", "updated_by", "used_at", "created_at", "updated_at", "semester"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(DiscountUsage::class, new DiscountUsage());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\DiscountVoucher;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class DiscountVoucherTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new DiscountVoucher();
|
||||
|
||||
$this->assertSame('discount_vouchers', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["code", "discount_type", "description", "discount_value", "max_uses", "times_used", "valid_from", "valid_until", "is_active", "created_at", "updated_at", "school_year", "semester"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(DiscountVoucher::class, new DiscountVoucher());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\EarlyDismissalSignature;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class EarlyDismissalSignatureTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new EarlyDismissalSignature();
|
||||
|
||||
$this->assertSame('early_dismissal_signatures', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["report_date", "school_year", "semester", "filename", "original_name", "mime_type", "file_size", "uploaded_by", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(EarlyDismissalSignature::class, new EarlyDismissalSignature());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Models\EmailTemplate;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class EmailTemplateTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_get_template_returns_exact_variant_when_active(): void
|
||||
{
|
||||
EmailTemplate::query()->create([
|
||||
'code' => 'attendance_absent',
|
||||
'variant' => 'default',
|
||||
'subject' => 'Default Subject',
|
||||
'body_html' => '<p>Default</p>',
|
||||
'is_active' => true,
|
||||
'updated_at' => now('UTC'),
|
||||
]);
|
||||
|
||||
EmailTemplate::query()->create([
|
||||
'code' => 'attendance_absent',
|
||||
'variant' => 'answered',
|
||||
'subject' => 'Parent Subject',
|
||||
'body_html' => '<p>Parent</p>',
|
||||
'is_active' => true,
|
||||
'updated_at' => now('UTC'),
|
||||
]);
|
||||
|
||||
$tpl = EmailTemplate::getTemplate('attendance_absent', 'answered');
|
||||
|
||||
$this->assertNotNull($tpl);
|
||||
$this->assertSame('answered', $tpl->variant);
|
||||
$this->assertSame('Parent Subject', $tpl->subject);
|
||||
}
|
||||
|
||||
public function test_get_template_falls_back_to_default_variant(): void
|
||||
{
|
||||
EmailTemplate::query()->create([
|
||||
'code' => 'attendance_late',
|
||||
'variant' => 'default',
|
||||
'subject' => 'Late Default',
|
||||
'body_html' => '<p>Late default</p>',
|
||||
'is_active' => true,
|
||||
'updated_at' => now('UTC'),
|
||||
]);
|
||||
|
||||
$tpl = EmailTemplate::getTemplate('attendance_late', 'answered'); // missing
|
||||
|
||||
$this->assertNotNull($tpl);
|
||||
$this->assertSame('default', $tpl->variant);
|
||||
$this->assertSame('Late Default', $tpl->subject);
|
||||
}
|
||||
|
||||
public function test_get_template_ignores_inactive_templates_and_can_return_null(): void
|
||||
{
|
||||
EmailTemplate::query()->create([
|
||||
'code' => 'attendance_present',
|
||||
'variant' => 'default',
|
||||
'subject' => 'Present Default',
|
||||
'body_html' => '<p>Present</p>',
|
||||
'is_active' => false, // inactive
|
||||
'updated_at' => now('UTC'),
|
||||
]);
|
||||
|
||||
$tpl = EmailTemplate::getTemplate('attendance_present', 'default');
|
||||
|
||||
$this->assertNull($tpl);
|
||||
}
|
||||
|
||||
public function test_get_template_prefers_exact_variant_over_default(): void
|
||||
{
|
||||
EmailTemplate::query()->create([
|
||||
'code' => 'attendance_notice',
|
||||
'variant' => 'default',
|
||||
'subject' => 'Default Notice',
|
||||
'body_html' => '<p>Default</p>',
|
||||
'is_active' => true,
|
||||
'updated_at' => now('UTC'),
|
||||
]);
|
||||
|
||||
EmailTemplate::query()->create([
|
||||
'code' => 'attendance_notice',
|
||||
'variant' => 'no_answer',
|
||||
'subject' => 'Short Notice',
|
||||
'body_html' => '<p>Short</p>',
|
||||
'is_active' => true,
|
||||
'updated_at' => now('UTC'),
|
||||
]);
|
||||
|
||||
$tpl = EmailTemplate::getTemplate('attendance_notice', 'no_answer');
|
||||
|
||||
$this->assertNotNull($tpl);
|
||||
$this->assertSame('no_answer', $tpl->variant);
|
||||
$this->assertSame('Short Notice', $tpl->subject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\EmergencyContact;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class EmergencyContactTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new EmergencyContact();
|
||||
|
||||
$this->assertSame('emergency_contacts', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["emergency_contact_name", "parent_id", "cellphone", "email", "relation", "semester", "school_year", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(EmergencyContact::class, new EmergencyContact());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Enrollment;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class EnrollmentTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Enrollment();
|
||||
|
||||
$this->assertSame('enrollments', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["student_id", "class_section_id", "parent_id", "enrollment_date", "enrollment_status", "withdrawal_date", "is_withdrawn", "admission_status", "semester", "school_year", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Enrollment::class, new Enrollment());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\EventCharges;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class EventChargesTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new EventCharges();
|
||||
|
||||
$this->assertSame('event_charges', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["event_id", "parent_id", "student_id", "participation", "charged", "semester", "school_year", "updated_by", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(EventCharges::class, new EventCharges());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Event;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class EventTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Event();
|
||||
|
||||
$this->assertSame('events', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["event_name", "event_category", "description", "amount", "flyer", "expiration_date", "semester", "school_year", "created_by", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Event::class, new Event());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\ExamDraft;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ExamDraftTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new ExamDraft();
|
||||
|
||||
$this->assertSame('exam_drafts', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["teacher_id", "class_section_id", "semester", "school_year", "exam_type", "draft_title", "description", "teacher_file", "teacher_filename", "status", "admin_id", "admin_comments", "reviewed_at", "final_file", "final_filename", "version", "previous_draft_id", "is_legacy", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(ExamDraft::class, new ExamDraft());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Exam;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ExamTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Exam();
|
||||
|
||||
$this->assertSame('exams', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["student_id", "student_school_id", "class_section_id", "exam_name", "created_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Exam::class, new Exam());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Expense;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ExpenseTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Expense();
|
||||
|
||||
$this->assertSame('expenses', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["category", "amount", "receipt_path", "description", "retailor", "purchased_by", "date_of_purchase", "added_by", "created_at", "updated_at", "school_year", "semester", "status", "status_reason", "updated_by", "approved_by", "reimbursement_id"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Expense::class, new Expense());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\FamilyCommPref;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class FamilyCommPrefTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new FamilyCommPref();
|
||||
|
||||
$this->assertSame('family_comm_prefs', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["family_id", "category", "via_email", "via_sms", "cc_all_guardians", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(FamilyCommPref::class, new FamilyCommPref());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\FamilyGuardian;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class FamilyGuardianTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new FamilyGuardian();
|
||||
|
||||
$this->assertSame('family_guardians', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["family_id", "user_id", "relation", "is_primary", "receive_emails", "receive_sms", "custody_notes", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(FamilyGuardian::class, new FamilyGuardian());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\FamilyStudent;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class FamilyStudentTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new FamilyStudent();
|
||||
|
||||
$this->assertSame('family_students', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["family_id", "student_id", "is_primary_home", "notes", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(FamilyStudent::class, new FamilyStudent());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Family;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class FamilyTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Family();
|
||||
|
||||
$this->assertSame('families', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["family_code", "household_name", "address_line1", "address_line2", "city", "state", "postal_code", "country", "primary_phone", "preferred_lang", "preferred_contact_method", "is_active", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Family::class, new Family());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\FinalExam;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class FinalExamTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new FinalExam();
|
||||
|
||||
$this->assertSame('final_exam', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["student_id", "school_id", "class_section_id", "updated_by", "score", "semester", "school_year", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(FinalExam::class, new FinalExam());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\FinalScore;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class FinalScoreTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new FinalScore();
|
||||
|
||||
$this->assertSame('final_score', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["student_id", "school_id", "class_section_id", "updated_by", "score", "score_letter", "comment", "school_year", "created_at", "updated_at", "semester"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(FinalScore::class, new FinalScore());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Flag;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class FlagTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Flag();
|
||||
|
||||
$this->assertSame('flag', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["student_id", "student_name", "grade", "flag", "flag_datetime", "flag_state", "updated_by_open", "open_description", "updated_by_closed", "close_description", "action_taken", "updated_by_canceled", "cancel_description", "semester", "school_year", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Flag::class, new Flag());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\GradingLock;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class GradingLockTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new GradingLock();
|
||||
|
||||
$this->assertSame('grading_locks', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["class_section_id", "semester", "school_year", "is_locked", "locked_by", "locked_at", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(GradingLock::class, new GradingLock());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Homework;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class HomeworkTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Homework();
|
||||
|
||||
$this->assertSame('homework', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["student_id", "school_id", "class_section_id", "updated_by", "homework_index", "score", "comment", "semester", "school_year", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Homework::class, new Homework());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\InventoryCategory;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class InventoryCategoryTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new InventoryCategory();
|
||||
|
||||
$this->assertSame('inventory_categories', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["type", "name", "description", "grade_min", "grade_max", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(InventoryCategory::class, new InventoryCategory());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\InventoryItem;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class InventoryItemTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new InventoryItem();
|
||||
|
||||
$this->assertSame('inventory_items', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["type", "category_id", "name", "description", "quantity", "good_qty", "needs_repair_qty", "need_replace_qty", "cannot_find_qty", "unit", "condition", "isbn", "edition", "sku", "notes", "semester", "school_year", "updated_by", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(InventoryItem::class, new InventoryItem());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\InventoryMovement;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class InventoryMovementTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new InventoryMovement();
|
||||
|
||||
$this->assertSame('inventory_movements', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["item_id", "qty_change", "movement_type", "reason", "note", "semester", "school_year", "performed_by", "teacher_id", "student_id", "class_section_id", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(InventoryMovement::class, new InventoryMovement());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\InvoiceEvent;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class InvoiceEventTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new InvoiceEvent();
|
||||
|
||||
$this->assertSame('invoice_event', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["invoice_id", "event_name", "description", "amount", "semester", "school_year", "updated_by", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(InvoiceEvent::class, new InvoiceEvent());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\InvoiceStudentList;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class InvoiceStudentListTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new InvoiceStudentList();
|
||||
|
||||
$this->assertSame('invoice_students_list', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["invoice_id", "student_id", "student_firstname", "student_lastname", "school_id", "enrolled", "school_year", "created_at", "updated_at", "semester"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(InvoiceStudentList::class, new InvoiceStudentList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Invoice;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class InvoiceTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Invoice();
|
||||
|
||||
$this->assertSame('invoices', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["parent_id", "invoice_number", "total_amount", "balance", "paid_amount", "has_discount", "issue_date", "due_date", "status", "description", "school_year", "created_at", "updated_at", "updated_by", "semester"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Invoice::class, new Invoice());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\IpAttempt;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class IpAttemptTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new IpAttempt();
|
||||
|
||||
$this->assertSame('ip_attempts', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["ip_address", "attempts", "last_attempt_at", "blocked_until", "created_at", "updated_at", "school_year", "semester"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(IpAttempt::class, new IpAttempt());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\LateSlipLog;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class LateSlipLogTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new LateSlipLog();
|
||||
|
||||
$this->assertSame('late_slip_logs', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["school_year", "semester", "student_name", "slip_date", "time_in", "grade", "reason", "admin_name", "printed_by", "printed_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(LateSlipLog::class, new LateSlipLog());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\LoginActivity;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class LoginActivityTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new LoginActivity();
|
||||
|
||||
$this->assertSame('login_activity', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["user_id", "email", "login_time", "logout_time", "ip_address", "user_agent", "created_at", "updated_at", "semester", "school_year"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(LoginActivity::class, new LoginActivity());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\ManualPayment;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ManualPaymentTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new ManualPayment();
|
||||
|
||||
$this->assertSame('manual_payments', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["invoice_number", "amount", "payment_method", "reference", "discount_number", "proof_path", "created_at", "school_year", "semester"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(ManualPayment::class, new ManualPayment());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Message;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class MessageTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Message();
|
||||
|
||||
$this->assertSame('messages', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["sender_id", "recipient_id", "subject", "message", "sent_datetime", "read_status", "read_datetime", "message_number", "priority", "attachment", "status", "semester", "school_year"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Message::class, new Message());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\MidtermExam;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class MidtermExamTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new MidtermExam();
|
||||
|
||||
$this->assertSame('midterm_exam', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["student_id", "school_id", "class_section_id", "updated_by", "score", "comment", "semester", "school_year", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(MidtermExam::class, new MidtermExam());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\MissingScoreOverride;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class MissingScoreOverrideTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new MissingScoreOverride();
|
||||
|
||||
$this->assertSame('missing_score_overrides', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["student_id", "class_section_id", "semester", "school_year", "item_type", "item_index", "is_allowed", "updated_by", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(MissingScoreOverride::class, new MissingScoreOverride());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\NavItem;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class NavItemTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new NavItem();
|
||||
|
||||
$this->assertSame('nav_items', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["menu_parent_id", "label", "url", "icon_class", "target", "sort_order", "is_enabled", "created_at", "updated_at", "deleted_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(NavItem::class, new NavItem());
|
||||
$this->assertContains(SoftDeletes::class, class_uses_recursive(NavItem::class));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Notification;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class NotificationTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Notification();
|
||||
|
||||
$this->assertSame('notifications', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["title", "message", "target_group", "delivery_channels", "priority", "status", "action_url", "attachment_path", "scheduled_at", "sent_at", "expires_at", "created_at", "updated_at", "deleted_at", "school_year", "semester"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Notification::class, new Notification());
|
||||
$this->assertContains(SoftDeletes::class, class_uses_recursive(Notification::class));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\ParentAttendanceReport;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ParentAttendanceReportTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new ParentAttendanceReport();
|
||||
|
||||
$this->assertSame('parent_attendance_reports', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["parent_id", "student_id", "class_section_id", "report_date", "type", "arrival_time", "dismiss_time", "reason", "semester", "school_year", "status", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(ParentAttendanceReport::class, new ParentAttendanceReport());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\ParentMeetingSchedule;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ParentMeetingScheduleTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new ParentMeetingSchedule();
|
||||
|
||||
$this->assertSame('parent_meeting_schedules', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["student_id", "parent_user_id", "parent_name", "student_name", "class_section_name", "date", "time", "notes", "semester", "school_year", "status", "created_by", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(ParentMeetingSchedule::class, new ParentMeetingSchedule());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\ParentNotification;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ParentNotificationTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new ParentNotification();
|
||||
|
||||
$this->assertSame('parent_notifications', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["student_id", "code", "incident_date", "channel", "to_address", "subject", "status", "response", "semester", "school_year", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(ParentNotification::class, new ParentNotification());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\ParentModel;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ParentTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new ParentModel();
|
||||
|
||||
$this->assertSame('parents', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["secondparent_firstname", "secondparent_lastname", "secondparent_gender", "secondparent_email", "secondparent_phone", "firstparent_id", "secondparent_id", "semester", "school_year", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(ParentModel::class, new ParentModel());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Participation;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ParticipationTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Participation();
|
||||
|
||||
$this->assertSame('participation', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["student_id", "school_id", "class_section_id", "updated_by", "score", "comment", "semester", "school_year", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Participation::class, new Participation());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\PasswordResetRequest;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PasswordResetRequestTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new PasswordResetRequest();
|
||||
|
||||
$this->assertSame('password_reset_requests', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["ip_address", "requested_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(PasswordResetRequest::class, new PasswordResetRequest());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\PasswordReset;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PasswordResetTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new PasswordReset();
|
||||
|
||||
$this->assertSame('password_resets', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["email", "token", "created_at", "expires_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(PasswordReset::class, new PasswordReset());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\PayPalPayment;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PayPalPaymentTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new PayPalPayment();
|
||||
|
||||
$this->assertSame('paypal_payments', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["webhook_id", "parent_school_id", "order_id", "transaction_id", "status", "amount", "currency", "paypal_fee", "net_amount", "payer_email", "merchant_id", "event_type", "summary", "raw_payload", "synced", "sync_attempts", "created_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(PayPalPayment::class, new PayPalPayment());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\PaymentError;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PaymentErrorTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new PaymentError();
|
||||
|
||||
$this->assertSame('payment_error', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["payment_id", "invoice_id", "parent_id", "wrong_paid_amount", "wrong_payment_method", "wrong_check_file", "error_note", "logged_at", "logged_by", "school_year", "semester"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(PaymentError::class, new PaymentError());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\PaymentNotificationLog;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PaymentNotificationLogTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new PaymentNotificationLog();
|
||||
|
||||
$this->assertSame('payment_notification_logs', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["parent_id", "invoice_id", "school_year", "period_year", "period_month", "type", "to_email", "cc_email", "head_fa_notified", "subject", "body", "status", "error_message", "balance_snapshot", "created_at", "sent_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(PaymentNotificationLog::class, new PaymentNotificationLog());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Payment;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PaymentTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Payment();
|
||||
|
||||
$this->assertSame('payments', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["parent_id", "invoice_id", "total_amount", "paid_amount", "balance", "number_of_installments", "transaction_id", "check_file", "check_number", "payment_method", "payment_date", "semester", "school_year", "status", "updated_by", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Payment::class, new Payment());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\PaymentTransaction;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PaymentTransactionTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new PaymentTransaction();
|
||||
|
||||
$this->assertSame('payment_transactions', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["transaction_id", "payment_id", "transaction_date", "amount", "payment_method", "payment_status", "transaction_fee", "school_year", "semester"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(PaymentTransaction::class, new PaymentTransaction());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\PaypalTransaction;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PaypalTransactionTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new PaypalTransaction();
|
||||
|
||||
$this->assertSame('paypal_transactions', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["transaction_id", "payment_id", "firstname", "lastname", "event_type", "payer_email", "amount", "currency", "status", "payment_method", "transaction_fee", "raw_data", "created_at", "updated_at", "school_year", "semester"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(PaypalTransaction::class, new PaypalTransaction());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Permission;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PermissionTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Permission();
|
||||
|
||||
$this->assertSame('permissions', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["name", "description", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Permission::class, new Permission());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\PlacementBatch;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PlacementBatchTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new PlacementBatch();
|
||||
|
||||
$this->assertSame('placement_batches', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["placement_test", "school_year", "created_by", "updated_by", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(PlacementBatch::class, new PlacementBatch());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\PlacementLevel;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PlacementLevelTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new PlacementLevel();
|
||||
|
||||
$this->assertSame('placement_levels', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["student_id", "level", "school_year", "created_by", "updated_by", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(PlacementLevel::class, new PlacementLevel());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\PlacementScore;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PlacementScoreTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new PlacementScore();
|
||||
|
||||
$this->assertSame('placement_scores', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["batch_id", "student_id", "score", "created_by", "updated_by", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(PlacementScore::class, new PlacementScore());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Preferences;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PreferencesTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Preferences();
|
||||
|
||||
$this->assertSame('user_preferences', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["user_id", "notification_email", "notification_sms", "theme", "language", "style_color", "menu_color", "menu_custom_bg", "menu_custom_text", "menu_custom_mode", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Preferences::class, new Preferences());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\PrintRequest;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PrintRequestTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new PrintRequest();
|
||||
|
||||
$this->assertSame('print_requests', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["teacher_id", "admin_id", "class_id", "file_path", "page_selection", "num_copies", "required_by", "pickup_method", "status", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(PrintRequest::class, new PrintRequest());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Project;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ProjectTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Project();
|
||||
|
||||
$this->assertSame('project', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["student_id", "school_id", "class_section_id", "updated_by", "project_index", "score", "comment", "semester", "school_year", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Project::class, new Project());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\PromotionQueue;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PromotionQueueTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new PromotionQueue();
|
||||
|
||||
$this->assertSame('promotion_queue', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["student_id", "from_class_section_id", "to_class_id", "to_class_section_id", "school_year_from", "school_year_to", "status", "created_at", "updated_at", "updated_by"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(PromotionQueue::class, new PromotionQueue());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\PurchaseOrderItem;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PurchaseOrderItemTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new PurchaseOrderItem();
|
||||
|
||||
$this->assertSame('purchase_order_items', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["purchase_order_id", "supply_id", "description", "quantity", "received_qty", "unit_cost"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(PurchaseOrderItem::class, new PurchaseOrderItem());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\PurchaseOrder;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class PurchaseOrderTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new PurchaseOrder();
|
||||
|
||||
$this->assertSame('purchase_orders', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["po_number", "supplier_id", "status", "order_date", "expected_date", "subtotal", "tax", "total", "notes"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(PurchaseOrder::class, new PurchaseOrder());
|
||||
$this->assertContains(SoftDeletes::class, class_uses_recursive(PurchaseOrder::class));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Quiz;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class QuizTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Quiz();
|
||||
|
||||
$this->assertSame('quiz', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["student_id", "school_id", "class_section_id", "updated_by", "quiz_index", "score", "comment", "semester", "school_year", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Quiz::class, new Quiz());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Refund;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class RefundTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Refund();
|
||||
|
||||
$this->assertSame('refunds', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["parent_id", "school_year", "invoice_id", "refund_amount", "requested_at", "approved_at", "refunded_at", "status", "reason", "refund_paid_amount", "request", "note", "approved_by", "updated_by", "refund_method", "check_nbr", "check_file", "created_at", "updated_at", "semester"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Refund::class, new Refund());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\ReimbursementBatchAdminFile;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ReimbursementBatchAdminFileTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new ReimbursementBatchAdminFile();
|
||||
|
||||
$this->assertSame('reimbursement_batch_admin_files', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["batch_id", "admin_id", "filename", "original_filename", "uploaded_at", "uploaded_by"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(ReimbursementBatchAdminFile::class, new ReimbursementBatchAdminFile());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\ReimbursementBatchItem;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ReimbursementBatchItemTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new ReimbursementBatchItem();
|
||||
|
||||
$this->assertSame('reimbursement_batch_items', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["batch_id", "expense_id", "reimbursement_id", "admin_id", "assigned_at", "unassigned_at", "notes", "school_year", "semester"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(ReimbursementBatchItem::class, new ReimbursementBatchItem());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\ReimbursementBatch;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ReimbursementBatchTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new ReimbursementBatch();
|
||||
|
||||
$this->assertSame('reimbursement_batches', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["title", "yearly_batch_number", "status", "school_year", "semester", "created_by", "closed_by", "opened_at", "closed_at", "notes"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(ReimbursementBatch::class, new ReimbursementBatch());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Reimbursement;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ReimbursementTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Reimbursement();
|
||||
|
||||
$this->assertSame('reimbursements', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["expense_id", "amount", "reimbursed_to", "approved_by", "receipt_path", "description", "status", "added_by", "created_at", "updated_at", "school_year", "semester", "check_number", "reimbursement_method", "batch_number"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Reimbursement::class, new Reimbursement());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\RoleNavItem;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class RoleNavItemTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new RoleNavItem();
|
||||
|
||||
$this->assertSame('role_nav_items', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["role_id", "nav_item_id", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(RoleNavItem::class, new RoleNavItem());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\RolePermission;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class RolePermissionTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new RolePermission();
|
||||
|
||||
$this->assertSame('role_permissions', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["role_id", "permission_id", "can_create", "can_read", "can_update", "can_delete", "can_manage", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(RolePermission::class, new RolePermission());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Role;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class RoleTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Role();
|
||||
|
||||
$this->assertSame('roles', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["name", "slug", "description", "dashboard_route", "priority", "is_active", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Role::class, new Role());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\ScoreComment;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ScoreCommentTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new ScoreComment();
|
||||
|
||||
$this->assertSame('score_comments', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["student_id", "class_section_id", "score_type", "semester", "school_year", "comment", "comment_review", "reviewed_by", "commented_by", "created_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(ScoreComment::class, new ScoreComment());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Section;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class SectionTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Section();
|
||||
|
||||
$this->assertSame('sections', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["section_name", "description", "updated_at", "updated_by"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Section::class, new Section());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\SemesterScore;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class SemesterScoreTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new SemesterScore();
|
||||
|
||||
$this->assertSame('semester_scores', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["student_id", "school_id", "class_section_id", "updated_by", "homework_avg", "quiz_avg", "project_avg", "midterm_exam_score", "final_exam_score", "attendance_score", "participation_score", "ptap_score", "test_avg", "semester_score", "semester", "school_year", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(SemesterScore::class, new SemesterScore());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Settings;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class SettingsTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Settings();
|
||||
|
||||
$this->assertSame('settings', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["name", "timezone", "updated_by", "created_at", "updated_at"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Settings::class, new Settings());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\StaffAttendance;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class StaffAttendanceTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new StaffAttendance();
|
||||
|
||||
$this->assertSame('staff_attendance', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["user_id", "role_name", "date", "semester", "school_year", "status", "reason", "created_at", "updated_at", "created_by", "updated_by"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(StaffAttendance::class, new StaffAttendance());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Staff;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class StaffTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Staff();
|
||||
|
||||
$this->assertSame('staff', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["firstname", "lastname", "email", "phone", "role_name", "school_year", "active_role", "created_at", "updated_at", "user_id"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Staff::class, new Staff());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\Stats;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class StatsTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new Stats();
|
||||
|
||||
$this->assertSame('stats', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(true, $model->timestamps);
|
||||
$this->assertSame(["students", "teachers", "admins", "users"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(Stats::class, new Stats());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use App\Models\StudentAllergy;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class StudentAllergyTest extends TestCase
|
||||
{
|
||||
public function test_model_metadata_is_converted(): void
|
||||
{
|
||||
$model = new StudentAllergy();
|
||||
|
||||
$this->assertSame('student_allergies', $model->getTable());
|
||||
$this->assertSame('id', $model->getKeyName());
|
||||
$this->assertSame(false, $model->timestamps);
|
||||
$this->assertSame(["student_id", "allergy"], $model->getFillable());
|
||||
}
|
||||
|
||||
public function test_model_class_loads(): void
|
||||
{
|
||||
$this->assertInstanceOf(StudentAllergy::class, new StudentAllergy());
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user