Example #1
0
             }
             $id = CreateTest($test, $test['url']);
             if (isset($id)) {
                 $spofTests[] = $id;
             }
         }
     }
 } else {
     if ($test['batch_locations'] && count($test['multiple_locations'])) {
         $test['id'] = CreateTest($test, $test['url'], 0, 1);
         $test['batch_id'] = $test['id'];
         $test['tests'] = array();
         foreach ($test['multiple_locations'] as $location_string) {
             $testData = $test;
             // Create a test with the given location and applicable connectivity.
             UpdateLocation($testData, $locations, $location_string);
             $id = CreateTest($testData, $testData['url']);
             if (isset($id)) {
                 $test['tests'][] = array('url' => $test['url'], 'id' => $id);
             }
         }
         // write out the list of urls and the test ID for each
         if (count($test['tests'])) {
             $path = GetTestPath($test['id']);
             file_put_contents("./{$path}/tests.json", json_encode($test['tests']));
         } else {
             $error = 'Locations could not be submitted for testing';
         }
     } elseif ($test['batch']) {
         // build up the full list of urls
         $bulk = array();
Example #2
0
             }
             $id = CreateTest($test, $test['url']);
             if (isset($id)) {
                 $spofTests[] = $id;
             }
         }
     }
 } else {
     if ($test['batch_locations'] && count($test['multiple_locations'])) {
         $test['id'] = CreateTest($test, $test['url'], 0, 1);
         $test['batch_id'] = $test['id'];
         $test['tests'] = array();
         foreach ($test['multiple_locations'] as $location_string) {
             $testData = $test;
             // Create a test with the given location and applicable connectivity.
             UpdateLocation($testData, $locations, $location_string, $error);
             if (strlen($error)) {
                 break;
             }
             $id = CreateTest($testData, $testData['url']);
             if (isset($id)) {
                 $test['tests'][] = array('url' => $test['url'], 'id' => $id);
             }
         }
         // write out the list of urls and the test ID for each
         if (!strlen($error)) {
             if (count($test['tests'])) {
                 $path = GetTestPath($test['id']);
                 file_put_contents("./{$path}/tests.json", json_encode($test['tests']));
             } else {
                 $error = 'Locations could not be submitted for testing';