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

php-bug-catcher / bug-catcher / 20456731454

23 Dec 2025 09:21AM UTC coverage: 85.729% (-3.4%) from 89.142%
20456731454

push

github

web-flow
Merge pull request #17 from php-bug-catcher/selection

Added selection functionality to logs for batch proccesing

2 of 16 new or added lines in 3 files covered. (12.5%)

20 existing lines in 5 files now uncovered.

829 of 967 relevant lines covered (85.73%)

13.08 hits per line

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

23.53
/src/Repository/RecordPingRepository.php
1
<?php
2

3
namespace BugCatcher\Repository;
4

5
use BugCatcher\Entity\Project;
6
use BugCatcher\Entity\Record;
7
use BugCatcher\Entity\RecordPing;
8
use DateTimeImmutable;
9
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
10
use Doctrine\ORM\QueryBuilder;
11
use Doctrine\Persistence\ManagerRegistry;
12
use Symfony\Bridge\Doctrine\Types\UuidType;
13
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
14

15
/**
16
 * @extends ServiceEntityRepository<RecordPing>
17
 *
18
 * @method RecordPing|null find($id, $lockMode = null, $lockVersion = null)
19
 * @method RecordPing|null findOneBy(array $criteria, array $orderBy = null)
20
 * @method RecordPing[]    findAll()
21
 * @method RecordPing[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
22
 */
23
final class RecordPingRepository extends ServiceEntityRepository implements RecordRepositoryInterface
24
{
25
    public function __construct(
26
        ManagerRegistry $registry,
27
        EventDispatcherInterface $dispatcher,
28
        private readonly RecordRepositoryInterface $recordRepository,
29
    ) {
30
        parent::__construct($registry, RecordPing::class);
18✔
31
    }
32

33
    public function save(RecordPing $entity, bool $flush = false): void
34
    {
35
        $this->getEntityManager()->persist($entity);
12✔
36

37
        if ($flush) {
12✔
38
            $this->getEntityManager()->flush();
12✔
39
        }
40
    }
41

42

43
    public function getQBWith(Project $project): QueryBuilder
44
    {
45
        $qb = $this->createQueryBuilder('r');
×
46

47
        $qb->andWhere('r.project = :project')
×
48
            ->setParameter('project', $project->getId(), UuidType::NAME);
×
49

50
        return $qb;
×
51
    }
52

53
    public function getLastRecord(Project $project, string $maxLife = '-1 hour'): ?RecordPing
54
    {
55
        return $this->getQBWith(project: $project)
×
56
            ->andWhere("r.date >= :date")
×
57
            ->orderBy('r.date', 'DESC')
×
NEW
58
                        ->setParameter('date', new DateTimeImmutable($maxLife))
×
59
            ->setMaxResults(1)
×
60
            ->getQuery()
×
61
            ->getOneOrNullResult();
×
62
    }
63

64

65
    public function setStatusBetween(
66
        array $projects,
67
                DateTimeImmutable $from,
68
                DateTimeImmutable $to,
69
        string $newStatus,
70
        string $previousStatus = 'new',
71
                ?callable $qbCreator = null
72
    ): void {
73
        $this->recordRepository->setStatusBetween($projects, $from, $to, $newStatus, $previousStatus, $qbCreator);
×
74
    }
75

76
    public function setStatus(
77
        Record $log,
78
                DateTimeImmutable $lastDate,
79
        string $newStatus,
80
        string $previousStatus = 'new',
81
        bool $flush = false,
82
                ?callable $qbCreator = null
83
    ) {
84
        $this->recordRepository->setStatus($log, $lastDate, $newStatus, $previousStatus, $flush, $qbCreator);
×
85
    }
86
}
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

© 2025 Coveralls, Inc