/** * Test "checkAndProcessSplits()" in Assignments.class.php. */ public function testcheckAndProcessSplits() { // Add two splits. $my_array1['tSp_id'] = '1111'; $my_array1['tSp_LessonName'] = 'split_1'; $my_array1['tSp_gA'] = 'tG_1'; $my_array1['tSp_PercentTime'] = '10'; $this->assertTrue(count($my_array1) === 4); $my_array2['tSp_id'] = '1112'; $my_array2['tSp_LessonName'] = 'split_2'; $my_array2['tSp_gA'] = 'tG_2'; $my_array2['tSp_PercentTime'] = '20'; $this->assertTrue(count($my_array2) === 4); $split_instance = new SplitsClass(); // Next insert into db. $split_instance->deleteRowId($my_array1['tSp_id']); $split_instance->insertRow($my_array1); $split_instance->deleteRowId($my_array2['tSp_id']); $split_instance->insertRow($my_array2); // Check to see if they exist. $row = $split_instance->getSplitByPrimaryKey($my_array1['tSp_id']); // Next check to see what is in $row. $this->assertTrue($row['tSp_id'] === '1111'); // Note that id is a string. $row = $split_instance->getSplitByPrimaryKey($my_array2['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. echo "Splits not working."; // print_r( "Splits not working.\n");. $split_instance->deleteRowId($my_array1['tSp_id']); $split_instance->deleteRowId($my_array2['tSp_id']); $this->resetMyArray(); }
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 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; }