• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IGNF / validator-api / 22141694852

18 Feb 2026 01:28PM UTC coverage: 53.715% (-0.1%) from 53.81%
22141694852

push

github

web-flow
feat(dev): deleteData field (#84)

5 of 26 new or added lines in 3 files covered. (19.23%)

347 of 646 relevant lines covered (53.72%)

2.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.56
/src/Entity/Validation.php
1
<?php
2

3
namespace App\Entity;
4

5
use App\Repository\ValidationRepository;
6
use Doctrine\ORM\Mapping as ORM;
7

8
/**
9
 * @ORM\Entity(repositoryClass=ValidationRepository::class)
10
 *
11
 * @ORM\Table(
12
 *      name="validation",
13
 *      indexes = {
14
 *
15
 *          @ORM\Index(name="validation_uid_idx", columns={"uid"})
16
 *      }
17
 * )
18
 */
19
class Validation
20
{
21
    /**
22
     * User has uploaded a dataset but is yet to post the arguments
23
     * User has 30 days to provide the arguments, otherwise the dataset will be deleted.
24
     */
25
    public const STATUS_WAITING_ARGS = 'waiting_for_args';
26

27
    /**
28
     * The validation request by user has been recorded (both dataset and arguments received) but is yet to be carried out.
29
     */
30
    public const STATUS_PENDING = 'pending';
31

32
    /**
33
     * Validation is being carried out right now.
34
     */
35
    public const STATUS_PROCESSING = 'processing';
36

37
    /**
38
     * Validation is done and the results are available.
39
     */
40
    public const STATUS_FINISHED = 'finished';
41

42
    /**
43
     * A runtime error has occured.
44
     */
45
    public const STATUS_ERROR = 'error';
46

47
    /**
48
     * Validation created 30 days ago and its files have been deleted automatically to save space on the server.
49
     */
50
    public const STATUS_ARCHIVED = 'archived';
51

52
    /**
53
     * Unique identifier.
54
     *
55
     * @ORM\Id
56
     *
57
     * @ORM\Column(type="string", length=24, unique=true)
58
     */
59
    private $uid;
60

61
    /**
62
     * Name of the dataset, derived from the name of the compressed file (zip) containing the dataset.
63
     *
64
     * @ORM\Column(type="string", length=100)
65
     */
66
    private $datasetName;
67

68
    /**
69
     * CLI Arguments for the Java executable program.
70
     *
71
     * @ORM\Column(type="json", nullable=true)
72
     */
73
    private $arguments;
74

75
    /**
76
     * Date of creation.
77
     *
78
     * @ORM\Column(type="datetime", nullable=false)
79
     */
80
    private $dateCreation;
81

82
    /**
83
     * Status.
84
     *
85
     * @ORM\Column(type="string", length=16, nullable=false, options={"default":"waiting_for_args"}, columnDefinition="character varying(16) CHECK (status IN ('waiting_for_args','pending','processing','finished','archived','error'))")
86
     */
87
    private $status;
88

89
    /**
90
     * Message.
91
     *
92
     * @ORM\Column(type="text", nullable=true)
93
     */
94
    private $message;
95

96
    /**
97
     * Start date.
98
     *
99
     * @ORM\Column(type="datetime", nullable=true)
100
     */
101
    private $dateStart;
102

103
    /**
104
     * Finish date.
105
     *
106
     * @ORM\Column(type="datetime", nullable=true)
107
     */
108
    private $dateFinish;
109

110
    /**
111
     * Results in json format.
112
     *
113
     * @ORM\Column(type="json", nullable=true)
114
     */
115
    private $results;
116

117
    /**
118
     * @ORM\Column(type="boolean", nullable=true)
119
     */
120
    private $deleteData;
121

122
    /**
123
     * Constructor.
124
     */
125
    public function __construct()
126
    {
127
        $this->setDateCreation(new \DateTime('now'));
25✔
128
        $this->setStatus($this::STATUS_WAITING_ARGS);
25✔
129
        $this->setUid($this->generateUid());
25✔
130
    }
131

132
    public function getUid(): ?string
133
    {
134
        return $this->uid;
23✔
135
    }
136

137
    public function setUid(string $uid): self
138
    {
139
        $this->uid = $uid;
25✔
140

141
        return $this;
25✔
142
    }
143

144
    public function getDatasetName(): ?string
145
    {
146
        return $this->datasetName;
3✔
147
    }
148

149
    public function setDatasetName(string $datasetName): self
150
    {
151
        $this->datasetName = $datasetName;
23✔
152

153
        return $this;
23✔
154
    }
155

156
    public function getArguments()
157
    {
158
        return $this->arguments;
1✔
159
    }
160

161
    public function setArguments($arguments): self
162
    {
163
        $this->arguments = $arguments;
23✔
164

165
        return $this;
23✔
166
    }
167

168
    public function getDateCreation(): ?\DateTimeInterface
169
    {
170
        return $this->dateCreation;
×
171
    }
172

173
    public function setDateCreation(\DateTimeInterface $dateCreation): self
174
    {
175
        $this->dateCreation = $dateCreation;
25✔
176

177
        return $this;
25✔
178
    }
179

180
    public function getStatus(): ?string
181
    {
182
        return $this->status;
11✔
183
    }
184

185
    public function setStatus(string $status): self
186
    {
187
        $this->status = $status;
25✔
188

189
        return $this;
25✔
190
    }
191

192
    public function getMessage(): ?string
193
    {
194
        return $this->message;
1✔
195
    }
196

197
    public function setMessage(?string $message): self
198
    {
199
        $this->message = $message;
1✔
200

201
        return $this;
1✔
202
    }
203

204
    public function getDateStart(): ?\DateTimeInterface
205
    {
206
        return $this->dateStart;
1✔
207
    }
208

209
    public function setDateStart(?\DateTimeInterface $dateStart): self
210
    {
211
        $this->dateStart = $dateStart;
1✔
212

213
        return $this;
1✔
214
    }
215

216
    public function getDateFinish(): ?\DateTimeInterface
217
    {
218
        return $this->dateFinish;
1✔
219
    }
220

221
    public function setDateFinish(?\DateTimeInterface $dateFinish): self
222
    {
223
        $this->dateFinish = $dateFinish;
1✔
224

225
        return $this;
1✔
226
    }
227

228
    public function getResults()
229
    {
230
        return $this->results;
3✔
231
    }
232

233
    public function setResults($results)
234
    {
235
        $this->results = $results;
3✔
236

237
        return $this;
3✔
238
    }
239

240
    public function getDeleteData()
241
    {
NEW
242
        return $this->deleteData;
×
243
    }
244

245
    public function setDeleteData($deleteData)
246
    {
247
        $this->deleteData = $deleteData;
1✔
248

249
        return $this;
1✔
250
    }
251

252
    /**
253
     * Reset all attributes because user has requested a validation with updated parameters.
254
     *
255
     * @return Validation
256
     */
257
    public function reset()
258
    {
259
        $this->setStatus($this::STATUS_PENDING);
1✔
260
        $this->setMessage(null);
1✔
261
        $this->setDateStart(null);
1✔
262
        $this->setDateFinish(null);
1✔
263
        $this->setResults(null);
1✔
264

265
        return $this;
1✔
266
    }
267

268
    /**
269
     * Generate UID.
270
     *
271
     * @param int $length
272
     *
273
     * @return string
274
     */
275
    private function generateUid($length = 24)
276
    {
277
        $randomUid = '';
25✔
278

279
        for ($i = 0; $i < $length; ++$i) {
25✔
280
            if (1 == random_int(1, 2)) {
25✔
281
                // a digit between 0 and 9
282
                $randomUid .= chr(random_int(48, 57));
25✔
283
            } else {
284
                // a lowercase letter between a and z
285
                $randomUid .= chr(random_int(97, 122));
25✔
286
            }
287
        }
288

289
        return $randomUid;
25✔
290
    }
291
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc