/** * Test "checkAndProcessSplits()" 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 testcheckAndProcessSplits() { // Add two splits. $myArray1['tSp_id'] = '1111'; $myArray1['tSp_LessonName'] = 'split_1'; $myArray1['tSp_gA'] = 'tG_1'; $myArray1['tSp_PercentTime'] = '10'; $this->assertTrue(count($myArray1) === 4); $myArray2['tSp_id'] = '1112'; $myArray2['tSp_LessonName'] = 'split_2'; $myArray2['tSp_gA'] = 'tG_2'; $myArray2['tSp_PercentTime'] = '20'; $this->assertTrue(count($myArray2) === 4); $splitInstance = new tutor\src\classes\SplitsClass(); // Next insert into db. $splitInstance->deleteRowId($myArray1['tSp_id']); $splitInstance->insertRow($myArray1); $splitInstance->deleteRowId($myArray2['tSp_id']); $splitInstance->insertRow($myArray2); // Check to see if they exist. $row = $splitInstance->getSplitByPrimaryKey($myArray1['tSp_id']); // Next check to see what is in $row. $this->assertTrue($row['tSp_id'] === '1111'); // Note that id is a string. $row = $splitInstance->getSplitByPrimaryKey($myArray2['tSp_id']); // Next check to see what is in $row. $this->assertTrue($row['tSp_id'] === '1112'); // Note that id is a string. // Clean up database. $splitInstance->deleteRowId($myArray1['tSp_id']); $splitInstance->deleteRowId($myArray2['tSp_id']); }
function testget_split_by_ID() { $result = $this->testbuildArray(); // reset myArray to origninal values. $temp_storage = $this->myArray['tSp_id']; $this->myArray['tSp_id'] = '779'; $classInstance = new tutor\src\classes\SplitsClass(); $classInstance->deleteSplitLessonName($this->myArray['tSp_LessonName']); $classInstance->insertRow($this->myArray); $row = $classInstance->getSplitByPrimaryKey('779'); // Returns a row -- array. $this->assertTrue($row['tSp_id'] === '779'); $result = $classInstance->deleteSplitLessonName($this->myArray['tSp_LessonName']); $this->myArray['tSp_id'] = $temp_storage; }