Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
IndexTestingReportRequest
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 rules
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
 artifactId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 environment
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 status
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Http\Requests\v2\Extension\Admin;
4
5use App\Http\Models\ExtensionTestingReport;
6use App\Http\Requests\v2\Parameter\Concerns\AuthorizesVengresoAdmin;
7use Illuminate\Foundation\Http\FormRequest;
8
9/**
10 * Request for listing extension testing reports
11 *
12 * @property string|null $artifact_id Optional artifact identifier to filter reports by artifact
13 * @property string|null $environment Optional environment filter ('staging' or 'production')
14 * @property string|null $status Optional status filter ('in_progress' or 'completed')
15 */
16class IndexTestingReportRequest extends FormRequest
17{
18    use AuthorizesVengresoAdmin;
19
20    /**
21     * Get the validation rules that apply to the request.
22     *
23     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
24     */
25    public function rules(): array
26    {
27        return [
28            'artifact_id' => 'sometimes|string',
29            'environment' => 'sometimes|string|in:'.ExtensionTestingReport::ENV_STAGING.','.ExtensionTestingReport::ENV_PRODUCTION,
30            'status' => 'sometimes|string|in:'.ExtensionTestingReport::STATUS_IN_PROGRESS.','.ExtensionTestingReport::STATUS_COMPLETED,
31        ];
32    }
33
34    /**
35     * Get validated artifact_id filter.
36     */
37    public function artifactId(): ?string
38    {
39        return $this->validated()['artifact_id'] ?? null;
40    }
41
42    /**
43     * Get validated environment filter.
44     */
45    public function environment(): ?string
46    {
47        return $this->validated()['environment'] ?? null;
48    }
49
50    /**
51     * Get validated status filter.
52     */
53    public function status(): ?string
54    {
55        return $this->validated()['status'] ?? null;
56    }
57}