update project

This commit is contained in:
root
2026-05-30 01:11:35 -04:00
parent 3a0628ecc7
commit 2225f6bc72
9743 changed files with 1122482 additions and 59 deletions
@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace Tests\Feature\SchoolCore\Attendance;
use PHPUnit\Framework\TestCase;
final class ScannerDelegationTest extends TestCase
{
public function test_scanner_route_file_exists_for_phase_four_slice(): void
{
$routeFile = dirname(__DIR__, 4).'/routes/attendance_phase4.php';
$this->assertFileExists($routeFile);
$this->assertStringContainsString('attendance.scan.process', file_get_contents($routeFile));
}
}
@@ -0,0 +1 @@
<?php declare(strict_types=1); namespace Tests\Feature\SchoolCore\Communication; use App\Domain\SchoolCore\Communication\Exceptions\RecipientPreviewRequiredException; use PHPUnit\Framework\TestCase; final class BulkSendRequiresPreviewTest extends TestCase { public function test_bulk_send_without_preview_exception_exists(): void { $this->assertTrue(class_exists(RecipientPreviewRequiredException::class)); } }
@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace Tests\Feature\SchoolCore\Finance;
use PHPUnit\Framework\TestCase;
final class PaymentFileRouteTest extends TestCase
{
public function test_phase3_route_documents_payment_id_based_file_access(): void
{
$routeFile = dirname(__DIR__, 4).'/routes/finance_phase3.php';
$this->assertFileExists($routeFile);
$routes = file_get_contents($routeFile);
$this->assertStringContainsString('payments/{payment}/file', $routes);
$this->assertStringContainsString('school.context', $routes);
}
}
@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace Tests\Feature\SchoolCore;
use App\Domain\SchoolCore\Context\SchoolContext;
use App\Domain\SchoolCore\Files\Policies\PaymentFileAccessPolicy;
use PHPUnit\Framework\TestCase;
final class PaymentFilePolicyTest extends TestCase
{
public function test_cross_school_payment_file_access_fails(): void
{
$context = new SchoolContext(10, 20, ['finance'], '2025', 'spring', 'UTC', 'en', 'USD', 'standard_school');
$policy = new PaymentFileAccessPolicy();
$this->assertFalse($policy->canAccess($context, 'payment', 99, ['school_id' => 11]));
}
public function test_finance_role_can_access_same_school_payment_file(): void
{
$context = new SchoolContext(10, 20, ['finance'], '2025', 'spring', 'UTC', 'en', 'USD', 'standard_school');
$policy = new PaymentFileAccessPolicy();
$this->assertTrue($policy->canAccess($context, 'payment', 99, ['school_id' => 10]));
}
}
@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class ReportingPhase7ScaffoldTest extends TestCase
{
public function test_reporting_phase_7_scaffold_exists(): void
{
$root = dirname(__DIR__, 4);
$this->assertFileExists($root.'/app/Domain/SchoolCore/Reporting/Contracts/ReportRunnerContract.php');
$this->assertFileExists($root.'/app/Providers/SchoolCoreReportingServiceProvider.php');
$this->assertFileExists($root.'/app/Domain/IslamicSundaySchool/Reporting/Providers/IslamicSundaySchoolReportingServiceProvider.php');
}
}
@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
namespace Tests\Feature\SchoolCore;
use App\Domain\SchoolCore\Context\SchoolContext;
use App\Http\Middleware\ResolveSchoolContext;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Http\Request;
use Orchestra\Testbench\TestCase;
final class ResolveSchoolContextMiddlewareTest extends TestCase
{
protected function getPackageProviders($app): array
{
return [\App\Providers\SchoolContextServiceProvider::class];
}
public function test_it_attaches_context_to_request(): void
{
$request = Request::create('/test', 'GET');
$request->setUserResolver(fn () => new MiddlewareFakeUser(5, 88));
$middleware = app(ResolveSchoolContext::class);
$response = $middleware->handle($request, function (Request $request) {
return response()->json([
'school_id' => $request->attributes->get(SchoolContext::class)->schoolId,
]);
});
$this->assertSame(200, $response->getStatusCode());
$this->assertStringContainsString('5', $response->getContent());
}
}
final class MiddlewareFakeUser implements Authenticatable
{
public function __construct(public int $school_id, private int $id)
{
}
public function getAuthIdentifierName(): string { return 'id'; }
public function getAuthIdentifier(): mixed { return $this->id; }
public function getAuthPassword(): string { return ''; }
public function getAuthPasswordName(): string { return 'password'; }
public function getRememberToken(): ?string { return null; }
public function setRememberToken($value): void {}
public function getRememberTokenName(): string { return 'remember_token'; }
}
@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace Tests\Feature\SchoolCore;
use PHPUnit\Framework\TestCase;
final class StudentIdentifierConcurrencyTest extends TestCase
{
public function test_database_must_enforce_unique_student_identifier_per_school(): void
{
$this->markTestSkipped('Enable in the host Laravel app after binding the real Student model and database connection. The migration adds unique(school_id, school_id_number).');
}
}
@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace Tests\Feature\SchoolCore\Students;
use PHPUnit\Framework\TestCase;
final class StudentLifecycleDelegationTest extends TestCase
{
public function test_phase5_routes_file_exists(): void
{
$routeFile = dirname(__DIR__, 4).'/routes/student_lifecycle_phase5.php';
$this->assertFileExists($routeFile);
}
}