/** * Deletes row with specified id field. */ public function testdeleteRowById() { $this->BuildArray(); // reset variables. $classInstance = new tutor\src\classes\GenericAClass(); $this->assertTrue(isset($classInstance)); //Can't depend on the new record not supplying own id. Can't use line above. $mylocalArray['tG_AssignmentName'] = 'Test'; $mylocalArray['tG_FormName'] = '537dummy_form.php'; $results = $classInstance->deleteRowsNamed($mylocalArray['tG_AssignmentName']); $this->myArray['tG_AssignmentName'] = 'xyx'; $result = $classInstance->insertRecord($mylocalArray); // get record back and use id. $row = $classInstance->getLastDbEntryAsArray(); $this->assertTrue($row['tG_AssignmentName'] === 'Test'); $this->assertTrue($row['tG_FormName'] === '537dummy_form.php'); $results = $classInstance->deleteRowById($row['id']); $this->assertTrue($results === 1); $result = $classInstance->deleteRowsNamed("Test"); // clean up. // delete the record that was added. $r = $classInstance->deleteRowsNamed('Test'); $this->assertTrue($r === 0); $this->BuildArray(); // reset variables. }