/** * Gets and returns all of the generic assignments. */ public function testgetAllAssignmentNamesFromDbArray() { //$logFile = fopen("/var/www/jimfuqua/tutor/logs/testgetAllAssignmentNamesFromDbArray.log", "w"); //$string = "\n".__LINE__.' testgetAllAssignmentNamesFromDbArray'."\n"; //fwrite ($logFile, $string); $this->BuildArray(); // reset variables. $classInstance = new tutor\src\classes\GenericAClass(); $classInstance->deleteRowsNamed($this->myArray['tG_AssignmentName']); $classInstance->deleteRowsNamed('Test0'); // Add one row to insure at least one record. $this->myArray['tG_AssignmentName'] = 'Test22'; $result = $classInstance->insertRecord($this->myArray); $this->assertTrue($result === 1); // Get number of rows. Then add two rows. // Get number of rows again and check for increase of two rows. //$string = "\n".__LINE__.' testgetAllAssignmentNamesFromDbArray'."\n"; //fwrite ($logFile, $string); $assignments = $classInstance->getAllAssignmentNamesFromDbArray(); //echo var_export($assignments, true); $this->assertTrue(is_array($assignments)); $count1 = count($assignments); $initial_count = $count1; $this->myArray['tG_AssignmentName'] = 'Test1'; $result = $classInstance->insertRecord($this->myArray); $string = "\n" . __LINE__ . ' testgetAllAssignmentNamesFromDbArray' . "\n"; $assignments2 = $classInstance->getAllAssignmentNamesFromDbArray(); $count2 = count($assignments2); $count_after_adding_one = $count2; //echo "count1 =".$count1."\n"; //echo "count2 =".$count2; $this->assertTrue($count2 - $initial_count === 1); $this->myArray['tG_AssignmentName'] = 'Test2'; $this->myArray['id'] = '3'; $result = $classInstance->insertRecord($this->myArray); $this->assertTrue($result === 1); $result = $assignments3 = $classInstance->getAllAssignmentNamesFromDbArray(); $count3 = count($assignments3); $this->assertTrue($count3 - $initial_count === 2); // Clean up. $classInstance->deleteRowsNamed("Test"); $classInstance->deleteRowsNamed("Test0"); $classInstance->deleteRowsNamed("Test1"); $classInstance->deleteRowsNamed("Test2"); $classInstance->deleteRowsNamed("Test3"); $classInstance->deleteRowsNamed("Test22"); //$classInstance->deleteRowsNamed("xx"); $this->BuildArray(); // reset variables. }