public function testInsertDuplicateRobotAssoc() { $myDB = DBMaker::create('botspacetest'); Database::clearDB(); $db = Database::getDB('botspacetest', 'C:\\xampp\\myConfig.ini'); $beforeCount = count(RobotAssocsDB::getRobotAssocsBy()); $robotAssocCopy = RobotAssocsDB::getRobotAssocsRowsBy('robotAssocId', 2); $robotAssocCopy = $robotAssocCopy[0]; $s1 = new RobotAssoc($robotAssocCopy); $dupRobotAssoc = RobotAssocsDB::addRobotAssoc($s1); $afterCount = count(RobotAssocsDB::getRobotAssocsBy()); $this->assertTrue(!empty($dupRobotAssoc->getError('robotAssocId')) && strcmp(Messages::getError('ROBOT_ASSOC_INVALID'), $s1->getError('robotAssocId')) == 0, 'It should have a robotAssocId error if the robot association is a duplicate'); $this->assertEquals($afterCount, $beforeCount, 'There should be no additional robot association entries after the insertion attempt'); }
public static function getRobotAssocValuesBy($type = null, $value = null, $column) { $robotAssocsRows = RobotAssocsDB::getRobotAssocsRowsBy($type, $value); return RobotAssocsDB::getRobotAssocsValues($robotAssocsRows, $column); }