-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
printing the summary is now the responsibility of the driver
- Loading branch information
Ben Kuhl
committed
Mar 24, 2014
1 parent
15e7097
commit d5290df
Showing
6 changed files
with
93 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* @author Ben Kuhl <[email protected]> | ||
*/ | ||
|
||
use Mockery as m; | ||
|
||
class TestCronScheduleService extends TestCase | ||
{ | ||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
} | ||
|
||
public function tearDown() | ||
{ | ||
parent::tearDown(); | ||
m::close(); | ||
} | ||
|
||
/** | ||
* Test that a summary is properly generated | ||
* Dangit this is ugly... gotta find a new cli library | ||
*/ | ||
public function testPrintSummary() | ||
{ | ||
$table = m::mock('Indatus\Dispatcher\Table', function ($m) { | ||
$m->shouldReceive('setHeaders')->once(); | ||
$m->shouldReceive('sort')->once(); | ||
$m->shouldReceive('display')->once(); | ||
}); | ||
$scheduledCommand = m::mock('Indatus\Dispatcher\ScheduledCommand', function ($m) use ($table) { | ||
$table->shouldReceive('addRow')->once(); | ||
|
||
$m->shouldReceive('getName')->once(); | ||
$m->shouldReceive('user')->once(); | ||
$m->shouldReceive('environment')->twice(); | ||
$m->shouldReceive('schedule')->once()->andReturn(m::mock('Indatus\Dispatcher\Drivers\Cron\Scheduler', function ($m) { | ||
$m->shouldReceive('getScheduleMinute'); | ||
$m->shouldReceive('getScheduleHour'); | ||
$m->shouldReceive('getScheduleDayOfMonth'); | ||
$m->shouldReceive('getScheduleMonth'); | ||
$m->shouldReceive('getScheduleDayOfWeek'); | ||
})); | ||
}); | ||
$scheduleService = m::mock('Indatus\Dispatcher\Drivers\Cron\ScheduleService[getScheduledCommands]', array( | ||
$table | ||
), function ($m) use ($scheduledCommand) { | ||
$m->shouldReceive('getScheduledCommands')->once()->andReturn(array( | ||
$scheduledCommand | ||
)); | ||
}); | ||
$scheduleService->printSummary(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters