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

orisai / scheduler / 24337029903

10 Apr 2026 02:16AM UTC coverage: 97.796%. Remained the same
24337029903

push

github

mabar
JobResult->hasLockExpiredEarly() for checking too short lock periods in after job callbacks

6 of 7 new or added lines in 3 files covered. (85.71%)

2795 of 2858 relevant lines covered (97.8%)

70.99 hits per line

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

94.74
/src/Status/JobResult.php
1
<?php declare(strict_types = 1);
2

3
namespace Orisai\Scheduler\Status;
4

5
use Cron\CronExpression;
6
use DateTimeImmutable;
7

8
final class JobResult
9
{
10

11
        private CronExpression $expression;
12

13
        private DateTimeImmutable $end;
14

15
        private JobResultState $state;
16

17
        private bool $lockExpired;
18

19
        public function __construct(
20
                CronExpression $expression,
21
                DateTimeImmutable $end,
22
                JobResultState $state,
23
                bool $lockExpired = false
24
        )
25
        {
26
                $this->expression = $expression;
552✔
27
                $this->end = $end;
552✔
28
                $this->state = $state;
552✔
29
                $this->lockExpired = $lockExpired;
552✔
30
        }
31

32
        public function getEnd(): DateTimeImmutable
33
        {
34
                return $this->end;
136✔
35
        }
36

37
        public function getState(): JobResultState
38
        {
39
                return $this->state;
240✔
40
        }
41

42
        public function hasLockExpiredEarly(): bool
43
        {
NEW
44
                return $this->lockExpired;
×
45
        }
46

47
        /**
48
         * @param int<0, max> $nth
49
         *
50
         * @infection-ignore-all
51
         */
52
        public function getNextRunDate(int $nth = 0): DateTimeImmutable
53
        {
54
                return DateTimeImmutable::createFromMutable(
8✔
55
                        $this->expression->getNextRunDate($this->end, $nth),
8✔
56
                );
8✔
57
        }
58

59
        /**
60
         * @param int<0, max> $total
61
         * @return list<DateTimeImmutable>
62
         */
63
        public function getNextRunDates(int $total): array
64
        {
65
                $dates = [];
8✔
66
                foreach ($this->expression->getMultipleRunDates($total, $this->end) as $date) {
8✔
67
                        $dates[] = DateTimeImmutable::createFromMutable($date);
8✔
68
                }
69

70
                return $dates;
8✔
71
        }
72

73
        /**
74
         * @return array<mixed>
75
         */
76
        public function toArray(): array
77
        {
78
                return [
56✔
79
                        'end' => [$this->end->format('U.u'), $this->end->getTimezone()->getName()],
56✔
80
                        'state' => $this->getState()->value,
56✔
81
                        'lockExpired' => $this->lockExpired,
56✔
82
                ];
56✔
83
        }
84

85
}
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