Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| TerminateDeliveryExecutionsService | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
| action | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2018 (original work) Open Assessment Technologies SA; |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | namespace oat\taoProctoring\model; |
| 23 | |
| 24 | use oat\taoProctoring\model\execution\DeliveryExecutionsUpdater; |
| 25 | use common_report_Report as Report; |
| 26 | |
| 27 | class TerminateDeliveryExecutionsService extends DeliveryExecutionsUpdater |
| 28 | { |
| 29 | public const SERVICE_ID = 'taoProctoring/TerminateDeliveryExecutions'; |
| 30 | |
| 31 | /** |
| 32 | * Terminate delivery execution |
| 33 | * |
| 34 | * @param $deliveryExecution |
| 35 | * @param $executionId |
| 36 | * @param bool $isEndDate |
| 37 | * @return mixed|void |
| 38 | * @throws \common_exception_Error |
| 39 | */ |
| 40 | protected function action($deliveryExecution, $executionId, $isEndDate = false) |
| 41 | { |
| 42 | $this->getDeliveryStateService()->terminateExecution($deliveryExecution, [ |
| 43 | 'reasons' => [ |
| 44 | 'category' => 'Technical' |
| 45 | ], |
| 46 | 'comment' => $isEndDate |
| 47 | ? 'The assessment was automatically terminated because end time expired.' |
| 48 | : 'The assessment was automatically terminated.' |
| 49 | ]); |
| 50 | $this->report->add(Report::createSuccess('Execution terminated with success:' . $executionId)); |
| 51 | } |
| 52 | } |