/** * Test "returnColumnsNamesInArray" in Assignments.class.inc. * * Just test function returnColumnsNamesInArray. */ public function testreturnColumnsNamesInArray() { $this->resetMyArray(); // Reset myArray to original values. $ac_class_instance = new AssignmentsClass(); $ac_class_instance->insertRecord($this->myArray); $result = $ac_class_instance->returnColumnsNamesInArray(); $this->assertTrue(is_array($result)); $column_names_count = count($result); $my_array_keys = array_keys($this->myArray); $my_array_count = count($my_array_keys); $this->assertTrue($my_array_count === $column_names_count); // 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. $difference_between_arrays = count(array_diff($result, $my_array_keys)); $this->assertTrue($difference_between_arrays === 0); // Clean Up. $ac_class_instance->delRowsByStudentId($this->myArray['tA_S_ID']); $this->resetMyArray(); }