1 | <?php |
||
35 | abstract class BaseCommandTestCase extends KernelTestCase |
||
36 | { |
||
37 | /** |
||
38 | * @var Application |
||
39 | */ |
||
40 | protected $application; |
||
41 | |||
42 | /** |
||
43 | * @var TaskRepositoryInterface |
||
44 | */ |
||
45 | protected $taskRepository; |
||
46 | |||
47 | /** |
||
48 | * @var TaskExecutionRepositoryInterface |
||
49 | */ |
||
50 | protected $taskExecutionRepository; |
||
51 | |||
52 | /** |
||
53 | * @var TaskSchedulerInterface |
||
54 | */ |
||
55 | protected $taskScheduler; |
||
56 | |||
57 | /** |
||
58 | * @var TaskRunnerInterface |
||
59 | */ |
||
60 | protected $taskRunner; |
||
61 | |||
62 | /** |
||
63 | * @var Command |
||
64 | */ |
||
65 | protected $command; |
||
66 | |||
67 | /** |
||
68 | * @var CommandTester |
||
69 | */ |
||
70 | protected $commandTester; |
||
71 | |||
72 | public function setUp() |
||
91 | |||
92 | /** |
||
93 | * Create new task. |
||
94 | * |
||
95 | * @param string $workload |
||
96 | * @param CronExpression $cronExpression |
||
97 | * @param string $handlerClass |
||
98 | * |
||
99 | * @return TaskInterface |
||
100 | */ |
||
101 | protected function createTask($workload, CronExpression $cronExpression = null, $handlerClass = TestHandler::class) |
||
112 | |||
113 | /** |
||
114 | * Create task-execution. |
||
115 | * |
||
116 | * @param TaskInterface $task |
||
117 | * @param \DateTime $scheduleTime |
||
118 | * @param string $status |
||
119 | * |
||
120 | * @return TaskExecutionInterface |
||
121 | */ |
||
122 | protected function createTaskExecution(TaskInterface $task, \DateTime $scheduleTime, $status = TaskStatus::PLANNED) |
||
131 | |||
132 | /** |
||
133 | * Purge the Doctrine ORM database. |
||
134 | */ |
||
135 | protected function purgeDatabase() |
||
158 | |||
159 | /** |
||
160 | * Returns entity-manager. |
||
161 | * |
||
162 | * @return EntityManagerInterface |
||
163 | */ |
||
164 | protected function getEntityManager() |
||
168 | |||
169 | /** |
||
170 | * Returns command. |
||
171 | * |
||
172 | * @return Command |
||
173 | */ |
||
174 | abstract protected function getCommand(); |
||
175 | } |
||
176 |