public function testInvalidCreatorRobotDataCreate()
 {
     $validRobotName = "TARS";
     $invalidCreators = array("-2");
     $validStatus = "in-development";
     $s1 = new RobotData(array("robot_name" => $validRobotName, "creators" => $invalidCreators, "status" => $validStatus));
     $this->assertTrue(!empty($s1->getError('creator')) && strcmp(Messages::getError('ROBOT_CREATOR_INVALID'), $s1->getError('creator')) == 0, 'It should have a creator error if the creator id is invalid');
 }
 public static function getRobotDataArray($rowSets)
 {
     $robotsData = array();
     if (!empty($rowSets)) {
         foreach ($rowSets as $robotDataRow) {
             $robotDataRow['creators'] = RobotAssocsDB::getRobotAssocValuesBy('robotId', $robotDataRow['robotId'], "creatorId");
             $robotData = new RobotData($robotDataRow);
             $robotId = $robotDataRow['robotId'];
             $robotData->setRobotId($robotId);
             array_push($robotsData, $robotData);
         }
     }
     return $robotsData;
 }
 public static function updateRobotData()
 {
     $robotDataArray = RobotDataDB::getRobotDataBy('robotId', $_SESSION['arguments']);
     if (empty($robotDataArray)) {
         HomeView::show();
         header('Location: /' . $_SESSION['base']);
     } elseif ($_SERVER["REQUEST_METHOD"] == "GET") {
         $_SESSION['robotData'] = $robotDataArray[0];
         RobotDataView::showUpdate();
     } else {
         $robotData = $robotDataArray[0];
         $parms = $robotData->getParameters();
         $parms['robot_name'] = array_key_exists('robot_name', $_POST) ? $_POST['robot_name'] : "";
         $parms['status'] = array_key_exists('status', $_POST) ? $_POST['status'] : "";
         $parms['creators'] = array_key_exists('creators', $_POST) ? $_POST['creators'] : array();
         $revisedRobotData = new RobotData($parms);
         $revisedRobotData->setRobotId($robotData->getRobotId());
         $robotDataEntry = RobotDataDB::updateRobotData($revisedRobotData);
         if ($robotDataEntry->getErrorCount() != 0) {
             $_SESSION['robotData'] = array($revisedRobotData);
             RobotDataView::showUpdate();
         } else {
             HomeView::show();
             header('Location: /' . $_SESSION['base']);
         }
     }
 }
<?php 
$invalidCreatorNameTest = array("creator" => "");
$s4 = new RobotData($invalidCreatorNameTest);
$test4 = empty($s4->getErrors()) ? '' : 'Failed:It should have errors when invalid input is provided<br>';
echo $test4;
echo "The error for creator is: " . $s4->getError('creator') . "<br>";
echo "The object is: {$s4}<br>";
?>

<h2>It should have an error when the status is empty</h2>
<?php 
$invalidStatusTest = array("status" => "");
$s5 = new RobotData($invalidStatusTest);
$test5 = empty($s5->getErrors()) ? '' : 'Failed:It should have errors when invalid input is provided<br>';
echo $test5;
echo "The error for status is: " . $s5->getError('status') . "<br>";
echo "The object is: {$s5}<br>";
?>

<h2>It should have an error when the status is invalid</h2>
<?php 
$invalidStatusTest = array("status" => "invalid-status");
$s6 = new RobotData($invalidStatusTest);
$test6 = empty($s6->getErrors()) ? '' : 'Failed:It should have errors when invalid input is provided<br>';
echo $test6;
echo "The error for status is: " . $s6->getError('status') . "<br>";
echo "The object is: {$s6}<br>";
?>
</body>
</html>