Exemple #1
0
 /**
  * Test "returnColumnsNamesInArray" 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 testreturnColumnsNamesInArray()
 {
     $this->testbuildArray();
     // Reset myArray to original values.
     $classInstance = new tutor\src\classes\AssignmentsClass();
     $classInstance->insertRecord($this->myArray);
     $result = $classInstance->returnColumnsNamesInArray();
     $this->assertTrue(is_array($result));
     $columnNamesCount = count($result);
     $myArrayKeys = array_keys($this->myArray);
     $myArrayCount = count($myArrayKeys);
     $this->assertTrue($myArrayCount === $columnNamesCount);
     // Array_diff returns an array containing the differences.
     // it should have a count of 0.
     // Following two lines caused error when variable was elimintate
     // and count directly includend in test.  Probably timeing issue.
     $differenceBetweenArrays = count(array_diff($result, $myArrayKeys));
     $this->assertTrue($differenceBetweenArrays === 0);
     // Clean Up.
     $classInstance->delRowsByStudentId($this->myArray['tA_S_ID']);
 }