1 | <?php |
||
30 | abstract class BaseCommandTestCase extends KernelTestCase |
||
31 | { |
||
32 | /** |
||
33 | * @var Application |
||
34 | */ |
||
35 | protected $application; |
||
36 | |||
37 | /** |
||
38 | * @var TaskRepositoryInterface |
||
39 | */ |
||
40 | protected $taskRepository; |
||
41 | |||
42 | /** |
||
43 | * @var TaskExecutionRepositoryInterface |
||
44 | */ |
||
45 | protected $taskExecutionRepository; |
||
46 | |||
47 | /** |
||
48 | * @var TaskSchedulerInterface |
||
49 | */ |
||
50 | protected $taskScheduler; |
||
51 | |||
52 | /** |
||
53 | * @var TaskRunnerInterface |
||
54 | */ |
||
55 | protected $taskRunner; |
||
56 | |||
57 | /** |
||
58 | * @var Command |
||
59 | */ |
||
60 | protected $command; |
||
61 | |||
62 | /** |
||
63 | * @var CommandTester |
||
64 | */ |
||
65 | protected $commandTester; |
||
66 | |||
67 | public function setUp() |
||
84 | |||
85 | /** |
||
86 | * Create new task. |
||
87 | * |
||
88 | * @param string $workload |
||
89 | * @param CronExpression $cronExpression |
||
90 | * @param string $handlerClass |
||
91 | * |
||
92 | * @return TaskInterface |
||
93 | */ |
||
94 | protected function createTask($workload, CronExpression $cronExpression = null, $handlerClass = TestHandler::class) |
||
105 | |||
106 | /** |
||
107 | * Create task-execution. |
||
108 | * |
||
109 | * @param TaskInterface $task |
||
110 | * @param \DateTime $scheduleTime |
||
111 | * @param string $status |
||
112 | * |
||
113 | * @return TaskExecutionInterface |
||
114 | */ |
||
115 | protected function createTaskExecution(TaskInterface $task, \DateTime $scheduleTime, $status = TaskStatus::PLANNED) |
||
124 | |||
125 | /** |
||
126 | * Returns command. |
||
127 | * |
||
128 | * @return Command |
||
129 | */ |
||
130 | protected abstract function getCommand(); |
||
131 | } |
||
132 |