예제 #1
0
 /**
  * Test test "compare()" in Assignments.class.inc
  *
  * A *description*, that can span multiple lines, to go _in-depth_ into the details of this element
  * and to provide some background information or textual references.
  *
  * @return void
  */
 public function testcompare()
 {
     // Must send it three structured arrays of lessons. One with more than
     // 100% assigned and the other with less and one exact.
     // Should return 0 for equal.  -1 for greater than and 1 for less than.
     $x['tA_PercentTime'] = 0;
     $y['tA_PercentTime'] = 110;
     $z['tA_PercentTime'] = 100;
     $classInstance = new tutor\src\classes\AssignmentsClass();
     $test1 = $classInstance->compare($x, $x);
     $this->assertTrue($test1 === 0);
     // Equal returns 0.
     $test2 = $classInstance->compare($y, $z);
     $this->assertTrue($test2 === -1);
     // Greater returns -1.
     $test3 = $classInstance->compare($z, $y);
     // Less than returns 1.
     $this->assertTrue($test3 === 1);
 }