Ejemplo n.º 1
0
 function testShiftModule()
 {
     $noonshift = new Shift("08-03-28:1-5", "house", 3, array(), array(), "", "");
     $this->assertEqual($noonshift->get_hours(), "1-5");
     $this->assertTrue($noonshift->get_id() == "08-03-28:1-5:house");
     $this->assertEqual($noonshift->get_yy_mm_dd(), "08-03-28");
     // Test new function for resetting shift's start/end time
     $this->assertTrue($noonshift->get_start_time() == 13);
     $this->assertEqual($noonshift->get_end_time(), 17);
     // Be sure that invalid times are caught.
     $this->assertFalse($noonshift->set_start_end_time(13, 12));
     $this->assertTrue($noonshift->get_id() == "08-03-28:1-5:house");
     $this->assertTrue($noonshift->get_hours() == "1-5");
     $this->assertTrue($noonshift->num_vacancies() == 3);
     $this->assertTrue($noonshift->get_day() == "Fri");
     $this->assertFalse($noonshift->has_sub_call_list());
     $persons = array();
     $persons[] = "alex1234567890+alex+jones";
     $noonshift->assign_persons($persons);
     $noonshift->ignore_vacancy();
     $persons[] = "malcom1234567890+malcom+jones";
     $noonshift->assign_persons($persons);
     $noonshift->ignore_vacancy();
     $persons[] = "nat1234567890+nat+jones";
     $noonshift->assign_persons($persons);
     $noonshift->ignore_vacancy();
     $this->assertTrue($noonshift->num_vacancies() == 0);
     $noonshift->add_vacancy();
     $this->assertTrue($noonshift->num_slots() == 4);
     $noonshift->ignore_vacancy();
     $this->assertTrue($noonshift->num_slots() == 3);
     $noonshift->set_notes("Hello 1-5 shift!");
     $this->assertTrue($noonshift->get_notes() == "Hello 1-5 shift!");
     echo "testShift complete";
 }