58726ee0e9
API CI/CD / Validate (composer + pint) (push) Successful in 3m6s
API CI/CD / Test (PHPUnit) (push) Failing after 5m48s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Security audit (push) Failing after 1m33s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
35 lines
1.4 KiB
PHP
35 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\Support;
|
|
|
|
use App\Support\SchoolYear\SchoolYearTableRegistry;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class SchoolYearTableRegistryTest extends TestCase
|
|
{
|
|
public function test_global_tables_are_not_year_scoped(): void
|
|
{
|
|
foreach (['users', 'roles', 'permissions', 'settings', 'school_years', 'user_roles'] as $table) {
|
|
$this->assertTrue(SchoolYearTableRegistry::isGlobal($table), $table);
|
|
$this->assertFalse(SchoolYearTableRegistry::isYearScoped($table), $table);
|
|
}
|
|
}
|
|
|
|
public function test_identity_tables_are_classified_separately_from_year_owned_tables(): void
|
|
{
|
|
foreach (['students', 'families', 'parents', 'teachers', 'staff'] as $table) {
|
|
$this->assertTrue(SchoolYearTableRegistry::isIdentityWithYearRelation($table), $table);
|
|
$this->assertFalse(SchoolYearTableRegistry::isYearScoped($table), $table);
|
|
$this->assertFalse(SchoolYearTableRegistry::isGlobal($table), $table);
|
|
}
|
|
}
|
|
|
|
public function test_year_owned_and_context_tables_are_explicit(): void
|
|
{
|
|
$this->assertTrue(SchoolYearTableRegistry::isYearScoped('student_class'));
|
|
$this->assertTrue(SchoolYearTableRegistry::isYearScoped('payments'));
|
|
$this->assertTrue(SchoolYearTableRegistry::isContext('notifications'));
|
|
$this->assertTrue(SchoolYearTableRegistry::isContext('payment_notification_logs'));
|
|
}
|
|
}
|