Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
22.22% |
2 / 9 |
|
20.00% |
1 / 5 |
CRAP | |
0.00% |
0 / 1 |
| TraceVariableStored | |
22.22% |
2 / 9 |
|
20.00% |
1 / 5 |
22.94 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getDeliveryExecution | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| getState | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| getTraceData | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 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) 2015 (original work) Open Assessment Technologies SA; |
| 19 | * |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | namespace oat\taoQtiTest\models\event; |
| 24 | |
| 25 | use oat\oatbox\event\Event; |
| 26 | use oat\taoDelivery\model\execution\DeliveryExecution; |
| 27 | use oat\taoDelivery\model\execution\ServiceProxy; |
| 28 | |
| 29 | /** |
| 30 | * Event should be triggered after storing test trace variable |
| 31 | * |
| 32 | */ |
| 33 | class TraceVariableStored implements Event |
| 34 | { |
| 35 | private $deliveryExecutionId; |
| 36 | private $traceData; |
| 37 | |
| 38 | private $deliveryExecution; |
| 39 | |
| 40 | /** |
| 41 | * DeliveryExecutionState constructor. |
| 42 | * @param $deliveryExecutionId |
| 43 | */ |
| 44 | public function __construct($deliveryExecutionId, $traceData) |
| 45 | { |
| 46 | $this->deliveryExecutionId = $deliveryExecutionId; |
| 47 | $this->traceData = $traceData; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * @return DeliveryExecution |
| 52 | */ |
| 53 | public function getDeliveryExecution() |
| 54 | { |
| 55 | if (is_null($this->deliveryExecution)) { |
| 56 | $this->deliveryExecution = ServiceProxy::singleton()->getDeliveryExecution($this->deliveryExecutionId); |
| 57 | } |
| 58 | return $this->deliveryExecution; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * @return string |
| 63 | */ |
| 64 | public function getState() |
| 65 | { |
| 66 | $deliveryExecution = $this->getDeliveryExecution(); |
| 67 | return $deliveryExecution->getState()->getUri(); |
| 68 | } |
| 69 | |
| 70 | public function getTraceData() |
| 71 | { |
| 72 | return $this->traceData; |
| 73 | } |
| 74 | |
| 75 | |
| 76 | /** |
| 77 | * @return string |
| 78 | */ |
| 79 | public function getName() |
| 80 | { |
| 81 | return __CLASS__; |
| 82 | } |
| 83 | } |