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

daycry / cronjob / 13433654919

20 Feb 2025 10:54AM UTC coverage: 65.424% (-2.5%) from 67.886%
13433654919

push

github

Jordi de la Mano
Fix: phpunit coverage

316 of 483 relevant lines covered (65.42%)

2.54 hits per line

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

77.78
/src/Scheduler.php
1
<?php
2

3
namespace Daycry\CronJob;
4

5
use Closure;
6

7
class Scheduler
8
{
9
    protected array $tasks = [];
10

11
    /**
12
     * Returns the created Tasks.
13
     *
14
     * @return list<Job>
15
     */
16
    public function getTasks(): array
17
    {
18
        return $this->tasks;
6✔
19
    }
20

21
    // --------------------------------------------------------------------
22

23
    /**
24
     * Schedules a closure to run.
25
     */
26
    public function call(Closure $func): Job
27
    {
28
        return $this->createTask('closure', $func);
1✔
29
    }
30

31
    /**
32
     * Schedules a console command to run.
33
     */
34
    public function command(string $command): Job
35
    {
36
        return $this->createTask('command', $command);
1✔
37
    }
38

39
    /**
40
     * Schedules a local function to be exec'd
41
     */
42
    public function shell(string $command): Job
43
    {
44
        return $this->createTask('shell', $command);
1✔
45
    }
46

47
    /**
48
     * Schedules an Event to trigger
49
     *
50
     * @param string $name Name of the event to trigger
51
     */
52
    public function event(string $name): Job
53
    {
54
        return $this->createTask('event', $name);
×
55
    }
56

57
    /**
58
     * Schedules a cURL command to a remote URL
59
     */
60
    public function url(string $url): Job
61
    {
62
        return $this->createTask('url', $url);
×
63
    }
64

65
    // --------------------------------------------------------------------
66

67
    /**
68
     * @param mixed $action
69
     *
70
     * @return Task
71
     */
72
    protected function createTask(string $type, $action)
73
    {
74
        $task          = new Job($type, $action);
3✔
75
        $this->tasks[] = $task;
3✔
76

77
        return $task;
3✔
78
    }
79
}
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