예제 #1
0
 /**
  *    Deletes row with specified id field.
  */
 public function testgetRowFromDbAsArrayById()
 {
     $this->BuildArray();
     // reset variables.
     $classInstance = new tutor\src\classes\GenericAClass();
     $result = $classInstance->deleteRowsNamed('Test');
     $mylocalArray['tG_AssignmentName'] = 'Test';
     $mylocalArray['tG_FormName'] = '510dummy_form.php';
     $result = $classInstance->insertRecord($mylocalArray);
     $row = $classInstance->getLastDbEntryAsArray();
     $row2 = $classInstance->getRowFromDbAsArrayById($row['id']);
     $this->assertTrue($row2['id'] === $row['id']);
     $this->assertTrue($row2['tG_AssignmentName'] === $row['tG_AssignmentName']);
     $this->assertTrue($row2['tG_FormName'] === $row['tG_FormName']);
     $result = $classInstance->deleteRowById($row2['id']);
     $this->assertTrue($result === 1);
     // clean up.
     // delete the record that was added.
     $r = $classInstance->deleteRowsNamed('Test');
     $this->assertTrue($r === 0);
     $this->BuildArray();
     // reset variables.
 }