/** * Test test "normalizePercentTimeTo100Percent()" in Assignments.class.inc. */ public function testgetAssignmentsByStudentId() { $this->resetMyArray(); // Reset myArray to origninal values. $ac_class_instance = new AssignmentsClass(); $result = $ac_class_instance->delRowsByStudentId($this->myArray['tA_S_ID']); $this->assertTrue($result === 0, 'If this test fails a previous test has not cleaned up.'); $result = $ac_class_instance->delRowsByStudentId('getAssignmentsByStudentID'); // Catch other tests sloppy cleanup. $this->myArray['tA_S_ID'] = 'getAssignmentsByStudentID'; $result = $ac_class_instance->insertRecord($this->myArray); $this->assertTrue($result === 1); $rows = $ac_class_instance->getAssignmentsByStudentID('getAssignmentsByStudentID'); $this->assertTrue(is_array($rows)); $this->assertTrue(count($rows) === 1); // Now add another lesson and see if two come back. $result = $ac_class_instance->insertRecord($this->myArray); $rows = $ac_class_instance->getAssignmentsByStudentID('getAssignmentsByStudentID'); $this->assertTrue(is_array($rows)); $this->assertTrue(count($rows) === 2); $result2 = $ac_class_instance->delRowsByStudentId('getAssignmentsByStudentID'); // Line above returns # of rows deleted. $ac_class_instance->delRowsByStudentId($this->myArray['tA_S_ID']); $this->assertTrue($result2 == 2); $this->resetMyArray(); // Reset myArray to origninal values. }