Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
25 / 25 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| CreateTestingReportRequest | |
100.00% |
25 / 25 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| rules | |
100.00% |
25 / 25 |
|
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 creating a new extension testing report |
| 11 | * |
| 12 | * @property string $name Human-readable name for the report (e.g., "Chrome v1.2.3 Staging QA") |
| 13 | * @property string $version_tested The extension version being tested (e.g., "1.2.3") |
| 14 | * @property string $environment The environment tested: 'staging' or 'production' |
| 15 | * @property string $artifact_id The artifact identifier linking to a production release or staging artifact |
| 16 | * @property string $tester_name The name of the person running the tests |
| 17 | * @property string|null $status Initial report status: 'in_progress' or 'completed' (default: 'in_progress') |
| 18 | * @property array|null $domains Optional pre-populated domain/test-case structure; if omitted, the full template is used |
| 19 | */ |
| 20 | class CreateTestingReportRequest 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' => 'required|string|max:255', |
| 33 | 'version_tested' => 'required|string|max:100', |
| 34 | 'environment' => 'required|string|in:'.ExtensionTestingReport::ENV_STAGING.','.ExtensionTestingReport::ENV_PRODUCTION, |
| 35 | 'artifact_id' => 'required|string', |
| 36 | 'tester_name' => 'required|string|max:255', |
| 37 | 'status' => 'sometimes|string|in:'.ExtensionTestingReport::STATUS_IN_PROGRESS.','.ExtensionTestingReport::STATUS_COMPLETED, |
| 38 | 'domains' => 'sometimes|array', |
| 39 | 'domains.*.id' => 'required_with:domains|string', |
| 40 | 'domains.*.label' => 'required_with:domains|string', |
| 41 | 'domains.*.hostname' => 'required_with:domains|string', |
| 42 | 'domains.*.icon' => 'required_with:domains|string', |
| 43 | 'domains.*.isCustom' => 'required_with:domains|boolean', |
| 44 | 'domains.*.testAreas' => 'required_with:domains|array', |
| 45 | 'domains.*.testAreas.*.id' => 'required|string', |
| 46 | 'domains.*.testAreas.*.name' => 'required|string', |
| 47 | 'domains.*.testAreas.*.isCustom' => 'required|boolean', |
| 48 | 'domains.*.testAreas.*.testCases' => 'required|array', |
| 49 | 'domains.*.testAreas.*.testCases.*.id' => 'required|string', |
| 50 | 'domains.*.testAreas.*.testCases.*.title' => 'required|string', |
| 51 | 'domains.*.testAreas.*.testCases.*.instructions' => 'required|string', |
| 52 | 'domains.*.testAreas.*.testCases.*.result' => 'nullable|string|in:pass,fail', |
| 53 | 'domains.*.testAreas.*.testCases.*.notes' => 'sometimes|string', |
| 54 | 'domains.*.testAreas.*.testCases.*.isCustom' => 'required|boolean', |
| 55 | ]; |
| 56 | } |
| 57 | } |