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

IGNF / validator-api / 22135658047

18 Feb 2026 10:18AM UTC coverage: 53.81% (+0.2%) from 53.594%
22135658047

push

github

web-flow
fix: adding new ways to archive (#83)

* archive 5 days

* fix(test): updateArguments

* fix(test): deleteDataArgument

54 of 113 new or added lines in 16 files covered. (47.79%)

8 existing lines in 4 files now uncovered.

346 of 643 relevant lines covered (53.81%)

2.74 hits per line

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

43.75
/src/Repository/ValidationRepository.php
1
<?php
2

3
namespace App\Repository;
4

5
use App\Entity\Validation;
6
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
7
use Doctrine\Persistence\ManagerRegistry;
8

9
/**
10
 * @method Validation|null find($id, $lockMode = null, $lockVersion = null)
11
 * @method Validation|null findOneBy(array $criteria, array $orderBy = null)
12
 * @method Validation[]    findAll()
13
 * @method Validation[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
14
 */
15
class ValidationRepository extends ServiceEntityRepository
16
{
17
    public function __construct(ManagerRegistry $registry)
18
    {
19
        parent::__construct($registry, Validation::class);
23✔
20
    }
21

22
    /**
23
     * Update next "pending" validation to "processing" and returns it.
24
     *
25
     * @return Validation|null
26
     */
27
    public function popNextPending()
28
    {
29
        $em = $this->getEntityManager();
×
30
        $conn = $em->getConnection();
×
31

32
        $conn->beginTransaction();
×
33
        $conn->executeQuery('LOCK TABLE validation IN ACCESS EXCLUSIVE MODE;');
×
34

35
        /** @var Validation|null $result */
36
        $result = $this->createQueryBuilder('v')
×
37
            ->where('v.status = :status')
×
38
            ->setParameters(['status' => Validation::STATUS_PENDING])
×
39
            ->orderBy('v.dateCreation', 'ASC')
×
40
            ->setMaxResults(1)
×
41
            ->getQuery()
×
NEW
42
            ->getOneOrNullResult();
×
43

44
        if (!is_null($result)) {
×
45
            $result->setStatus(Validation::STATUS_PROCESSING);
×
46
            $result->setDateStart(new \DateTime('now'));
×
47
            $em->flush($result);
×
48
            $em->refresh($result);
×
49
        }
50

51
        $conn->commit();
×
52

UNCOV
53
        return $result;
×
54
    }
55

56
    /**
57
     * Finds all archivable validations older than expiryDate.
58
     *
59
     * @return array<Validation>
60
     */
61
    public function findAllToBeArchived(\DateTime $expiryDate)
62
    {
63
        return $this->createQueryBuilder('v')
1✔
64
            ->where('v.dateCreation < :expiryDate')
1✔
65
            ->andWhere('v.status != :ignoredStatus')
1✔
66
            ->setParameters([
1✔
67
                'expiryDate' => $expiryDate,
1✔
68
                'ignoredStatus' => Validation::STATUS_ARCHIVED,
1✔
69
            ])
1✔
70
            ->getQuery()
1✔
71
            ->getResult()
1✔
72
        ;
1✔
73
    }
74

75
    /**
76
     * Drop schema corresponding to input validation.
77
     *
78
     * @return bool
79
     */
80
    public function dropSchema(Validation $validation)
81
    {
82
        $sql = sprintf('DROP SCHEMA IF EXISTS "validation%s" CASCADE', $validation->getUid());
1✔
83
        $reponse = $this->getEntityManager()->getConnection()->executeQuery($sql);
1✔
84

85
        return 0 != $reponse->rowCount();
1✔
86
    }
87
}
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