Exemplo n.º 1
0
 public static function run()
 {
     $class = get_called_class();
     TEST($class, "{$class}.student.saveEditSubmitAndDelete", function ($class) {
         // Create job
         global $MJob;
         $jobId = new MongoId($MJob->save([], false));
         $studentId = new MongoId();
         // make sure saving an application for a job with no application
         // fails
         EQ(null, ApplicationStudent::save($jobId, $studentId, []));
         // create application for job
         $questionId = new MongoId();
         $questions = [$questionId];
         ApplicationJob::createOrUpdate($jobId, $questions);
         $answers = [['_id' => $questionId, 'answer' => 'swag']];
         $firstApplication = ApplicationStudent::save($jobId, $studentId, $answers);
         NEQ(null, $firstApplication);
         $applicationId = $firstApplication->getId();
         NEQ(null, $firstApplication->getQuestions());
         EQ('swag', $firstApplication->getQuestions()[0]['answer']);
         // edit application
         ApplicationStudent::edit($applicationId, [['_id' => $questionId, 'answer' => 'qswag']]);
         $editedApplication = ApplicationModel::getSavedForJob($jobId)[0];
         EQ('qswag', $editedApplication['questions'][0]['answer']);
         // submit application
         TRUE(ApplicationStudent::submitSaved($applicationId));
         TRUE(ApplicationModel::checkSubmitted($applicationId));
         // submit new application
         $secondStudent = new MongoId();
         $secondApplication = ApplicationStudent::submitNew($jobId, $secondStudent, $answers);
         TRUE(ApplicationModel::checkSubmitted($secondApplication->getId()));
         // create, save, and delete application
         $thirdStudent = new MongoId();
         $applicationToDelete = ApplicationStudent::save($jobId, $thirdStudent, $answers)->getId();
         TRUE(ApplicationModel::applicationExists($jobId, $thirdStudent));
         TRUE(ApplicationStudent::deleteSaved($applicationToDelete));
     });
     TEST($class, "{$class}.student.getUnclaimedAndClaimed", function ($class) {
         TRUE(false, 'TODO: Write test');
     });
     TEST($class, "{$class}.job.createOrUpdate", function ($class) {
         // Try to create/update application for nonexistent job
         FALSE(ApplicationJob::createOrUpdate(new MongoId(), []));
         // Create job
         global $MJob;
         $jobId = new MongoId($MJob->save([], false));
         // Try to create application for job
         $oldQuestionId = new MongoId();
         $oldQuestions = [$oldQuestionId];
         TRUE(ApplicationJob::createOrUpdate($jobId, $oldQuestions));
         EQ($MJob::getApplicationQuestionIds($jobId), $oldQuestions);
         // Try to change one question in application for job
         $newQuestionId = new MongoId();
         $newQuestions = [$newQuestionId];
         TRUE(ApplicationJob::createOrUpdate($jobId, $newQuestions));
         EQ($MJob::getApplicationQuestionIds($jobId), $newQuestions);
         TRUE(false, 'TODO: Check to make sure student applications are updated right.');
     });
 }
Exemplo n.º 2
0
 public function add_receipt($receipt_data)
 {
     //new receipt
     $receipt = new Receipt();
     // get data
     $receipt->get_data_from_array($receipt_data);
     TEST($receipt->json_encode(false));
     //compute the sequence of sql to add this receipt to db
     $comma_seperated_list = $receipt->get_seperated_list();
     TEST($comma_seperated_list);
     //mysqli_query($this->db, "CALL test('$comma_seperated_list');");
 }
Exemplo n.º 3
0
 public static function run()
 {
     $class = get_called_class();
     TEST($class, "{$class}.correctCollection", function () {
         $actualCollection = StudentModel::myCollection();
         $correctCollection = 'emails';
         EQ($actualCollection, $correctCollection, "Collection name invalid: {$actualCollection}");
     });
     TEST($class, "{$class}.save", function () {
         $id = self::$MStudentTest->save(array());
         TRUE(self::$MStudentTest->exists($id));
     });
 }
Exemplo n.º 4
0
 public static function run()
 {
     $class = get_called_class();
     TEST($class, "{$class}.construct", function ($class) {
         $data = ['education' => [['school' => 'Yale University', 'class' => '2017', 'degree' => 'BS', 'dates' => ['start' => strtotime('August 2013')]]], 'experience' => [['title' => 'Intern', 'company' => 'Random Company', 'dates' => ['start' => strtotime('March 2017')]]], 'extracurriculars' => [['title' => 'Captain', 'organization' => 'Random Club', 'dates' => ['start' => strtotime('April 2012')]]], 'awards' => [['name' => 'random award']], 'projects' => [['name' => 'Random Project']]];
         $studentId = new MongoId();
         $student = new StudentProfile($studentId, $data);
         EQ($studentId, $student->getStudentId());
         EQ(null, $student->getEducation(1));
         $education = $student->getEducation(0);
         $educationStart = $education['dates']['start']->toDateTime()->getTimeStamp();
         EQ(strtotime('August 2013'), $educationStart);
     });
 }
Exemplo n.º 5
0
 public static function run()
 {
     $class = get_called_class();
     TEST($class, "{$class}.parseRawData", function ($class) {
         $data1 = array('_id' => new MongoId(), 'text' => 'randomtext', 'recruiter' => new MongoId(), 'uses' => array(new MongoId(), new MongoId()), 'vanilla' => true);
         $data2 = array('_id' => new MongoId(), 'text' => 'randomtext2', 'recruiter' => new MongoId(), 'uses' => array(new MongoId(), new MongoId()), 'vanilla' => false);
         $dataList = array($data1, $data2);
         $res = $class::callPrivateMethod('Question', 'parseRawData', $dataList);
         EQ(count($res), 2);
         $q1 = $res[0];
         $q2 = $res[1];
         EQ($q1->getData(), $data1);
         EQ($q2->getData(), $data2);
     });
     TEST($class, "{$class}.createVanilla", function () {
         $text = 'random text haha';
         $question = Question::createVanilla($text);
         EQ($text, $question->getText(), "Wrong text");
         EQ(null, $question->getRecruiter(), "Recruiter should be null");
         EQ(true, $question->getVanilla(), "Not vanilla");
         NEQ(null, $question->getId(), "_id not null");
         $vanillas = Question::getAllVanilla();
         EQ(count($vanillas), 1, "Wrong vanilla count");
         $question2 = $vanillas[0];
         EQ($question->getData(), $question2->getData(), "Data doesn't match");
     });
     TEST($class, "{$class}.createCustom", function () {
         $question = Question::createCustom('randomtext', new MongoId());
         $id = $question->getId();
         $vanillas = Question::getAllVanilla();
         EQ(count($vanillas), 0, "Wrong vanilla count");
         $res = Question::getById($id);
         NEQ($res, null);
     });
     TEST($class, "{$class}.searchCustom", function () {
         $text1 = 'Give an example of where you\'ve been able to use your ' . 'leadership skills.';
         $text2 = 'Where do you see yourself in five years?';
         $text3 = 'What are your salary expectations?';
         $text4 = 'What are your strengths and weaknesses?';
         $id = [Question::createCustom($text1, new MongoId())->getId(), Question::createCustom($text2, new MongoId())->getId(), Question::createCustom($text3, new MongoId())->getId(), Question::createCustom($text4, new MongoId())->getId()];
         $res = Question::searchCustom('example years salary strength');
         EQ(4, count($res));
         $res = Question::searchCustom('strengths and weaknesses skills');
         EQ($id[3], $res[0]->getId());
         $res = Question::searchCustom('leadership skills weaknesses');
         EQ($id[0], $res[0]->getId());
     });
 }
Exemplo n.º 6
0
				
					<label for="email" class="form_col">E-mail <span style="color:#DBA901;">* </span>:</label>
					<input type="text" name="email" id="email" placeholder="exemple : adresse@mail.com" /><?php 
TEST(3);
?>
					<span class="tooltip">Cette adresse mail n'est pas valide</span>
					<br/>
				
					<label for="objet" class="form_col">Objet  :</label>
					<input type="text" name="objet" id="objet" />
					<br/>
					
					<label for="contenu_email" class="form_col">Message <span style="color:#DBA901;">* </span>:</label>
					<textarea name="contenu_email" id="contenu_email"  ></textarea>
					<?php 
TEST(4);
?>
				</br>
			<input style="color:#000000;" type="submit" name="submit" value="Envoyer" />
		
  </form>
  <p><span style="color:#DBA901;"><b> * ce champ est obligatoire </b></p>
  </div>
 <?php 
$erreur = 0;
if (isset($_POST["submit"])) {
    if (isset($_POST['nom']) and !empty($_POST['nom'])) {
        if (isset($_POST['prenom']) and !empty($_POST['prenom'])) {
            if (isset($_POST['email']) and !empty($_POST['email'])) {
                if (isset($_POST['contenu_email']) and !empty($_POST['contenu_email'])) {
                    $nom = $_POST['nom'];
 public function sql_insert_values_recursive($value_array)
 {
     if (!is_array($value_array)) {
         $value_array = array($value_array);
     }
     TEST($value_array);
     foreach ($value_array as $key => $value) {
         $this->sql_insert_values($value);
         $this->query .= ', ';
     }
     $len = strlen($this->query) - 2;
     $this->query = substr($this->query, 0, $len) . ' ';
     return $this;
 }
Exemplo n.º 8
0
include 'ezpdf/class.ezpdf.php';
//$strConnection = "Provider=OraOLEDB.Oracle; Data Source=GEO;User Id=gbi; Password=zomer;";
//$conn = new COM("ADODB.Connection") or die("Kan ADODB niet gebruiken");
//$conn->Open($strConnection);
if (isset($_GET['e'])) {
    $e = $_GET['e'];
    //$_SESSION["PDF"] = TRUE;
}
if (isset($_GET['p'])) {
    $p = $_GET['p'];
}
if (isset($e)) {
    switch ($e) {
        case "@TEST":
            TEST();
            break;
        case "@SVG":
            SVG();
            break;
        case "@WELK":
            WELK();
            break;
        case "@SOORT":
            SOORT($p);
            break;
    }
} else {
    BASIS();
}
function WELK()