/** * Test test "normalizePercentTimeTo100Percent()" 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 testgetAssignmentsByStudentID() { $this->testbuildArray(); // reset myArray to origninal values. $classInstance = new tutor\src\classes\AssignmentsClass(); $result = $classInstance->delRowsByStudentId($this->myArray['tA_S_ID']); $this->assertTrue($result === 0, 'If this test fails a previous test has not cleaned up.'); $result = $classInstance->delRowsByStudentId('getAssignmentsByStudentID'); // Catch other tests sloppy cleanup. $this->myArray['tA_S_ID'] = 'getAssignmentsByStudentID'; $result = $classInstance->insertRecord($this->myArray); $this->assertTrue($result === 1); $rows = $classInstance->getAssignmentsByStudentID('getAssignmentsByStudentID'); $this->assertTrue(is_array($rows)); $this->assertTrue(count($rows) === 1); // now add another lesson and see if two come back $result = $classInstance->insertRecord($this->myArray); $rows = $classInstance->getAssignmentsByStudentID('getAssignmentsByStudentID'); $this->assertTrue(is_array($rows)); $this->assertTrue(count($rows) === 2); $result2 = $classInstance->delRowsByStudentId('getAssignmentsByStudentID'); // line above returns # of rows deleted. $classInstance->delRowsByStudentId($this->myArray['tA_S_ID']); $this->assertTrue($result2 == 2); $this->testbuildArray(); // reset myArray to origninal values. }