/**
  * tests initialization
  */
 public function setUp()
 {
     \common_ext_ExtensionsManager::singleton()->getExtensionById('taoTestTaker');
     TaoPhpUnitTestRunner::initTest();
     $this->proctorManagementService = ProctorManagementService::singleton();
     //clean test resources
     $proctor1 = new \core_kernel_classes_Resource('http://myTest.case#proctor1');
     $proctor2 = new \core_kernel_classes_Resource('http://myTest.case#proctor2');
     $proctor3 = new \core_kernel_classes_Resource('http://myTest.case#proctor3');
     $proctor1->delete(true);
     $proctor2->delete(true);
     $proctor3->delete(true);
 }
 /**
  * Returns the proctor creation form
  */
 public function createProctorForm()
 {
     $myFormContainer = new AddProctor();
     $myForm = $myFormContainer->getForm();
     $valid = false;
     $created = false;
     $form = '';
     if ($myForm->isSubmited()) {
         $valid = $myForm->isValid();
         if ($valid) {
             $values = $myForm->getValues();
             $values[PROPERTY_USER_PASSWORD] = \core_kernel_users_Service::getPasswordHash()->encrypt($values['password1']);
             unset($values['password1']);
             unset($values['password2']);
             //force the new user role to be proctorRole
             $values[PROPERTY_USER_ROLES] = array('http://www.tao.lu/Ontologies/TAOProctor.rdf#ProctorRole');
             //@todo use a constant instead
             $proctor = $myFormContainer->getUser();
             $binder = new \tao_models_classes_dataBinding_GenerisFormDataBinder($proctor);
             $created = $binder->bind($values);
             if ($created) {
                 //assign then authorize the new proctor to the selected test centers
                 ProctorManagementService::singleton()->assignProctors(array($proctor->getUri()), SessionManager::getSession()->getUserUri());
                 $testCenters = $this->getRequestTestCenters();
                 if (!empty($testCenters)) {
                     ProctorManagementService::singleton()->authorizeProctors(array($proctor->getUri()), $testCenters);
                 }
             }
         } else {
             $form = $myForm->render();
         }
     } else {
         $form = $myForm->render();
     }
     $this->returnJson(array('form' => $form, 'valid' => $valid, 'created' => $created, 'loginId' => tao_helpers_Uri::encode(PROPERTY_USER_LOGIN), 'debug' => array('values' => $myForm->getValues())));
 }
    echo 'extension taoProctoring needs to be installed and enabled in order to run this script !';
    die;
}
foreach ($todefine as $contant => $value) {
    define($contant, $value);
}
$params = $argv;
array_shift($params);
$totalTtNum = isset($params[0]) ? $params[0] : 500;
$ttByProctor = isset($params[1]) && is_numeric($params[1]) && $params[1] !== 0 ? $params[1] : 20;
$totalProctorNum = $totalTtNum / $ttByProctor;
$totalProctorNum = $totalProctorNum < 1 ? 1 : $totalProctorNum;
$testTakerCrudService = oat\taoTestTaker\models\CrudService::singleton();
$userService = \tao_models_classes_UserService::singleton();
$testCenterService = \oat\taoProctoring\model\TestCenterService::singleton();
$proctorManagementService = \oat\taoProctoring\model\ProctorManagementService::singleton();
$testTakerService = \oat\taoTestTaker\models\TestTakerService::singleton();
$userClass = new \core_kernel_classes_Class(CLASS_TAO_USER);
//create delivery
$tests = [];
$testClazz = new core_kernel_classes_Class(TAO_TEST_CLASS);
foreach ($testClazz->getInstances(true) as $instance) {
    $tests[$instance->getUri()] = $instance->getLabel();
}
$testUris = array_keys($tests);
if (!empty($testUris)) {
    $i = 0;
    $delivery = null;
    $deliveryClass = new \core_kernel_classes_Class('http://www.tao.lu/Ontologies/TAODelivery.rdf#AssembledDelivery');
    while (is_null($delivery) && $i < count($testUris)) {
        $test = new core_kernel_classes_Resource($testUris[$i]);