public function testGetProctorsAuthorization()
 {
     $testCenters = array('http://myTest.case#TestCenter1', 'http://myTest.case#TestCenter2', 'http://myTest.case#TestCenter3', 'http://myTest.case#TestCenter4', 'http://myTest.case#TestCenter5');
     $testCenters1 = array('http://myTest.case#TestCenter1', 'http://myTest.case#TestCenter2');
     $testCenters2 = array('http://myTest.case#TestCenter3', 'http://myTest.case#TestCenter4');
     $testCenters3 = array('http://myTest.case#TestCenter1', 'http://myTest.case#TestCenter4');
     $proctorClass = $this->proctorManagementService->getRootClass();
     $propertiesValues = array(ProctorManagementService::PROPERTY_AUTHORIZED_PROCTOR_URI => $testCenters1);
     $proctor1 = $proctorClass->createInstance('proctor1', '', 'http://myTest.case#proctor1');
     $proctor1->setPropertiesValues($propertiesValues);
     $propertiesValues = array(ProctorManagementService::PROPERTY_AUTHORIZED_PROCTOR_URI => $testCenters2);
     $proctor2 = $proctorClass->createInstance('proctor2', '', 'http://myTest.case#proctor2');
     $proctor2->setPropertiesValues($propertiesValues);
     $propertiesValues = array(ProctorManagementService::PROPERTY_AUTHORIZED_PROCTOR_URI => $testCenters3);
     $proctor3 = $proctorClass->createInstance('proctor3', '', 'http://myTest.case#proctor3');
     $proctor3->setPropertiesValues($propertiesValues);
     $authorization = $this->proctorManagementService->getProctorsAuthorization($testCenters);
     $this->assertCount(3, $authorization);
     $this->assertArrayHasKey($proctor1->getUri(), $authorization);
     $this->assertArrayHasKey($proctor2->getUri(), $authorization);
     $this->assertArrayHasKey($proctor3->getUri(), $authorization);
     $this->assertEquals($testCenters1, $authorization[$proctor1->getUri()], 'Proctor has not the right authorization', 0.0, 10, true);
     $this->assertEquals($testCenters2, $authorization[$proctor2->getUri()], 'Proctor has not the right authorization', 0.0, 10, true);
     $this->assertEquals($testCenters3, $authorization[$proctor3->getUri()], 'Proctor has not the right authorization', 0.0, 10, true);
     $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]);