Fix Laravel Pint formatting

This commit is contained in:
root
2026-06-08 23:30:22 -04:00
parent 567dc24649
commit c792b8be05
1288 changed files with 10766 additions and 9669 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ trait CreatesApiTestUsers
'status' => 'Active',
'is_verified' => 1,
'is_suspended' => 0,
'email' => $roleName . '-api-test-' . str_replace('.', '', uniqid('', true)) . '@example.test',
'email' => $roleName.'-api-test-'.str_replace('.', '', uniqid('', true)).'@example.test',
], $overrides));
$role = $roles[$roleName] ?? Role::query()->where('name', $roleName)->firstOrFail();
@@ -22,4 +22,4 @@ trait SeedsAdministratorApiConfig
['config_value' => $semester]
);
}
}
}
+9 -7
View File
@@ -18,7 +18,9 @@ trait SeedsE2ETestFixtures
use CreatesApiTestUsers;
protected const E2E_SCHOOL_YEAR = '2025-2026';
protected const E2E_PREV_SCHOOL_YEAR = '2024-2025';
protected const E2E_SEMESTER = 'Fall';
protected function seedE2EConfiguration(): void
@@ -108,18 +110,18 @@ trait SeedsE2ETestFixtures
$teacher = $this->createApiUserWithRole('teacher', [
'firstname' => 'Tara',
'lastname' => 'Teacher',
'email' => 'e2e.teacher.' . uniqid('', true) . '@example.test',
'email' => 'e2e.teacher.'.uniqid('', true).'@example.test',
]);
$this->seedTeacherClassAssignment($teacher->id, $classSectionId);
$parent = $this->createApiUserWithRole('parent', [
'firstname' => 'Parent',
'lastname' => 'Fixture',
'email' => 'e2e.parent.' . uniqid('', true) . '@example.test',
'email' => 'e2e.parent.'.uniqid('', true).'@example.test',
]);
$studentId = DB::table('students')->insertGetId([
'school_id' => 'S-E2E-' . random_int(1000, 9999),
'school_id' => 'S-E2E-'.random_int(1000, 9999),
'firstname' => 'Kai',
'lastname' => 'Student',
'dob' => '2014-09-01',
@@ -221,7 +223,7 @@ trait SeedsE2ETestFixtures
protected function postEnrollmentStatuses(array $studentStatusMap): TestResponse
{
return $this->post(
'/api/v1/administrator/enrollment-withdrawal/update-statuses?' .
'/api/v1/administrator/enrollment-withdrawal/update-statuses?'.
http_build_query(['enrollment_status' => $studentStatusMap]),
[]
);
@@ -231,7 +233,7 @@ trait SeedsE2ETestFixtures
{
return DB::table('invoices')->insertGetId(array_merge([
'parent_id' => $parentId,
'invoice_number' => 'INV-E2E-' . random_int(1000, 9999),
'invoice_number' => 'INV-E2E-'.random_int(1000, 9999),
'total_amount' => 500.00,
'balance' => 500.00,
'paid_amount' => 0,
@@ -250,7 +252,7 @@ trait SeedsE2ETestFixtures
{
return DB::table('invoices')->insertGetId([
'parent_id' => $parentId,
'invoice_number' => 'INV-PRIOR-' . random_int(1000, 9999),
'invoice_number' => 'INV-PRIOR-'.random_int(1000, 9999),
'total_amount' => 200.00,
'balance' => 150.00,
'paid_amount' => 50.00,
@@ -268,7 +270,7 @@ trait SeedsE2ETestFixtures
protected function seedDiscountVoucher(): int
{
return DB::table('discount_vouchers')->insertGetId([
'code' => 'E2E10-' . random_int(100, 999),
'code' => 'E2E10-'.random_int(100, 999),
'discount_type' => 'fixed',
'discount_value' => 50,
'max_uses' => 100,
@@ -13,7 +13,6 @@ class ApiAuthenticationAndAuthorizationTest extends TestCase
use CreatesApiTestUsers;
use RefreshDatabase;
public function test_api_login_returns_token_and_user_object(): void
{
$user = $this->createApiUserWithRole('teacher', [
@@ -103,7 +102,7 @@ class ApiAuthenticationAndAuthorizationTest extends TestCase
foreach ($this->sampleProtectedRoutes() as $route) {
$method = $this->primaryMethod($route);
$uri = '/' . $this->uriWithPlaceholders($route->uri());
$uri = '/'.$this->uriWithPlaceholders($route->uri());
$response = $this->json($method, $uri);
$status = $response->getStatusCode();
@@ -113,7 +112,7 @@ class ApiAuthenticationAndAuthorizationTest extends TestCase
}
}
$this->assertSame([], $failures, "Anonymous requests reached unexpected responses:\n" . implode("\n", $failures));
$this->assertSame([], $failures, "Anonymous requests reached unexpected responses:\n".implode("\n", $failures));
}
/**
@@ -47,7 +47,6 @@ class ApiPreferencesFeatureTest extends TestCase
->assertJsonPath('status', true);
}
public function test_non_admin_cannot_list_or_manage_another_users_preferences(): void
{
$owner = $this->createApiUserWithRole('teacher');
+1 -1
View File
@@ -36,7 +36,7 @@ class ApiPublicEndpointsTest extends TestCase
public function test_public_frontend_content_endpoints_do_not_server_error(): void
{
foreach (['/', 'facility', 'team', 'call-to-action', 'testimonial', 'not-found'] as $path) {
$uri = '/api/v1/frontend' . ($path === '/' ? '' : '/' . $path);
$uri = '/api/v1/frontend'.($path === '/' ? '' : '/'.$path);
$response = $this->getJson($uri);
$this->assertLessThan(500, $response->getStatusCode(), "$uri returned a server error");
@@ -2,8 +2,6 @@
namespace Tests\Feature\Api;
use App\Models\Permission;
use App\Models\Role;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\Concerns\CreatesApiTestUsers;
+5 -5
View File
@@ -24,11 +24,11 @@ class ApiRouteContractTest extends TestCase
[$class, $method] = explode('@', $action, 2);
if (! class_exists($class) || ! method_exists($class, $method)) {
$missing[] = implode('|', $route->methods()) . ' ' . $route->uri() . ' -> ' . $action;
$missing[] = implode('|', $route->methods()).' '.$route->uri().' -> '.$action;
}
}
$this->assertSame([], $missing, "These API routes reference missing controllers or methods:\n" . implode("\n", $missing));
$this->assertSame([], $missing, "These API routes reference missing controllers or methods:\n".implode("\n", $missing));
}
public function test_api_routes_do_not_duplicate_method_and_uri_pairs(): void
@@ -42,7 +42,7 @@ class ApiRouteContractTest extends TestCase
continue;
}
$key = $method . ' ' . $route->uri();
$key = $method.' '.$route->uri();
if (isset($seen[$key])) {
$duplicates[] = $key;
}
@@ -90,11 +90,11 @@ class ApiRouteContractTest extends TestCase
});
if (! $hasProtection) {
$unprotected[] = implode('|', $methods) . ' ' . $route->uri();
$unprotected[] = implode('|', $methods).' '.$route->uri();
}
}
$this->assertSame([], $unprotected, "Mutating API routes without an obvious auth/throttle middleware:\n" . implode("\n", $unprotected));
$this->assertSame([], $unprotected, "Mutating API routes without an obvious auth/throttle middleware:\n".implode("\n", $unprotected));
}
/**
@@ -2,7 +2,6 @@
namespace Tests\Feature\Api;
use App\Models\Role;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Hash;
@@ -121,4 +121,4 @@ class AdministratorAbsenceControllerTest extends TestCase
'dates' => ['2026-03-08'],
]);
}
}
}
@@ -128,4 +128,4 @@ class AdministratorEnrollmentControllerTest extends TestCase
'message' => 'Enrollment statuses updated and notifications sent.',
]);
}
}
}
@@ -263,6 +263,7 @@ class AdministratorEnrollmentUpdateStatusesApiTest extends TestCase
private function postUpdateStatuses(array $enrollmentStatus)
{
$query = http_build_query(['enrollment_status' => $enrollmentStatus]);
return $this->post('/api/v1/administrator/enrollment-withdrawal/update-statuses?' . $query, []);
return $this->post('/api/v1/administrator/enrollment-withdrawal/update-statuses?'.$query, []);
}
}
@@ -157,4 +157,4 @@ class AdministratorNotificationControllerTest extends TestCase
'message' => 'Print notification recipients updated.',
]);
}
}
}
@@ -2,10 +2,10 @@
namespace Tests\Feature\Api\Administrator;
use App\Http\Middleware\EnsurePrintRequestsAdminAccess;
use App\Models\User;
use App\Services\Administrator\TeacherSubmissionNotificationService;
use App\Services\Administrator\TeacherSubmissionReportService;
use App\Http\Middleware\EnsurePrintRequestsAdminAccess;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Laravel\Sanctum\Sanctum;
use Mockery;
@@ -281,7 +281,7 @@ class AdministratorTeacherSubmissionReportApiTest extends TestCase
'class_section_id' => 12,
'admin_id' => 901,
'notification_category' => 'teacher_submissions',
'message' => 'Reminder ' . $i,
'message' => 'Reminder '.$i,
'status' => 'sent',
'school_year' => '2025-2026',
'semester' => 'Fall',
@@ -80,7 +80,7 @@ class EmergencyContactControllerTest extends TestCase
]);
Sanctum::actingAs($admin, [], 'api');
$response = $this->patch('/api/v1/administrator/emergency-contacts/' . $contact->id, [
$response = $this->patch('/api/v1/administrator/emergency-contacts/'.$contact->id, [
'parent_id' => $parent->id,
'name' => 'New Name',
'cellphone' => '5555555555',
@@ -116,7 +116,7 @@ class EmergencyContactControllerTest extends TestCase
]);
Sanctum::actingAs($admin, [], 'api');
$response = $this->delete('/api/v1/administrator/emergency-contacts/' . $contact->id, [
$response = $this->delete('/api/v1/administrator/emergency-contacts/'.$contact->id, [
'parent_id' => $parent->id,
], [
'Accept' => 'application/json',
@@ -145,7 +145,7 @@ class EmergencyContactControllerTest extends TestCase
]);
Sanctum::actingAs($admin, [], 'api');
$response = $this->get('/api/v1/administrator/emergency-contacts/' . $contact->id . '?parent_id=' . $parent->id, [
$response = $this->get('/api/v1/administrator/emergency-contacts/'.$contact->id.'?parent_id='.$parent->id, [
'Accept' => 'application/json',
]);
@@ -171,7 +171,7 @@ class EmergencyContactControllerTest extends TestCase
]);
Sanctum::actingAs($admin, [], 'api');
$response = $this->patch('/api/v1/administrator/emergency-contacts/' . $contact->id, [
$response = $this->patch('/api/v1/administrator/emergency-contacts/'.$contact->id, [
'parent_id' => $otherParent->id,
'name' => 'New Name',
'cellphone' => '9999999999',
@@ -205,7 +205,7 @@ class EmergencyContactControllerTest extends TestCase
]);
Sanctum::actingAs($admin, [], 'api');
$response = $this->delete('/api/v1/administrator/emergency-contacts/' . $contact->id, [
$response = $this->delete('/api/v1/administrator/emergency-contacts/'.$contact->id, [
'parent_id' => $otherParent->id,
], [
'Accept' => 'application/json',
@@ -16,11 +16,17 @@ class AssignmentApiControllerTest extends TestCase
use RefreshDatabase;
protected User $user;
protected User $teacherMain;
protected User $teacherAssistant;
protected ClassSection $sectionA;
protected ClassSection $sectionB;
protected Student $studentOne;
protected Student $studentTwo;
protected function setUp(): void
@@ -418,4 +424,4 @@ class AssignmentApiControllerTest extends TestCase
$this->assertSame(['Main Teacher'], $mainTeachers);
}
}
}
+49 -49
View File
@@ -2,12 +2,12 @@
namespace Tests\Feature\Api;
use App\Models\User;
use App\Models\ClassSection;
use App\Models\Configuration;
use App\Models\Student;
use App\Models\StudentClass;
use App\Models\TeacherClass;
use App\Models\ClassSection;
use App\Models\Configuration;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Laravel\Sanctum\Sanctum;
use PHPUnit\Framework\Attributes\Test;
@@ -48,36 +48,36 @@ class AssignmentApiTest extends TestCase
$teacher = User::factory()->create([
'firstname' => 'Ahmad',
'lastname' => 'Ali',
'lastname' => 'Ali',
]);
TeacherClass::query()->create([
'teacher_id' => $teacher->id,
'class_section_id' => $section->class_section_id,
'position' => 'main',
'semester' => 'Fall',
'school_year' => '2025-2026',
'description' => 'Main teacher assignment',
'teacher_id' => $teacher->id,
'class_section_id' => $section->class_section_id,
'position' => 'main',
'semester' => 'Fall',
'school_year' => '2025-2026',
'description' => 'Main teacher assignment',
]);
$student = Student::factory()->create([
'firstname' => 'Sara',
'lastname' => 'Yousef',
'is_active' => 1,
'gender' => 'F',
'firstname' => 'Sara',
'lastname' => 'Yousef',
'is_active' => 1,
'gender' => 'F',
'registration_grade' => '5',
'photo_consent' => 1,
'tuition_paid' => 1,
'school_id' => 'SCH-1001',
'photo_consent' => 1,
'tuition_paid' => 1,
'school_id' => 'SCH-1001',
]);
StudentClass::query()->create([
'student_id' => $student->id,
'class_section_id' => $section->class_section_id,
'semester' => 'Fall',
'school_year' => '2025-2026',
'description' => 'Student assigned',
'is_active' => 1, // remove if your table doesnt have this column
'student_id' => $student->id,
'class_section_id' => $section->class_section_id,
'semester' => 'Fall',
'school_year' => '2025-2026',
'description' => 'Student assigned',
'is_active' => 1, // remove if your table doesnt have this column
]);
$response = $this->getJson('/api/assignments');
@@ -96,7 +96,7 @@ class AssignmentApiTest extends TestCase
'semester',
'school_year',
'description',
]
],
],
'schoolYears',
'selectedYear',
@@ -122,19 +122,19 @@ class AssignmentApiTest extends TestCase
$teacher = User::factory()->create(['firstname' => 'Test', 'lastname' => 'Teacher']);
TeacherClass::query()->create([
'teacher_id' => $teacher->id,
'teacher_id' => $teacher->id,
'class_section_id' => $section1->class_section_id,
'position' => 'main',
'semester' => 'Fall',
'school_year' => '2024-2025',
'position' => 'main',
'semester' => 'Fall',
'school_year' => '2024-2025',
]);
TeacherClass::query()->create([
'teacher_id' => $teacher->id,
'teacher_id' => $teacher->id,
'class_section_id' => $section2->class_section_id,
'position' => 'main',
'semester' => 'Fall',
'school_year' => '2025-2026',
'position' => 'main',
'semester' => 'Fall',
'school_year' => '2025-2026',
]);
$response = $this->getJson('/api/assignments?school_year=2025-2026');
@@ -158,11 +158,11 @@ class AssignmentApiTest extends TestCase
$section = ClassSection::factory()->create();
$payload = [
'student_id' => $student->id,
'student_id' => $student->id,
'class_section_id' => $section->class_section_id,
'semester' => 'Spring',
'school_year' => '2025-2026',
'description' => 'Moved after placement review',
'semester' => 'Spring',
'school_year' => '2025-2026',
'description' => 'Moved after placement review',
];
$response = $this->postJson('/api/assignments', $payload);
@@ -171,10 +171,10 @@ class AssignmentApiTest extends TestCase
->assertJsonPath('message', 'Assignment saved successfully.');
$this->assertDatabaseHas('student_class', [
'student_id' => $student->id,
'student_id' => $student->id,
'class_section_id' => $section->class_section_id,
'semester' => 'Spring',
'school_year' => '2025-2026',
'semester' => 'Spring',
'school_year' => '2025-2026',
]);
}
@@ -203,19 +203,19 @@ class AssignmentApiTest extends TestCase
// First create
$this->postJson('/api/assignments', [
'student_id' => $student->id,
'student_id' => $student->id,
'class_section_id' => $sectionA->class_section_id,
'semester' => 'Fall',
'school_year' => '2025-2026',
'semester' => 'Fall',
'school_year' => '2025-2026',
])->assertCreated();
// Second call same unique key should update (per service updateOrCreate)
$this->postJson('/api/assignments', [
'student_id' => $student->id,
'student_id' => $student->id,
'class_section_id' => $sectionA->class_section_id,
'semester' => 'Fall',
'school_year' => '2025-2026',
'description' => 'Reassigned',
'semester' => 'Fall',
'school_year' => '2025-2026',
'description' => 'Reassigned',
])->assertCreated();
$this->assertEquals(
@@ -228,10 +228,10 @@ class AssignmentApiTest extends TestCase
);
$this->assertDatabaseHas('student_class', [
'student_id' => $student->id,
'student_id' => $student->id,
'class_section_id' => $sectionA->class_section_id,
'semester' => 'Fall',
'school_year' => '2025-2026',
'semester' => 'Fall',
'school_year' => '2025-2026',
]);
}
@@ -113,7 +113,7 @@ class LateSlipLogsControllerTest extends TestCase
$user = User::query()->create([
'firstname' => 'Test',
'lastname' => 'User',
'email' => $roleName . '@example.com',
'email' => $roleName.'@example.com',
'cellphone' => '5555555555',
'address_street' => '123 Main',
'city' => 'City',
@@ -85,10 +85,10 @@ class AttendanceCommentTemplateApiTest extends TestCase
$mock->shouldReceive('create')
->once()
->with(Mockery::on(function ($data) use ($payload) {
return (int)$data['min_score'] === 80
&& (int)$data['max_score'] === 100
return (int) $data['min_score'] === 80
&& (int) $data['max_score'] === 100
&& $data['template_text'] === $payload['template_text']
&& (bool)$data['is_active'] === true;
&& (bool) $data['is_active'] === true;
}))
->andReturn([
'id' => 10,
@@ -159,7 +159,7 @@ class AttendanceCommentTemplateApiTest extends TestCase
->once()
->with(7, Mockery::on(function ($data) {
return $data['template_text'] === 'Updated comment text'
&& (bool)$data['is_active'] === false;
&& (bool) $data['is_active'] === false;
}))
->andReturn([
'id' => 7,
@@ -221,7 +221,7 @@ class AttendanceCommentTemplateApiTest extends TestCase
'max_score' => 49,
'template_text' => 'Low attendance',
'is_active' => true,
]
],
]);
$this->app->instance(AttendanceCommentTemplateService::class, $mock);
@@ -232,4 +232,4 @@ class AttendanceCommentTemplateApiTest extends TestCase
->assertJsonCount(1, 'templates')
->assertJsonPath('templates.0.id', 1);
}
}
}
@@ -4,6 +4,7 @@ namespace Tests\Feature\Api\V1\AttendanceTracking;
use App\Services\AttendanceTracking\AttendanceTrackingService;
use Mockery;
use Mockery\MockInterface;
use Tests\TestCase;
class AttendanceTrackingControllerTest extends TestCase
@@ -14,7 +15,7 @@ class AttendanceTrackingControllerTest extends TestCase
parent::tearDown();
}
protected function mockService(): \Mockery\MockInterface
protected function mockService(): MockInterface
{
$service = Mockery::mock(AttendanceTrackingService::class);
$this->app->instance(AttendanceTrackingService::class, $service);
@@ -159,7 +159,7 @@ class IpBanControllerTest extends TestCase
$user = User::query()->create([
'firstname' => 'Test',
'lastname' => 'User',
'email' => $roleName . '@example.com',
'email' => $roleName.'@example.com',
'cellphone' => '5555555555',
'address_street' => '123 Main',
'city' => 'City',
+1 -1
View File
@@ -234,4 +234,4 @@ class BadgeControllerTest extends TestCase
$this->postJson('/api/badges/log-print', ['user_ids' => [1]])->assertStatus(401);
$this->postJson('/api/badges/pdf', ['user_ids' => [1]])->assertStatus(401);
}
}
}
@@ -31,7 +31,8 @@ class BroadcastEmailControllerTest extends TestCase
{
$this->seedParentData();
$fake = new class extends EmailService {
$fake = new class extends EmailService
{
public array $sent = [];
public function send(
@@ -41,9 +42,9 @@ class BroadcastEmailControllerTest extends TestCase
string $fromKey = 'general',
array $cc = [],
array $bcc = []
): bool
{
): bool {
$this->sent[] = compact('to', 'subject', 'html', 'fromKey', 'cc', 'bcc');
return true;
}
};
@@ -92,7 +92,7 @@ class ClassProgressControllerTest extends TestCase
Sanctum::actingAs($user);
$response = $this->getJson('/api/v1/class-progress/' . $report->id);
$response = $this->getJson('/api/v1/class-progress/'.$report->id);
$response->assertOk();
$response->assertJsonPath('status', true);
@@ -110,7 +110,7 @@ class ClassProgressControllerTest extends TestCase
Sanctum::actingAs($user);
$response = $this->patchJson('/api/v1/class-progress/' . $report->id, [
$response = $this->patchJson('/api/v1/class-progress/'.$report->id, [
'status' => 'behind',
]);
@@ -132,7 +132,7 @@ class ClassProgressControllerTest extends TestCase
Sanctum::actingAs($user);
$response = $this->deleteJson('/api/v1/class-progress/' . $report->id);
$response = $this->deleteJson('/api/v1/class-progress/'.$report->id);
$response->assertOk();
$this->assertDatabaseMissing('class_progress_reports', [
@@ -152,7 +152,7 @@ class ClassProgressControllerTest extends TestCase
Sanctum::actingAs($other);
$response = $this->getJson('/api/v1/class-progress/' . $report->id);
$response = $this->getJson('/api/v1/class-progress/'.$report->id);
$response->assertStatus(403);
}
@@ -187,7 +187,7 @@ class ClassProgressControllerTest extends TestCase
Sanctum::actingAs($user);
$response = $this->get('/api/v1/class-progress/attachments/' . $attachment->id);
$response = $this->get('/api/v1/class-progress/attachments/'.$attachment->id);
$response->assertOk();
}
@@ -257,7 +257,7 @@ class ClassSectionControllerTest extends TestCase
'firstname' => 'Test',
'lastname' => 'User',
'cellphone' => '5555555555',
'email' => $roleName . '@example.com',
'email' => $roleName.'@example.com',
'address_street' => '123 Main',
'city' => 'City',
'state' => 'ST',
@@ -50,7 +50,8 @@ class CommunicationControllerTest extends TestCase
{
$this->seedCommunicationData();
$fake = new class extends EmailService {
$fake = new class extends EmailService
{
public array $sent = [];
public function send(
@@ -62,6 +63,7 @@ class CommunicationControllerTest extends TestCase
array $bcc = []
): bool {
$this->sent[] = compact('to', 'subject', 'html', 'fromKey', 'cc', 'bcc');
return true;
}
};
@@ -23,7 +23,7 @@ class FamilyAdminControllerTest extends TestCase
$this->seedFamilyGuardian($familyId, $user->id);
Sanctum::actingAs($user);
$response = $this->getJson('/api/v1/family-admin?student_id=' . $studentId);
$response = $this->getJson('/api/v1/family-admin?student_id='.$studentId);
$response->assertOk();
$response->assertJsonPath('status', true);
@@ -58,7 +58,7 @@ class FamilyAdminControllerTest extends TestCase
$this->seedPayment($user->id);
Sanctum::actingAs($user);
$response = $this->getJson('/api/v1/family-admin/card?family_id=' . $familyId);
$response = $this->getJson('/api/v1/family-admin/card?family_id='.$familyId);
$response->assertOk();
$response->assertJsonPath('status', true);
@@ -123,7 +123,7 @@ class FamilyAdminControllerTest extends TestCase
'firstname' => 'Parent',
'lastname' => 'User',
'cellphone' => '9999999999',
'email' => 'parent' . $id . '@example.com',
'email' => 'parent'.$id.'@example.com',
'address_street' => '123 Street',
'city' => 'City',
'state' => 'ST',
@@ -163,7 +163,7 @@ class FamilyAdminControllerTest extends TestCase
{
return DB::table('families')->insertGetId([
'family_code' => $code,
'household_name' => 'Family ' . $code,
'household_name' => 'Family '.$code,
'is_active' => 1,
'created_at' => now(),
'updated_at' => now(),
@@ -20,7 +20,7 @@ class FamilyControllerTest extends TestCase
$this->seedFamilyStudent($familyId, $studentId);
Sanctum::actingAs($user);
$response = $this->getJson('/api/v1/families/by-student/' . $studentId);
$response = $this->getJson('/api/v1/families/by-student/'.$studentId);
$response->assertOk();
$response->assertJsonPath('status', true);
@@ -34,7 +34,7 @@ class FamilyControllerTest extends TestCase
$this->seedFamilyGuardian($familyId, $user->id);
Sanctum::actingAs($user);
$response = $this->getJson('/api/v1/families/' . $familyId . '/guardians');
$response = $this->getJson('/api/v1/families/'.$familyId.'/guardians');
$response->assertOk();
$response->assertJsonPath('status', true);
@@ -292,7 +292,7 @@ class FamilyControllerTest extends TestCase
{
return DB::table('families')->insertGetId([
'family_code' => $code,
'household_name' => 'Family ' . $code,
'household_name' => 'Family '.$code,
'is_active' => 1,
'created_at' => now(),
'updated_at' => now(),
@@ -28,7 +28,7 @@ class EventChargeControllerTest extends TestCase
{
$charge = $this->makeCharge();
$this->getJson('/api/v1/finance/event-charges/' . $charge->id)
$this->getJson('/api/v1/finance/event-charges/'.$charge->id)
->assertStatus(401);
}
@@ -37,7 +37,7 @@ class EventChargeControllerTest extends TestCase
$this->actingAsApiAdministrator();
$charge = $this->makeCharge();
$this->getJson('/api/v1/finance/event-charges/' . $charge->id)
$this->getJson('/api/v1/finance/event-charges/'.$charge->id)
->assertOk()
->assertJsonPath('ok', true)
->assertJsonPath('event_charge.id', $charge->id)
@@ -57,7 +57,7 @@ class EventChargeControllerTest extends TestCase
$this->actingAsApiAdministrator();
$charge = $this->makeCharge();
$this->putJson('/api/v1/finance/event-charges/' . $charge->id, [
$this->putJson('/api/v1/finance/event-charges/'.$charge->id, [
'event_name' => 'Museum Visit',
'amount' => 40.50,
])
@@ -76,7 +76,7 @@ class EventChargeControllerTest extends TestCase
$this->actingAsApiAdministrator();
$charge = $this->makeCharge(['charged' => 0]);
$this->postJson('/api/v1/finance/event-charges/' . $charge->id . '/approve')
$this->postJson('/api/v1/finance/event-charges/'.$charge->id.'/approve')
->assertOk()
->assertJsonPath('ok', true);
@@ -91,7 +91,7 @@ class EventChargeControllerTest extends TestCase
$this->actingAsApiAdministrator();
$charge = $this->makeCharge(['charged' => 1]);
$this->postJson('/api/v1/finance/event-charges/' . $charge->id . '/void')
$this->postJson('/api/v1/finance/event-charges/'.$charge->id.'/void')
->assertOk()
->assertJsonPath('ok', true);
@@ -106,7 +106,7 @@ class EventChargeControllerTest extends TestCase
$this->actingAsApiAdministrator();
$charge = $this->makeCharge(['charged' => 1]);
$this->deleteJson('/api/v1/finance/event-charges/' . $charge->id)
$this->deleteJson('/api/v1/finance/event-charges/'.$charge->id)
->assertOk()
->assertJsonPath('ok', true);
@@ -49,7 +49,7 @@ class FrontendControllerTest extends TestCase
$user = User::query()->create([
'firstname' => 'Test',
'lastname' => 'User',
'email' => $roleName . '@example.com',
'email' => $roleName.'@example.com',
'cellphone' => '5555555555',
'address_street' => '123 Main',
'city' => 'City',
@@ -4,7 +4,6 @@ namespace Tests\Feature\Api\V1\Frontend;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Laravel\Sanctum\Sanctum;
use Tests\TestCase;
@@ -57,7 +57,7 @@ class LandingPageControllerTest extends TestCase
$user = User::query()->create([
'firstname' => 'Test',
'lastname' => 'User',
'email' => $roleName . '@example.com',
'email' => $roleName.'@example.com',
'cellphone' => '5555555555',
'address_street' => '123 Main',
'city' => 'City',
@@ -15,7 +15,7 @@ class PageControllerTest extends TestCase
{
$dir = public_path('html');
File::ensureDirectoryExists($dir);
File::put($dir . '/privacy_policy.html', '<h1>Privacy</h1>');
File::put($dir.'/privacy_policy.html', '<h1>Privacy</h1>');
$response = $this->getJson('/api/v1/pages/privacy');
@@ -28,7 +28,7 @@ class PageControllerTest extends TestCase
{
$dir = public_path('html');
File::ensureDirectoryExists($dir);
File::delete($dir . '/help_center.html');
File::delete($dir.'/help_center.html');
$response = $this->getJson('/api/v1/pages/help');
@@ -112,7 +112,7 @@ class IncidentControllerTest extends TestCase
$storeResponse->assertJson(['ok' => true, 'created' => true]);
$currentId = $storeResponse->json('incident_id');
$closeResponse = $this->postJson('/api/v1/incidents/' . $currentId . '/close', [
$closeResponse = $this->postJson('/api/v1/incidents/'.$currentId.'/close', [
'state_description' => 'Resolved',
'action_taken' => 'Spoke with student',
]);
@@ -45,7 +45,7 @@ class InventoryCategoriesControllerTest extends TestCase
$categoryId = $this->seedCategory('office');
Sanctum::actingAs($user);
$response = $this->patchJson('/api/v1/inventory/categories/' . $categoryId, [
$response = $this->patchJson('/api/v1/inventory/categories/'.$categoryId, [
'name' => 'Updated',
]);
@@ -59,7 +59,7 @@ class InventoryCategoriesControllerTest extends TestCase
$categoryId = $this->seedCategory('office');
Sanctum::actingAs($user);
$response = $this->deleteJson('/api/v1/inventory/categories/' . $categoryId);
$response = $this->deleteJson('/api/v1/inventory/categories/'.$categoryId);
$response->assertOk();
$this->assertDatabaseMissing('inventory_categories', ['id' => $categoryId]);
@@ -101,7 +101,7 @@ class InventoryCategoriesControllerTest extends TestCase
{
return DB::table('inventory_categories')->insertGetId([
'type' => $type,
'name' => ucfirst($type) . ' Category',
'name' => ucfirst($type).' Category',
'created_at' => now(),
'updated_at' => now(),
]);
@@ -35,7 +35,7 @@ class InventoryItemsControllerTest extends TestCase
$itemId = $this->seedInventoryItem($categoryId);
Sanctum::actingAs($user);
$response = $this->getJson('/api/v1/inventory/items/' . $itemId);
$response = $this->getJson('/api/v1/inventory/items/'.$itemId);
$response->assertOk();
$response->assertJsonPath('status', true);
@@ -70,7 +70,7 @@ class InventoryItemsControllerTest extends TestCase
$itemId = $this->seedInventoryItem($categoryId);
Sanctum::actingAs($user);
$response = $this->patchJson('/api/v1/inventory/items/' . $itemId, [
$response = $this->patchJson('/api/v1/inventory/items/'.$itemId, [
'name' => 'Updated Item',
]);
@@ -86,7 +86,7 @@ class InventoryItemsControllerTest extends TestCase
$itemId = $this->seedInventoryItem($categoryId);
Sanctum::actingAs($user);
$response = $this->deleteJson('/api/v1/inventory/items/' . $itemId);
$response = $this->deleteJson('/api/v1/inventory/items/'.$itemId);
$response->assertOk();
$this->assertDatabaseMissing('inventory_items', ['id' => $itemId]);
@@ -100,7 +100,7 @@ class InventoryItemsControllerTest extends TestCase
$itemId = $this->seedInventoryItem($categoryId);
Sanctum::actingAs($user);
$response = $this->postJson('/api/v1/inventory/items/' . $itemId . '/audit', [
$response = $this->postJson('/api/v1/inventory/items/'.$itemId.'/audit', [
'needs_repair_qty' => 1,
'need_replace_qty' => 1,
'cannot_find_qty' => 0,
@@ -118,7 +118,7 @@ class InventoryItemsControllerTest extends TestCase
$itemId = $this->seedInventoryItem($categoryId, 0);
Sanctum::actingAs($user);
$response = $this->postJson('/api/v1/inventory/items/' . $itemId . '/adjust', [
$response = $this->postJson('/api/v1/inventory/items/'.$itemId.'/adjust', [
'mode' => 'in',
'quantity' => 2,
'reason' => 'Restock',
@@ -170,7 +170,7 @@ class InventoryItemsControllerTest extends TestCase
$bookId = $this->seedInventoryItem($categoryId, 5, 'book');
Sanctum::actingAs($user);
$formResponse = $this->getJson('/api/v1/inventory/teacher-distribution?class_section_id=' . $classSectionId . '&item_id=' . $bookId);
$formResponse = $this->getJson('/api/v1/inventory/teacher-distribution?class_section_id='.$classSectionId.'&item_id='.$bookId);
$formResponse->assertOk();
$storeResponse = $this->postJson('/api/v1/inventory/teacher-distribution', [
@@ -233,7 +233,7 @@ class InventoryItemsControllerTest extends TestCase
{
return DB::table('inventory_categories')->insertGetId([
'type' => $type,
'name' => ucfirst($type) . ' Category',
'name' => ucfirst($type).' Category',
'created_at' => now(),
'updated_at' => now(),
]);
@@ -244,7 +244,7 @@ class InventoryItemsControllerTest extends TestCase
return DB::table('inventory_items')->insertGetId([
'type' => $type,
'category_id' => $categoryId,
'name' => 'Item ' . $type,
'name' => 'Item '.$type,
'quantity' => $quantity,
'semester' => 'Fall',
'school_year' => '2025-2026',
@@ -49,7 +49,7 @@ class InventoryMovementsControllerTest extends TestCase
$movementId = $this->seedMovement($itemId);
Sanctum::actingAs($user);
$response = $this->patchJson('/api/v1/inventory/movements/' . $movementId, [
$response = $this->patchJson('/api/v1/inventory/movements/'.$movementId, [
'qty_change' => 3,
'movement_type' => 'in',
]);
@@ -65,7 +65,7 @@ class InventoryMovementsControllerTest extends TestCase
$movementId = $this->seedMovement($itemId);
Sanctum::actingAs($user);
$response = $this->deleteJson('/api/v1/inventory/movements/' . $movementId);
$response = $this->deleteJson('/api/v1/inventory/movements/'.$movementId);
$response->assertOk();
$this->assertDatabaseMissing('inventory_movements', ['id' => $movementId]);
@@ -45,7 +45,7 @@ class SuppliersControllerTest extends TestCase
$supplierId = $this->seedSupplier('Supplier C');
Sanctum::actingAs($user);
$response = $this->patchJson('/api/v1/inventory/suppliers/' . $supplierId, [
$response = $this->patchJson('/api/v1/inventory/suppliers/'.$supplierId, [
'name' => 'Supplier Updated',
]);
@@ -59,7 +59,7 @@ class SuppliersControllerTest extends TestCase
$supplierId = $this->seedSupplier('Supplier D');
Sanctum::actingAs($user);
$response = $this->deleteJson('/api/v1/inventory/suppliers/' . $supplierId);
$response = $this->deleteJson('/api/v1/inventory/suppliers/'.$supplierId);
$response->assertOk();
$this->assertDatabaseMissing('suppliers', ['id' => $supplierId]);
@@ -44,7 +44,7 @@ class SupplyCategoriesControllerTest extends TestCase
$categoryId = $this->seedCategory('Pens');
Sanctum::actingAs($user);
$response = $this->patchJson('/api/v1/inventory/supply-categories/' . $categoryId, [
$response = $this->patchJson('/api/v1/inventory/supply-categories/'.$categoryId, [
'name' => 'Pens Updated',
]);
@@ -58,7 +58,7 @@ class SupplyCategoriesControllerTest extends TestCase
$categoryId = $this->seedCategory('Markers');
Sanctum::actingAs($user);
$response = $this->deleteJson('/api/v1/inventory/supply-categories/' . $categoryId);
$response = $this->deleteJson('/api/v1/inventory/supply-categories/'.$categoryId);
$response->assertOk();
$this->assertDatabaseMissing('supply_categories', ['id' => $categoryId]);
@@ -68,7 +68,7 @@ class MessagesControllerTest extends TestCase
Sanctum::actingAs($recipient);
$response = $this->getJson('/api/v1/messages/' . $message->id);
$response = $this->getJson('/api/v1/messages/'.$message->id);
$response->assertOk();
$this->assertDatabaseHas('messages', [
@@ -98,7 +98,7 @@ class MessagesControllerTest extends TestCase
Sanctum::actingAs($sender);
$response = $this->patchJson('/api/v1/messages/' . $message->id, [
$response = $this->patchJson('/api/v1/messages/'.$message->id, [
'status' => 'trashed',
]);
@@ -130,7 +130,7 @@ class MessagesControllerTest extends TestCase
Sanctum::actingAs($sender);
$response = $this->deleteJson('/api/v1/messages/' . $message->id);
$response = $this->deleteJson('/api/v1/messages/'.$message->id);
$response->assertOk();
$this->assertDatabaseHas('messages', [
@@ -197,7 +197,7 @@ class MessagesControllerTest extends TestCase
Sanctum::actingAs($other);
$response = $this->getJson('/api/v1/messages/' . $message->id);
$response = $this->getJson('/api/v1/messages/'.$message->id);
$response->assertForbidden();
}
@@ -18,7 +18,7 @@ class AuthorizedUsersControllerTest extends TestCase
'user_id' => $parentId,
'firstname' => 'Aunt',
'lastname' => 'Carer',
'email' => 'carer-' . uniqid() . '@example.test',
'email' => 'carer-'.uniqid().'@example.test',
'phone_number' => '5551112222',
'relation_to_user' => 'Aunt',
'status' => 'pending',
@@ -74,7 +74,7 @@ class AuthorizedUsersControllerTest extends TestCase
$foreign = $this->makeAuthorizedUser($otherParent->id);
$this->actingAs($parent, 'api')
->getJson('/api/v1/parents/authorized-users/' . $foreign->id)
->getJson('/api/v1/parents/authorized-users/'.$foreign->id)
->assertNotFound();
}
@@ -84,7 +84,7 @@ class AuthorizedUsersControllerTest extends TestCase
$record = $this->makeAuthorizedUser($parent->id);
$this->actingAs($parent, 'api')
->deleteJson('/api/v1/parents/authorized-users/' . $record->id)
->deleteJson('/api/v1/parents/authorized-users/'.$record->id)
->assertOk()
->assertJsonPath('status', true);
@@ -98,7 +98,7 @@ class AuthorizedUsersControllerTest extends TestCase
$foreign = $this->makeAuthorizedUser($otherParent->id);
$this->actingAs($parent, 'api')
->deleteJson('/api/v1/parents/authorized-users/' . $foreign->id)
->deleteJson('/api/v1/parents/authorized-users/'.$foreign->id)
->assertNotFound();
$this->assertDatabaseHas('authorized_users', ['id' => $foreign->id]);
@@ -106,7 +106,7 @@ class ParentAttendanceReportControllerTest extends TestCase
]);
Sanctum::actingAs($parent);
$response = $this->patchJson('/api/v1/parents/attendance-reports/' . $reportId, [
$response = $this->patchJson('/api/v1/parents/attendance-reports/'.$reportId, [
'reason' => 'Family emergency',
]);
@@ -193,6 +193,7 @@ class ParentAttendanceReportControllerTest extends TestCase
if ((int) $dt->format('w') !== 0) {
$dt->modify('next sunday');
}
return $dt->format('Y-m-d');
}
}
@@ -208,7 +208,7 @@ class PrintRequestsWorkflowTest extends TestCase
'status' => 'Active',
'is_verified' => 1,
'is_suspended' => 0,
'email' => $roleName . '-print-request-' . str_replace('.', '', uniqid('', true)) . '@example.test',
'email' => $roleName.'-print-request-'.str_replace('.', '', uniqid('', true)).'@example.test',
]);
$user->roles()->syncWithoutDetaching([$role->id]);
@@ -230,7 +230,7 @@ class PrintRequestsWorkflowTest extends TestCase
}
/**
* @param array<string, mixed> $overrides
* @param array<string, mixed> $overrides
*/
private function seedPrintRequest(User $teacher, array $overrides = []): PrintRequest
{
@@ -37,12 +37,12 @@ class ParentPromotionControllerTest extends TestCase
Sanctum::actingAs($parent);
// Start enrollment
$start = $this->postJson('/api/v1/parents/promotions/' . $promotionId . '/start');
$start = $this->postJson('/api/v1/parents/promotions/'.$promotionId.'/start');
$start->assertOk();
$start->assertJsonPath('data.promotion_status', StudentPromotionRecord::STATUS_ENROLLMENT_STARTED);
// Complete the checklist incrementally
$update = $this->patchJson('/api/v1/parents/promotions/' . $promotionId . '/steps', [
$update = $this->patchJson('/api/v1/parents/promotions/'.$promotionId.'/steps', [
'info_confirmed' => true,
'documents_uploaded' => true,
'agreement_accepted' => true,
@@ -51,7 +51,7 @@ class ParentPromotionControllerTest extends TestCase
$update->assertJsonPath('data.promotion_status', StudentPromotionRecord::STATUS_ENROLLMENT_STARTED);
// Final step finalises promotion
$finish = $this->patchJson('/api/v1/parents/promotions/' . $promotionId . '/steps', [
$finish = $this->patchJson('/api/v1/parents/promotions/'.$promotionId.'/steps', [
'payment_completed' => true,
]);
$finish->assertOk();
@@ -72,7 +72,7 @@ class ParentPromotionControllerTest extends TestCase
$promotionId = $this->seedPromotionRecord($studentId, $parentB->id);
Sanctum::actingAs($parentA);
$response = $this->getJson('/api/v1/parents/promotions/' . $promotionId);
$response = $this->getJson('/api/v1/parents/promotions/'.$promotionId);
$response->assertStatus(403);
}
@@ -140,6 +140,7 @@ class ParentPromotionControllerTest extends TestCase
'promoted_level_name' => 'Grade 4',
'enrollment_deadline' => now()->addDays(30)->toDateString(),
]);
return (int) $record->getKey();
}
}
@@ -53,7 +53,7 @@ class PublicWinnersControllerTest extends TestCase
'published_at' => now(),
]);
$this->getJson('/api/winners/competitions/' . $competition->id)
$this->getJson('/api/winners/competitions/'.$competition->id)
->assertOk()
->assertJsonPath('status', true)
->assertJsonPath('data.competition.id', $competition->id)
@@ -75,7 +75,7 @@ class PublicWinnersControllerTest extends TestCase
'is_published' => 0,
]);
$this->getJson('/api/winners/competitions/' . $competition->id)
$this->getJson('/api/winners/competitions/'.$competition->id)
->assertNotFound()
->assertJsonPath('status', false);
}
@@ -18,10 +18,10 @@ class FilesControllerTest extends TestCase
Sanctum::actingAs($user);
$dir = storage_path('uploads/receipts');
if (!is_dir($dir)) {
if (! is_dir($dir)) {
mkdir($dir, 0777, true);
}
$path = $dir . DIRECTORY_SEPARATOR . 'sample.pdf';
$path = $dir.DIRECTORY_SEPARATOR.'sample.pdf';
file_put_contents($path, 'PDFDATA');
$response = $this->getJson('/api/v1/files/receipts/sample.pdf?meta=1');
@@ -60,10 +60,10 @@ class FilesControllerTest extends TestCase
]);
$dir = storage_path('uploads/exams/drafts');
if (!is_dir($dir)) {
if (! is_dir($dir)) {
mkdir($dir, 0777, true);
}
$path = $dir . DIRECTORY_SEPARATOR . 'draft1.pdf';
$path = $dir.DIRECTORY_SEPARATOR.'draft1.pdf';
file_put_contents($path, 'PDFDATA');
$response = $this->get('/api/v1/files/exams/teacher/draft1.pdf');
@@ -37,7 +37,7 @@ class ReportCardsControllerTest extends TestCase
$data = $this->seedReportCardData($user->id);
Sanctum::actingAs($user);
$response = $this->getJson('/api/v1/reports/report-cards/completeness?class_section_id=' . $data['class_section_id'] . '&school_year=2025-2026&semester=Fall');
$response = $this->getJson('/api/v1/reports/report-cards/completeness?class_section_id='.$data['class_section_id'].'&school_year=2025-2026&semester=Fall');
$response->assertOk();
$response->assertJsonPath('status', true);
@@ -53,7 +53,7 @@ class ReportCardsControllerTest extends TestCase
$this->seedAcknowledgement($data['student_id']);
Sanctum::actingAs($user);
$response = $this->getJson('/api/v1/reports/report-cards/acknowledgement?student_id=' . $data['student_id'] . '&school_year=2025-2026&semester=Fall');
$response = $this->getJson('/api/v1/reports/report-cards/acknowledgement?student_id='.$data['student_id'].'&school_year=2025-2026&semester=Fall');
$response->assertOk();
$response->assertJsonPath('status', true);
@@ -67,7 +67,7 @@ class ReportCardsControllerTest extends TestCase
$data = $this->seedReportCardData($user->id);
Sanctum::actingAs($user);
$response = $this->getJson('/api/v1/reports/report-cards/students/' . $data['student_id'] . '?school_year=2025-2026&semester=Fall');
$response = $this->getJson('/api/v1/reports/report-cards/students/'.$data['student_id'].'?school_year=2025-2026&semester=Fall');
$response->assertOk();
$this->assertSame('application/pdf', $response->headers->get('content-type'));
@@ -80,7 +80,7 @@ class ReportCardsControllerTest extends TestCase
$data = $this->seedReportCardData($user->id);
Sanctum::actingAs($user);
$response = $this->getJson('/api/v1/reports/report-cards/classes/' . $data['class_section_id'] . '?school_year=2025-2026&semester=Fall');
$response = $this->getJson('/api/v1/reports/report-cards/classes/'.$data['class_section_id'].'?school_year=2025-2026&semester=Fall');
$response->assertOk();
$this->assertSame('application/pdf', $response->headers->get('content-type'));
@@ -93,7 +93,7 @@ class ReportCardsControllerTest extends TestCase
$data = $this->seedStudentOnly();
Sanctum::actingAs($user);
$response = $this->getJson('/api/v1/reports/report-cards/students/' . $data['student_id'] . '?school_year=2025-2026&semester=Fall');
$response = $this->getJson('/api/v1/reports/report-cards/students/'.$data['student_id'].'?school_year=2025-2026&semester=Fall');
$response->assertStatus(422);
$response->assertJsonPath('status', false);
@@ -3,6 +3,7 @@
namespace Tests\Feature\Api\V1\Roles;
use App\Models\User;
use App\Services\Roles\RoleCrudService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Laravel\Sanctum\Sanctum;
@@ -49,7 +50,7 @@ class RolePermissionControllerTest extends TestCase
$roleId = $this->seedRole();
Sanctum::actingAs($user);
$response = $this->patchJson('/api/v1/role-permissions/roles/' . $roleId, [
$response = $this->patchJson('/api/v1/role-permissions/roles/'.$roleId, [
'description' => 'updated',
]);
@@ -63,7 +64,7 @@ class RolePermissionControllerTest extends TestCase
$roleId = $this->seedRole();
Sanctum::actingAs($user);
$response = $this->deleteJson('/api/v1/role-permissions/roles/' . $roleId);
$response = $this->deleteJson('/api/v1/role-permissions/roles/'.$roleId);
$response->assertOk();
$this->assertDatabaseMissing('roles', ['id' => $roleId]);
@@ -92,7 +93,7 @@ class RolePermissionControllerTest extends TestCase
$roleId = $this->seedRole();
Sanctum::actingAs($user);
$response = $this->postJson('/api/v1/role-permissions/users/' . $user->id . '/roles', [
$response = $this->postJson('/api/v1/role-permissions/users/'.$user->id.'/roles', [
'role_ids' => [$roleId],
]);
@@ -118,15 +119,15 @@ class RolePermissionControllerTest extends TestCase
$create->assertStatus(201);
$permissionId = (int) $create->json('data.permission.id');
$show = $this->getJson('/api/v1/role-permissions/permissions/' . $permissionId);
$show = $this->getJson('/api/v1/role-permissions/permissions/'.$permissionId);
$show->assertOk();
$update = $this->patchJson('/api/v1/role-permissions/permissions/' . $permissionId, [
$update = $this->patchJson('/api/v1/role-permissions/permissions/'.$permissionId, [
'description' => 'Updated',
]);
$update->assertOk();
$delete = $this->deleteJson('/api/v1/role-permissions/permissions/' . $permissionId);
$delete = $this->deleteJson('/api/v1/role-permissions/permissions/'.$permissionId);
$delete->assertOk();
$this->assertDatabaseMissing('permissions', ['id' => $permissionId]);
}
@@ -138,7 +139,7 @@ class RolePermissionControllerTest extends TestCase
$permissionId = $this->seedPermission();
Sanctum::actingAs($user);
$response = $this->putJson('/api/v1/role-permissions/roles/' . $roleId . '/permissions', [
$response = $this->putJson('/api/v1/role-permissions/roles/'.$roleId.'/permissions', [
'permissions' => [
$permissionId => ['create' => true, 'read' => true],
],
@@ -170,8 +171,9 @@ class RolePermissionControllerTest extends TestCase
$user = $this->seedUser();
Sanctum::actingAs($user);
$this->app->bind(\App\Services\Roles\RoleCrudService::class, function () {
return new class {
$this->app->bind(RoleCrudService::class, function () {
return new class
{
public function create(array $payload)
{
throw new \RuntimeException('fail');
@@ -58,7 +58,6 @@ class RoleSwitcherControllerTest extends TestCase
$response->assertStatus(401);
}
public function test_switch_rejects_role_that_user_does_not_have(): void
{
$user = $this->seedUser();
@@ -97,7 +97,7 @@ class PreferencesControllerTest extends TestCase
$user = $this->createUser('teacher');
Sanctum::actingAs($user);
$response = $this->deleteJson('/api/v1/preferences/' . $user->id);
$response = $this->deleteJson('/api/v1/preferences/'.$user->id);
$response->assertForbidden();
}
@@ -113,7 +113,7 @@ class PreferencesControllerTest extends TestCase
'notification_sms' => 1,
]);
$response = $this->deleteJson('/api/v1/preferences/' . $admin->id);
$response = $this->deleteJson('/api/v1/preferences/'.$admin->id);
$response->assertOk();
$this->assertDatabaseMissing('user_preferences', [
@@ -146,7 +146,7 @@ class PreferencesControllerTest extends TestCase
'id' => $id,
'firstname' => 'Test',
'lastname' => 'User',
'email' => $roleName . $id . '@example.com',
'email' => $roleName.$id.'@example.com',
'cellphone' => '5555555555',
'address_street' => '123 Main',
'city' => 'City',
@@ -3,6 +3,7 @@
namespace Tests\Feature\Api\V1\Settings;
use App\Models\User;
use App\Services\Settings\SchoolCalendar\SchoolCalendarMutationService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Laravel\Sanctum\Sanctum;
@@ -50,7 +51,7 @@ class SchoolCalendarControllerTest extends TestCase
$eventId = $this->seedEvent();
Sanctum::actingAs($user);
$response = $this->getJson('/api/v1/settings/school-calendar/events/' . $eventId);
$response = $this->getJson('/api/v1/settings/school-calendar/events/'.$eventId);
$response->assertOk();
$response->assertJsonPath('status', true);
@@ -88,7 +89,7 @@ class SchoolCalendarControllerTest extends TestCase
$eventId = $this->seedEvent();
Sanctum::actingAs($user);
$response = $this->patchJson('/api/v1/settings/school-calendar/events/' . $eventId, [
$response = $this->patchJson('/api/v1/settings/school-calendar/events/'.$eventId, [
'title' => 'Updated Event',
]);
@@ -107,7 +108,7 @@ class SchoolCalendarControllerTest extends TestCase
$eventId = $this->seedEvent();
Sanctum::actingAs($user);
$response = $this->deleteJson('/api/v1/settings/school-calendar/events/' . $eventId);
$response = $this->deleteJson('/api/v1/settings/school-calendar/events/'.$eventId);
$response->assertOk();
$response->assertJsonPath('status', true);
@@ -134,8 +135,9 @@ class SchoolCalendarControllerTest extends TestCase
$user = $this->seedUser();
Sanctum::actingAs($user);
$this->app->bind(\App\Services\Settings\SchoolCalendar\SchoolCalendarMutationService::class, function () {
return new class {
$this->app->bind(SchoolCalendarMutationService::class, function () {
return new class
{
public function create(array $payload, array $targets = []): array
{
throw new \RuntimeException('fail');
@@ -2,7 +2,6 @@
namespace Tests\Feature\Api\V1\Settings;
use App\Models\Setting;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
@@ -80,7 +79,7 @@ class SettingsControllerTest extends TestCase
$user = User::query()->create([
'firstname' => 'Test',
'lastname' => 'User',
'email' => $roleName . '@example.com',
'email' => $roleName.'@example.com',
'cellphone' => '5555555555',
'address_street' => '123 Main',
'city' => 'City',
@@ -99,7 +99,7 @@ class StaffControllerTest extends TestCase
'school_year' => '2025-2026',
]);
$response = $this->patchJson('/api/v1/staff/' . $staff->id, [
$response = $this->patchJson('/api/v1/staff/'.$staff->id, [
'firstname' => 'Updated',
]);
@@ -127,7 +127,7 @@ class StaffControllerTest extends TestCase
'school_year' => '2025-2026',
]);
$response = $this->deleteJson('/api/v1/staff/' . $staff->id);
$response = $this->deleteJson('/api/v1/staff/'.$staff->id);
$response->assertOk();
$this->assertDatabaseMissing('staff', [
@@ -146,7 +146,7 @@ class StaffControllerTest extends TestCase
$user = User::query()->create([
'firstname' => 'Test',
'lastname' => 'User',
'email' => $email ?? ($roleName . '@example.com'),
'email' => $email ?? ($roleName.'@example.com'),
'cellphone' => '5555555555',
'address_street' => '123 Main',
'city' => 'City',
@@ -59,7 +59,7 @@ class StudentControllerTest extends TestCase
]);
Sanctum::actingAs($user);
$response = $this->getJson('/api/v1/students/' . $studentId . '/score-card');
$response = $this->getJson('/api/v1/students/'.$studentId.'/score-card');
$response->assertOk();
$response->assertJson(['ok' => true]);
@@ -85,7 +85,7 @@ class SupportControllerTest extends TestCase
$user = User::query()->create([
'firstname' => 'Test',
'lastname' => 'User',
'email' => $roleName . '@example.com',
'email' => $roleName.'@example.com',
'cellphone' => '5555555555',
'address_street' => '123 Main',
'city' => 'City',
@@ -22,7 +22,7 @@ class TeacherControllerTest extends TestCase
$this->seedStudent($teacher->id, $classSectionId);
Sanctum::actingAs($teacher);
$response = $this->getJson('/api/v1/teachers/classes?class_section_id=' . $classSectionId);
$response = $this->getJson('/api/v1/teachers/classes?class_section_id='.$classSectionId);
$response->assertOk();
$response->assertJson(['ok' => true]);
+1 -1
View File
@@ -53,7 +53,7 @@ class UiControllerTest extends TestCase
$user = User::query()->create([
'firstname' => 'Test',
'lastname' => 'User',
'email' => $roleName . '@example.com',
'email' => $roleName.'@example.com',
'cellphone' => '5555555555',
'address_street' => '123 Main',
'city' => 'City',
@@ -58,8 +58,7 @@ class WhatsappInviteControllerTest extends TestCase
Sanctum::actingAs($user);
$this->seedInviteData();
Event::listen(WhatsappInvitesSend::class, static function () {
});
Event::listen(WhatsappInvitesSend::class, static function () {});
$response = $this->postJson('/api/v1/whatsapp/invites/send', [
'mode' => 'parents',
@@ -52,7 +52,7 @@ class WhatsappLinkControllerTest extends TestCase
'updated_at' => now(),
]);
$response = $this->getJson('/api/v1/whatsapp/links/' . $linkId);
$response = $this->getJson('/api/v1/whatsapp/links/'.$linkId);
$response->assertOk();
$response->assertJsonPath('status', true);
@@ -99,7 +99,7 @@ class WhatsappLinkControllerTest extends TestCase
'updated_at' => now(),
]);
$response = $this->patchJson('/api/v1/whatsapp/links/' . $linkId, [
$response = $this->patchJson('/api/v1/whatsapp/links/'.$linkId, [
'invite_link' => 'https://chat.whatsapp.com/updated',
'active' => false,
]);
@@ -129,7 +129,7 @@ class WhatsappLinkControllerTest extends TestCase
'updated_at' => now(),
]);
$response = $this->deleteJson('/api/v1/whatsapp/links/' . $linkId);
$response = $this->deleteJson('/api/v1/whatsapp/links/'.$linkId);
$response->assertOk();
$response->assertJsonPath('status', true);
@@ -54,11 +54,11 @@ class ScenarioAFamilyEnrollmentTest extends TestCase
// Teacher sees student in roster.
$this->actingAs($teacher, 'api');
$this->getJson('/api/v1/teachers/classes?class_section_id=' . $classSectionId)
$this->getJson('/api/v1/teachers/classes?class_section_id='.$classSectionId)
->assertOk()
->assertJsonPath('ok', true);
$studentIds = array_column($this->getJson('/api/v1/teachers/classes?class_section_id=' . $classSectionId)->json('students'), 'student_id');
$studentIds = array_column($this->getJson('/api/v1/teachers/classes?class_section_id='.$classSectionId)->json('students'), 'student_id');
$this->assertContains($studentId, $studentIds);
// Parent sees own profile.
@@ -89,7 +89,7 @@ class ScenarioAFamilyEnrollmentTest extends TestCase
]);
$this->actingAs($parentA, 'api');
$this->patchJson('/api/v1/parents/students/' . $studentB, [
$this->patchJson('/api/v1/parents/students/'.$studentB, [
'firstname' => 'Hacked',
'lastname' => 'Child',
'dob' => '2015-01-01',
@@ -27,7 +27,7 @@ class ScenarioBSundaySchoolDayTest extends TestCase
$this->actingAs($teacher, 'api');
$form = $this->getJson('/api/v1/attendance/teacher/form?class_section_id=' . $classSectionId)
$form = $this->getJson('/api/v1/attendance/teacher/form?class_section_id='.$classSectionId)
->assertOk();
$date = (string) ($form->json('data.current_sunday') ?? '2025-10-05');
@@ -52,7 +52,7 @@ class ScenarioBSundaySchoolDayTest extends TestCase
// Parent views attendance for their child.
$this->actingAs($parent, 'api');
$this->getJson('/api/v1/parents/attendance?school_year=' . self::E2E_SCHOOL_YEAR)
$this->getJson('/api/v1/parents/attendance?school_year='.self::E2E_SCHOOL_YEAR)
->assertOk()
->assertJsonPath('ok', true);
}
@@ -51,7 +51,7 @@ class ScenarioCAcademicTermTest extends TestCase
$this->actingAs($teacher, 'api');
$this->getJson('/api/v1/scores/overview?class_section_id=' . $classSectionId . '&semester=' . self::E2E_SEMESTER . '&school_year=' . self::E2E_SCHOOL_YEAR)
$this->getJson('/api/v1/scores/overview?class_section_id='.$classSectionId.'&semester='.self::E2E_SEMESTER.'&school_year='.self::E2E_SCHOOL_YEAR)
->assertOk()
->assertJsonPath('ok', true);
@@ -69,7 +69,7 @@ class ScenarioCAcademicTermTest extends TestCase
'is_locked' => 1,
]);
$this->getJson('/api/v1/reports/report-cards/students/' . $studentId . '?school_year=' . self::E2E_SCHOOL_YEAR . '&semester=' . self::E2E_SEMESTER)
$this->getJson('/api/v1/reports/report-cards/students/'.$studentId.'?school_year='.self::E2E_SCHOOL_YEAR.'&semester='.self::E2E_SEMESTER)
->assertOk();
}
@@ -61,7 +61,7 @@ class ScenarioDFamilyBillingTest extends TestCase
->value('id');
$this->assertGreaterThan(0, $chargeId);
$this->postJson('/api/v1/finance/event-charges/' . $chargeId . '/approve')
$this->postJson('/api/v1/finance/event-charges/'.$chargeId.'/approve')
->assertOk()
->assertJsonPath('ok', true);
@@ -81,7 +81,7 @@ class ScenarioDFamilyBillingTest extends TestCase
'invoice_id' => $invoiceId,
]);
$this->getJson('/api/v1/finance/payments/parent/' . $parentId . '?school_year=' . self::E2E_SCHOOL_YEAR)
$this->getJson('/api/v1/finance/payments/parent/'.$parentId.'?school_year='.self::E2E_SCHOOL_YEAR)
->assertOk()
->assertJsonPath('ok', true);
@@ -26,7 +26,7 @@ class ScenarioEFinanceEdgeTest extends TestCase
$parent = $this->createApiUserWithRole('parent');
$priorInvoiceId = $this->seedPriorYearUnpaidInvoice($parent->id);
$preview = $this->getJson('/api/v1/finance/carryforwards/preview?' . http_build_query([
$preview = $this->getJson('/api/v1/finance/carryforwards/preview?'.http_build_query([
'from_school_year' => self::E2E_PREV_SCHOOL_YEAR,
'to_school_year' => self::E2E_SCHOOL_YEAR,
'parent_id' => $parent->id,
@@ -44,24 +44,24 @@ class ScenarioEFinanceEdgeTest extends TestCase
$this->assertNotEmpty($draft->json('result.created'));
$carryforwardId = (int) $draft->json('result.created.0.id');
$this->postJson('/api/v1/finance/carryforwards/' . $carryforwardId . '/approve')
$this->postJson('/api/v1/finance/carryforwards/'.$carryforwardId.'/approve')
->assertOk()
->assertJsonPath('ok', true);
$posted = $this->postJson('/api/v1/finance/carryforwards/' . $carryforwardId . '/post')
$posted = $this->postJson('/api/v1/finance/carryforwards/'.$carryforwardId.'/post')
->assertOk()
->assertJsonPath('ok', true);
$newInvoiceId = (int) ($posted->json('carryforward.posted_invoice_id') ?? 0);
$this->assertGreaterThan(0, $newInvoiceId);
$plan = $this->postJson('/api/v1/finance/invoices/' . $newInvoiceId . '/installment-plans', [
$plan = $this->postJson('/api/v1/finance/invoices/'.$newInvoiceId.'/installment-plans', [
'number_of_installments' => 2,
'first_due_date' => '2025-09-15',
'interval_months' => 1,
])->assertCreated()->assertJsonPath('ok', true);
$planId = (int) $plan->json('plan.id');
$this->postJson('/api/v1/finance/installment-plans/' . $planId . '/activate')
$this->postJson('/api/v1/finance/installment-plans/'.$planId.'/activate')
->assertOk()
->assertJsonPath('ok', true);
@@ -81,7 +81,7 @@ class ScenarioEFinanceEdgeTest extends TestCase
'updated_at' => now(),
]);
$this->postJson('/api/v1/finance/payments/' . $paymentId . '/allocate-installments', [])
$this->postJson('/api/v1/finance/payments/'.$paymentId.'/allocate-installments', [])
->assertOk()
->assertJsonPath('ok', true);
@@ -89,20 +89,20 @@ class ScenarioEFinanceEdgeTest extends TestCase
->assertOk()
->assertJsonPath('ok', true);
$this->postJson('/api/v1/finance/parent-payment-followups/' . $parent->id . '/note', [
$this->postJson('/api/v1/finance/parent-payment-followups/'.$parent->id.'/note', [
'invoice_id' => $newInvoiceId,
'school_year' => self::E2E_SCHOOL_YEAR,
'note' => 'Called parent about prior-year balance.',
'contact_method' => 'phone',
])->assertCreated()->assertJsonPath('ok', true);
$this->postJson('/api/v1/finance/parent-payment-followups/' . $parent->id . '/promise-to-pay', [
$this->postJson('/api/v1/finance/parent-payment-followups/'.$parent->id.'/promise-to-pay', [
'invoice_id' => $newInvoiceId,
'promise_to_pay_date' => '2025-10-15',
'promise_to_pay_amount' => 50,
])->assertCreated()->assertJsonPath('ok', true);
$this->postJson('/api/v1/finance/parent-payment-followups/' . $parent->id . '/resolve', [
$this->postJson('/api/v1/finance/parent-payment-followups/'.$parent->id.'/resolve', [
'invoice_id' => $newInvoiceId,
'note' => 'Balance plan agreed.',
])->assertCreated()->assertJsonPath('ok', true);
@@ -3,7 +3,6 @@
namespace Tests\Feature\Api\V1\Workflows;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Mail;
use Tests\Concerns\SeedsE2ETestFixtures;
use Tests\TestCase;
@@ -36,7 +36,7 @@ class ScenarioGPrintBadgeTest extends TestCase
$this->actingAs($admin, 'api');
foreach (['assigned', 'done', 'delivered'] as $status) {
$this->patchJson('/api/v1/print-requests/' . $requestId . '/status', [
$this->patchJson('/api/v1/print-requests/'.$requestId.'/status', [
'status' => $status,
])->assertOk();
}
@@ -46,7 +46,7 @@ class ScenarioGPrintBadgeTest extends TestCase
'status' => 'delivered',
]);
$badgeTag = 'E2E-BADGE-' . random_int(10000, 99999);
$badgeTag = 'E2E-BADGE-'.random_int(10000, 99999);
DB::table('users')->where('id', $teacher->id)->update(['rfid_tag' => $badgeTag]);
$this->postJson('/api/v1/badges/log-print', [
@@ -29,7 +29,7 @@ class ScenarioHSecurityUnauthorizedAccessTest extends TestCase
// Parent cannot update another family's student.
$this->actingAs($parentA, 'api');
$this->patchJson('/api/v1/parents/students/' . $world['student_id'], [
$this->patchJson('/api/v1/parents/students/'.$world['student_id'], [
'firstname' => 'Blocked',
'lastname' => 'Update',
'dob' => '2014-01-01',
@@ -26,6 +26,7 @@ class StudentEnrollmentWorkflowTest extends TestCase
use RefreshDatabase;
private const SCHOOL_YEAR = '2025-2026';
private const SEMESTER = 'Fall';
public function test_admin_creates_account_adds_student_and_enrolls_them(): void
@@ -127,14 +128,14 @@ class StudentEnrollmentWorkflowTest extends TestCase
]);
// The class roster endpoint reflects the assignment.
$classes = $this->getJson('/api/v1/students/' . $studentId . '/classes');
$classes = $this->getJson('/api/v1/students/'.$studentId.'/classes');
$classes->assertOk()->assertJsonPath('ok', true);
$assignedIds = array_column($classes->json('classes'), 'class_section_id');
$this->assertContains($classSectionId, $assignedIds);
// 5. Move the student to "enrolled" via the enrollment workflow.
$statusResponse = $this->post(
'/api/v1/administrator/enrollment-withdrawal/update-statuses?' .
'/api/v1/administrator/enrollment-withdrawal/update-statuses?'.
http_build_query(['enrollment_status' => [$studentId => 'enrolled']]),
[]
);
@@ -194,14 +195,14 @@ class StudentEnrollmentWorkflowTest extends TestCase
// First enrol...
$this->post(
'/api/v1/administrator/enrollment-withdrawal/update-statuses?' .
'/api/v1/administrator/enrollment-withdrawal/update-statuses?'.
http_build_query(['enrollment_status' => [$studentId => 'enrolled']]),
[]
)->assertOk();
// ...then withdraw.
$this->post(
'/api/v1/administrator/enrollment-withdrawal/update-statuses?' .
'/api/v1/administrator/enrollment-withdrawal/update-statuses?'.
http_build_query(['enrollment_status' => [$studentId => 'withdrawn']]),
[]
)->assertOk();
+1 -1
View File
@@ -104,7 +104,7 @@ class BulkUserRoleCreationTest extends TestCase
'firstname' => "Bulk{$name}",
'lastname' => "User{$number}",
'gender' => $index % 2 === 0 ? 'Female' : 'Male',
'cellphone' => '555' . str_pad((string) $index, 7, '0', STR_PAD_LEFT),
'cellphone' => '555'.str_pad((string) $index, 7, '0', STR_PAD_LEFT),
'email' => "bulk_api_{$roleName}_{$number}@example.test",
'address_street' => "{$index} Test Street",
'city' => 'Brooklyn',
@@ -2,9 +2,9 @@
namespace Tests\Feature\Middleware;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use App\Models\User;
use Illuminate\Support\Facades\Route;
use Tests\TestCase;
@@ -16,12 +16,12 @@ class SchoolYearAdminPageTest extends TestCase
parent::setUp();
$compiledPath = storage_path('framework/views');
if (!is_dir($compiledPath)) {
if (! is_dir($compiledPath)) {
mkdir($compiledPath, 0777, true);
}
config([
'app.key' => 'base64:' . base64_encode(random_bytes(32)),
'app.key' => 'base64:'.base64_encode(random_bytes(32)),
'app.cipher' => 'AES-256-CBC',
'jwt.secret' => bin2hex(random_bytes(32)),
'view.compiled' => $compiledPath,
+3 -3
View File
@@ -10,7 +10,7 @@ class ApiLoginSecurityServiceTest extends TestCase
{
public function test_roles_object_map_preserves_role_names(): void
{
$service = new ApiLoginSecurityService();
$service = new ApiLoginSecurityService;
$map = $service->rolesToObjectMap(['Teacher', 'Admin']);
$this->assertTrue($map->Teacher);
@@ -24,7 +24,7 @@ class ApiLoginSecurityServiceTest extends TestCase
public function test_build_login_response_includes_teacher_class_context(): void
{
$service = new ApiLoginSecurityService();
$service = new ApiLoginSecurityService;
$user = $this->getMockBuilder(User::class)
->onlyMethods(['roleNames', 'teacherSessionContext'])
@@ -57,7 +57,7 @@ class ApiLoginSecurityServiceTest extends TestCase
public function test_build_login_response_includes_teacher_assistant_class_context(): void
{
$service = new ApiLoginSecurityService();
$service = new ApiLoginSecurityService;
$user = $this->getMockBuilder(User::class)
->onlyMethods(['roleNames', 'teacherSessionContext'])
+1 -1
View File
@@ -15,7 +15,7 @@ class AuthSessionServiceTest extends TestCase
parent::setUp();
// ApplicationUrlService is final (cannot be mocked); these tests only exercise
// relative-path sanitization and never call docsHomeUrl().
$this->svc = new AuthSessionService(new ApplicationUrlService());
$this->svc = new AuthSessionService(new ApplicationUrlService);
}
public function test_sanitize_redirect_relative(): void
@@ -13,7 +13,7 @@ class AttendanceCommentTemplateControllerTest extends TestCase
{
private function makeController(AttendanceCommentTemplateService $service): AttendanceCommentTemplateController
{
return new AttendanceCommentTemplateController($service, new ApplicationUrlService());
return new AttendanceCommentTemplateController($service, new ApplicationUrlService);
}
protected function tearDown(): void
@@ -190,4 +190,4 @@ class AttendanceCommentTemplateControllerTest extends TestCase
$this->assertArrayHasKey('templates', $data);
$this->assertCount(1, $data['templates']);
}
}
}
@@ -10,7 +10,7 @@ class ScoreValueValidatorTest extends TestCase
{
public function test_blank_score_remains_null(): void
{
$validator = new ScoreValueValidator();
$validator = new ScoreValueValidator;
$this->assertNull($validator->normalizeNullable('', 100));
$this->assertNull($validator->normalizeNullable(null, 100));
@@ -18,7 +18,7 @@ class ScoreValueValidatorTest extends TestCase
public function test_score_must_be_inside_range(): void
{
$validator = new ScoreValueValidator();
$validator = new ScoreValueValidator;
$this->assertSame(95.0, $validator->normalizeNullable('95', 100));
@@ -28,7 +28,7 @@ class ScoreValueValidatorTest extends TestCase
public function test_status_inference_preserves_legacy_pending_behavior(): void
{
$validator = new ScoreValueValidator();
$validator = new ScoreValueValidator;
$this->assertSame('scored', $validator->inferStatus(80.0));
$this->assertSame('pending', $validator->inferStatus(null, false));
+6 -6
View File
@@ -133,7 +133,7 @@ class AdditionalChargeTest extends TestCase
'created_by' => null,
]);
$model = new AdditionalCharge();
$model = new AdditionalCharge;
$result = $model->markApplied([$first->id, (string) $second->id], $invoiceId);
$this->assertTrue($result);
@@ -173,7 +173,7 @@ class AdditionalChargeTest extends TestCase
'created_by' => null,
]);
$paginator = (new AdditionalCharge())->listAllForTerm('2024-2025', 'Spring', null, null, 50, true);
$paginator = (new AdditionalCharge)->listAllForTerm('2024-2025', 'Spring', null, null, 50, true);
$this->assertSame(1, $paginator->total());
$first = $paginator->items()[0];
@@ -225,19 +225,19 @@ class AdditionalChargeTest extends TestCase
'created_by' => null,
]);
$paginator = (new AdditionalCharge())->listAllForTerm('2024-2025', 'Fall', null, 'Math', 50, true);
$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);
$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);
$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);
$byInvoice = (new AdditionalCharge)->listAllForTerm('2024-2025', 'Fall', null, 'INV-2025-001', 50, true);
$this->assertSame(2, $byInvoice->total());
}
}
@@ -48,7 +48,7 @@ class AttendanceCommentTemplateModelTest extends TestCase
'is_active' => 1,
]);
$model = new AttendanceCommentTemplate();
$model = new AttendanceCommentTemplate;
$results = $model->getActiveTemplates();
$this->assertCount(2, $results);
+4 -4
View File
@@ -66,7 +66,7 @@ class AttendanceDataTest extends TestCase
'modified_by' => null,
]);
$model = new AttendanceData();
$model = new AttendanceData;
$rows = $model->getAttendanceByClass(1, 2, '2024-09-01');
$this->assertCount(1, $rows);
@@ -125,7 +125,7 @@ class AttendanceDataTest extends TestCase
],
]);
$model = new AttendanceData();
$model = new AttendanceData;
$rows = $model->unreportedTermRows([1, 2, 3], '2024-2025', 'Fall');
$this->assertCount(1, $rows);
@@ -182,7 +182,7 @@ class AttendanceDataTest extends TestCase
],
]);
$model = new AttendanceData();
$model = new AttendanceData;
$rows = $model->getUnreportedAbsencesAndLates('2024-2025', 'Fall');
$this->assertArrayHasKey(10, $rows);
@@ -209,7 +209,7 @@ class AttendanceDataTest extends TestCase
'updated_at' => now(),
]);
$model = new AttendanceData();
$model = new AttendanceData;
$result = $model->markReportedAndNotified(20, ['2024-09-10'], 'Fall', '2024-2025');
$this->assertTrue($result);
@@ -28,7 +28,7 @@ class AttendanceEmailTemplateTest extends TestCase
'is_active' => true,
]);
$result = (new AttendanceEmailTemplate())->getTemplate('attendance_absent', 'answered');
$result = (new AttendanceEmailTemplate)->getTemplate('attendance_absent', 'answered');
$this->assertIsArray($result);
$this->assertSame('answered', $result['variant']);
@@ -45,7 +45,7 @@ class AttendanceEmailTemplateTest extends TestCase
'is_active' => true,
]);
$result = (new AttendanceEmailTemplate())->getTemplate('attendance_late', 'answered');
$result = (new AttendanceEmailTemplate)->getTemplate('attendance_late', 'answered');
$this->assertIsArray($result);
$this->assertSame('default', $result['variant']);
@@ -70,7 +70,7 @@ class AttendanceEmailTemplateTest extends TestCase
'is_active' => true,
]);
$result = (new AttendanceEmailTemplate())->getTemplate('attendance_present', 'no_answer');
$result = (new AttendanceEmailTemplate)->getTemplate('attendance_present', 'no_answer');
$this->assertIsArray($result);
$this->assertSame('default', $result['variant']);
@@ -87,7 +87,7 @@ class AttendanceEmailTemplateTest extends TestCase
'is_active' => false,
]);
$result = (new AttendanceEmailTemplate())->getTemplate('attendance_unknown', 'anything');
$result = (new AttendanceEmailTemplate)->getTemplate('attendance_unknown', 'anything');
$this->assertNull($result);
}
+3 -3
View File
@@ -9,16 +9,16 @@ class AttendanceRecordTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new AttendanceRecord();
$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());
$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());
$this->assertInstanceOf(AttendanceRecord::class, new AttendanceRecord);
}
}
+3 -3
View File
@@ -9,16 +9,16 @@ class AttendanceTrackingTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new AttendanceTracking();
$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());
$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());
$this->assertInstanceOf(AttendanceTracking::class, new AttendanceTracking);
}
}
+3 -3
View File
@@ -9,16 +9,16 @@ class AuthorizedUserTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new AuthorizedUser();
$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());
$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());
$this->assertInstanceOf(AuthorizedUser::class, new AuthorizedUser);
}
}
+3 -3
View File
@@ -9,16 +9,16 @@ class BadgePrintLogTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new BadgePrintLog();
$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());
$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());
$this->assertInstanceOf(BadgePrintLog::class, new BadgePrintLog);
}
}
+3 -3
View File
@@ -9,16 +9,16 @@ class CalendarTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new Calendar();
$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());
$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());
$this->assertInstanceOf(Calendar::class, new Calendar);
}
}
@@ -9,16 +9,16 @@ class ClassPrepAdjustmentTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new ClassPrepAdjustment();
$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());
$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());
$this->assertInstanceOf(ClassPrepAdjustment::class, new ClassPrepAdjustment);
}
}
@@ -9,16 +9,16 @@ class ClassPreparationLogTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new ClassPreparationLog();
$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());
$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());
$this->assertInstanceOf(ClassPreparationLog::class, new ClassPreparationLog);
}
}
@@ -9,16 +9,16 @@ class ClassProgressAttachmentTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new ClassProgressAttachment();
$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());
$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());
$this->assertInstanceOf(ClassProgressAttachment::class, new ClassProgressAttachment);
}
}
@@ -9,16 +9,16 @@ class ClassProgressReportTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new ClassProgressReport();
$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());
$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());
$this->assertInstanceOf(ClassProgressReport::class, new ClassProgressReport);
}
}
+3 -3
View File
@@ -9,16 +9,16 @@ class ClassSectionTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new ClassSection();
$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());
$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());
$this->assertInstanceOf(ClassSection::class, new ClassSection);
}
}
+3 -3
View File
@@ -9,16 +9,16 @@ class ClassTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new SchoolClass();
$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());
$this->assertSame(['class_name', 'schedule', 'capacity', 'semester', 'school_year'], $model->getFillable());
}
public function test_model_class_loads(): void
{
$this->assertInstanceOf(SchoolClass::class, new SchoolClass());
$this->assertInstanceOf(SchoolClass::class, new SchoolClass);
}
}
+3 -3
View File
@@ -9,16 +9,16 @@ class CommunicationLogTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new CommunicationLog();
$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());
$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());
$this->assertInstanceOf(CommunicationLog::class, new CommunicationLog);
}
}
@@ -9,16 +9,16 @@ class CompetitionClassWinnerTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new CompetitionClassWinner();
$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());
$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());
$this->assertInstanceOf(CompetitionClassWinner::class, new CompetitionClassWinner);
}
}
+3 -3
View File
@@ -9,16 +9,16 @@ class CompetitionScoreTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new CompetitionScore();
$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());
$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());
$this->assertInstanceOf(CompetitionScore::class, new CompetitionScore);
}
}
+4 -4
View File
@@ -3,24 +3,24 @@
namespace Tests\Unit\Models;
use App\Models\Competition;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\SoftDeletes;
use PHPUnit\Framework\TestCase;
class CompetitionTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new Competition();
$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());
$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->assertInstanceOf(Competition::class, new Competition);
$this->assertContains(SoftDeletes::class, class_uses_recursive(Competition::class));
}
}
+3 -3
View File
@@ -9,16 +9,16 @@ class CompetitionWinnerTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new CompetitionWinner();
$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());
$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());
$this->assertInstanceOf(CompetitionWinner::class, new CompetitionWinner);
}
}
+3 -3
View File
@@ -9,16 +9,16 @@ class ConfigurationTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new Configuration();
$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());
$this->assertSame(['config_key', 'config_value'], $model->getFillable());
}
public function test_model_class_loads(): void
{
$this->assertInstanceOf(Configuration::class, new Configuration());
$this->assertInstanceOf(Configuration::class, new Configuration);
}
}
+3 -3
View File
@@ -9,16 +9,16 @@ class ContactUsTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new ContactUs();
$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());
$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());
$this->assertInstanceOf(ContactUs::class, new ContactUs);
}
}
+3 -3
View File
@@ -9,16 +9,16 @@ class CurrentFlagTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new CurrentFlag();
$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());
$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());
$this->assertInstanceOf(CurrentFlag::class, new CurrentFlag);
}
}
+3 -3
View File
@@ -9,16 +9,16 @@ class DiscountUsageTest extends TestCase
{
public function test_model_metadata_is_converted(): void
{
$model = new DiscountUsage();
$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());
$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());
$this->assertInstanceOf(DiscountUsage::class, new DiscountUsage);
}
}

Some files were not shown because too many files have changed in this diff Show More