Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
23 / 23 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| UpdateTestingReportRequest | |
100.00% |
23 / 23 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| rules | |
100.00% |
23 / 23 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Requests\v2\Extension\Admin; |
| 4 | |
| 5 | use App\Http\Models\ExtensionTestingReport; |
| 6 | use App\Http\Requests\v2\Parameter\Concerns\AuthorizesVengresoAdmin; |
| 7 | use Illuminate\Foundation\Http\FormRequest; |
| 8 | |
| 9 | /** |
| 10 | * Request for updating an existing extension testing report |
| 11 | * |
| 12 | * All fields are optional. Only the report owner can update. |
| 13 | * |
| 14 | * @property string|null $name Updated human-readable name for the report |
| 15 | * @property string|null $version_tested Updated extension version being tested |
| 16 | * @property string|null $tester_name Updated name of the person running the tests |
| 17 | * @property string|null $status Updated report status: 'in_progress' or 'completed' |
| 18 | * @property array|null $domains Updated domain/test-case structure with test results |
| 19 | */ |
| 20 | class UpdateTestingReportRequest extends FormRequest |
| 21 | { |
| 22 | use AuthorizesVengresoAdmin; |
| 23 | |
| 24 | /** |
| 25 | * Get the validation rules that apply to the request. |
| 26 | * |
| 27 | * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string> |
| 28 | */ |
| 29 | public function rules(): array |
| 30 | { |
| 31 | return [ |
| 32 | 'name' => 'sometimes|string|max:255', |
| 33 | 'version_tested' => 'sometimes|string|max:100', |
| 34 | 'tester_name' => 'sometimes|string|max:255', |
| 35 | 'status' => 'sometimes|string|in:'.ExtensionTestingReport::STATUS_IN_PROGRESS.','.ExtensionTestingReport::STATUS_COMPLETED, |
| 36 | 'domains' => 'sometimes|array', |
| 37 | 'domains.*.id' => 'required_with:domains|string', |
| 38 | 'domains.*.label' => 'required_with:domains|string', |
| 39 | 'domains.*.hostname' => 'required_with:domains|string', |
| 40 | 'domains.*.icon' => 'required_with:domains|string', |
| 41 | 'domains.*.isCustom' => 'required_with:domains|boolean', |
| 42 | 'domains.*.testAreas' => 'required_with:domains|array', |
| 43 | 'domains.*.testAreas.*.id' => 'required|string', |
| 44 | 'domains.*.testAreas.*.name' => 'required|string', |
| 45 | 'domains.*.testAreas.*.isCustom' => 'required|boolean', |
| 46 | 'domains.*.testAreas.*.testCases' => 'required|array', |
| 47 | 'domains.*.testAreas.*.testCases.*.id' => 'required|string', |
| 48 | 'domains.*.testAreas.*.testCases.*.title' => 'required|string', |
| 49 | 'domains.*.testAreas.*.testCases.*.instructions' => 'required|string', |
| 50 | 'domains.*.testAreas.*.testCases.*.result' => 'nullable|string|in:pass,fail', |
| 51 | 'domains.*.testAreas.*.testCases.*.notes' => 'sometimes|string', |
| 52 | 'domains.*.testAreas.*.testCases.*.isCustom' => 'required|boolean', |
| 53 | ]; |
| 54 | } |
| 55 | } |