-
Notifications
You must be signed in to change notification settings - Fork 6
/
ScheduleAssertsTest.php
70 lines (57 loc) · 1.83 KB
/
ScheduleAssertsTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
namespace Illuminated\Testing\TestingTools\Tests\Asserts;
use Illuminate\Console\Scheduling\Schedule;
use Illuminated\Testing\TestingTools\Tests\TestCase;
class ScheduleAssertsTest extends TestCase
{
protected function resolveApplicationConsoleKernel($app)
{
parent::resolveApplicationConsoleKernel($app);
$this->createSampleSchedule();
}
private function createSampleSchedule()
{
app()->booted(function () {
$schedule = app(Schedule::class);
$schedule->command('foo')->everyFiveMinutes();
$schedule->command('bar')->hourly();
$baz = $schedule->command('baz')->twiceDaily();
/* @laravel-versions */
if (method_exists($baz, 'runInBackground')) {
$baz->runInBackground();
}
});
}
/** @test */
public function it_has_see_schedule_count_assertion()
{
$this->seeScheduleCount(3);
}
/** @test */
public function it_has_dont_see_schedule_count_assertion()
{
$this->dontSeeScheduleCount(1);
$this->dontSeeScheduleCount(2);
$this->dontSeeScheduleCount(4);
$this->dontSeeScheduleCount(5);
}
/** @test */
public function it_has_see_in_schedule_assertion()
{
$this->seeInSchedule('foo', '*/5 * * * * *');
$this->seeInSchedule('bar', '0 * * * * *');
$this->seeInSchedule('baz', '0 1,13 * * * *', true);
}
/** @test */
public function which_allows_expressions_same_as_schedule_methods()
{
$this->seeInSchedule('foo', 'everyFiveMinutes');
$this->seeInSchedule('bar', 'hourly');
$this->seeInSchedule('baz', 'twiceDaily', true);
}
/** @test */
public function it_has_dont_see_in_schedule_assertion()
{
$this->dontSeeInSchedule('foobarbaz');
}
}