コード例 #1
0
 /**
  * Run thread
  */
 public function run()
 {
     require_once dirname(__FILE__) . '/../../../../tao/includes/raw_start.php';
     $deliveryExecution = $this->getDeliveryExecution();
     $data = [MonitorCacheService::COLUMN_TEST_TAKER => 'test_taker_id', MonitorCacheService::COLUMN_STATUS => 'active'];
     $secondaryData = ['a' => '0', 'b' => '1', 'c' => '2', 'd' => '3', 'e' => '4', 'f' => '5', 'g' => '6', 'h' => '7', 'i' => '8', 'j' => '9', 'k' => '10', 'l' => '11', 'm' => '12', 'n' => '13', 'o' => '14', 'p' => '15', 'q' => '16', 'r' => '17', 's' => '18', 't' => null];
     $dataModel = new DeliveryMonitoringData($deliveryExecution);
     foreach ($data as $key => $val) {
         $dataModel->addValue($key, $val);
     }
     usleep(rand(10000, 1500000));
     $this->service->save($dataModel);
     foreach ($secondaryData as $secKey => $secVal) {
         $dataModel->addValue($secKey, $secVal);
     }
     try {
         $this->service->save($dataModel);
         $dataModel->addValue('u', '20');
         $dataModel->addValue('a', '21', true);
         $this->service->save($dataModel);
     } catch (\Exception $e) {
         var_dump($e->getMessage());
         $this->failed = true;
     }
 }
 protected function loadFixture()
 {
     $this->setUp();
     $data = [[DeliveryMonitoringService::COLUMN_DELIVERY_EXECUTION_ID => 'http://sample/first.rdf#i1450191587554175_test_record', DeliveryMonitoringService::COLUMN_TEST_TAKER => 'test_taker_1', DeliveryMonitoringService::COLUMN_STATUS => 'active_test', PROPERTY_DELVIERYEXECUTION_SUBJECT => 'http://sample/first.rdf#i1450191587554175_test_user', 'error_code' => 1, 'session_id' => 'i1450191587554175'], [DeliveryMonitoringService::COLUMN_DELIVERY_EXECUTION_ID => 'http://sample/first.rdf#i1450191587554176_test_record', DeliveryMonitoringService::COLUMN_TEST_TAKER => 'test_taker_2', DeliveryMonitoringService::COLUMN_STATUS => 'paused_test', PROPERTY_DELVIERYEXECUTION_SUBJECT => 'http://sample/first.rdf#i1450191587554176_test_user', 'error_code' => 2, 'session_id' => 'i1450191587554176'], [DeliveryMonitoringService::COLUMN_DELIVERY_EXECUTION_ID => 'http://sample/first.rdf#i1450191587554177_test_record', DeliveryMonitoringService::COLUMN_TEST_TAKER => 'test_taker_3', DeliveryMonitoringService::COLUMN_STATUS => 'finished_test', PROPERTY_DELVIERYEXECUTION_SUBJECT => 'http://sample/first.rdf#i1450191587554177_test_user', 'error_code' => 3, 'session_id' => 'i1450191587554177'], [DeliveryMonitoringService::COLUMN_DELIVERY_EXECUTION_ID => 'http://sample/first.rdf#i1450191587554178_test_record', DeliveryMonitoringService::COLUMN_TEST_TAKER => 'test_taker_4', DeliveryMonitoringService::COLUMN_STATUS => 'finished_test', PROPERTY_DELVIERYEXECUTION_SUBJECT => 'http://sample/first.rdf#i1450191587554178_test_user', 'error_code' => 0, 'session_id' => 'i1450191587554178']];
     foreach ($data as $item) {
         $dataModel = new DeliveryMonitoringData($this->getDeliveryExecution($item[DeliveryMonitoringService::DELIVERY_EXECUTION_ID]));
         foreach ($item as $key => $val) {
             $dataModel->addValue($key, $val);
         }
         $this->service->save($dataModel);
     }
     return [[$data]];
 }