da1bd48444
- Decouple framework installation: add install-laravel.sh and install-cakephp.sh, isolate skills and docs per framework, and auto-clean leftover artifacts - Remove all SonarQube configs, templates, and references - Enforce comprehensive test completeness: 100% public methods, edge cases, full branch coverage, exception paths, and state assertions - Replace all placeholder assertions in PHPUnit and Pest templates with full realistic implementations - Rename and update 10-comprehensive-test-coverage-guide.md
33 lines
734 B
PHP
33 lines
734 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use {{TargetClassFullName}};
|
|
use App\Models\User;
|
|
|
|
beforeEach(function () {
|
|
$this->policy = new {{ClassName}}();
|
|
});
|
|
|
|
describe('{{ClassName}}', function () {
|
|
it('allows authorized user to perform action', function () {
|
|
$user = new User();
|
|
$user->id = 1;
|
|
|
|
$resource = new \stdClass();
|
|
$resource->user_id = 1;
|
|
|
|
expect($this->policy->view($user, $resource))->toBeTrue();
|
|
});
|
|
|
|
it('denies unauthorized user from performing action', function () {
|
|
$user = new User();
|
|
$user->id = 2;
|
|
|
|
$resource = new \stdClass();
|
|
$resource->user_id = 1;
|
|
|
|
expect($this->policy->update($user, $resource))->toBeFalse();
|
|
});
|
|
});
|