29 lines
971 B
PHP
29 lines
971 B
PHP
<?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]));
|
|
}
|
|
}
|