date_default_timezone_set('UTC');
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if (session_status() === PHP_SESSION_NONE) {
    session_start();
}
session_regenerate_id(TRUE);
session_destroy();
session_start();
// Must get tA_id for the lesson to be tested.
require_once "../test_lesson_include.php";
$_SESSION['tA_S_ID'] = "zxcvb";
$_SESSION['tA_StartRec'] = 1;
$class_instance = new AssignmentsClass();
$class_instance->delRowsByStudentId($_SESSION['tA_S_ID']);
$target_assignment_name = 'gA_clockwise_counterclockwise';
// $secondary_assignment_name = 'gA_left_right_blocks';.
$lessons_to_ta = array(array('ga' => 'gA_left_right_blocks', 'tA_PostDateIncrement' => 0), array('ga' => 'gA_typing_lessons_cl', 'tA_PostDateIncrement' => 0), array('ga' => 'gA_spelling', 'tA_PostDateIncrement' => 0), array('ga' => 'gA_horizontal_vertical_diagonal', 'tA_PostDateIncrement' => 0), array('ga' => 'gA_one_digit_addition_vertical_clues', 'tA_PostDateIncrement' => 0), array('ga' => 'gA_clockwise_counterclockwise', 'tA_PostDateIncrement' => 2));
foreach ($lessons_to_ta as $v1) {
    $_SESSION['tG_AssignmentName'] = $v1["ga"];
    $_SESSION['tA_PostDateIncrement'] = $v1['tA_PostDateIncrement'];
    $_SESSION['tA_Post_date'] = round(microtime(TRUE), 3, PHP_ROUND_HALF_EVEN) + $_SESSION['tA_PostDateIncrement'];
    $result = $class_instance->insertRecord($_SESSION);
}
$result = $class_instance->getSpecificStudentAssignmentFromDbAsArray($_SESSION['tA_S_ID'], $target_assignment_name, $_SESSION['tA_StartRec']);
// Echo $_SESSION['tG_AssignmentName'];.
$_SESSION['tA_id'] = $result['tA_id'];
// Echo $_SESSION['tA_id'];
// Load the lesson to test.
require 'clockwise_counterclockwise.php';
 /**
  * Test test "normalizePercentTimeTo100Percent()" in Assignments.class.inc.
  */
 public function testgetSpecificStudentAssignmentFromDbAsArray()
 {
     $this->resetMyArray();
     // Reset myArray to origninal values.
     $ac_class_instance = new AssignmentsClass();
     $result = $ac_class_instance->delRowsByStudentId($this->myArray['tA_S_ID']);
     $this->assertTrue($result === 0);
     $this->myArray['tA_S_ID'] = 'ghghgh';
     $this->myArray['tG_AssignmentName'] = 'TestAssignment';
     $this->myArray['tA_StartRec'] = '77';
     $result = $ac_class_instance->delRowsByStudentId('ghghgh');
     // Insure clean start.
     $this->assertTrue($result === 0);
     $result = $ac_class_instance->insertRecord($this->myArray);
     $this->assertTrue($result === 1);
     $row = $ac_class_instance->getSpecificStudentAssignmentFromDbAsArray('ghghgh', $this->myArray['tG_AssignmentName'], $this->myArray['tA_StartRec']);
     $this->assertTrue(is_array($row));
     $this->assertTrue($row['tA_S_ID'] === 'ghghgh');
     $this->assertTrue($row['tG_AssignmentName'] === 'TestAssignment');
     $this->assertTrue($row['tA_StartRec'] === '77');
     $ac_class_instance->delRowsByStudentId('ghghgh');
     $ac_class_instance->delRowsByStudentId($this->myArray['tA_S_ID']);
 }