public function testCheckBounds($valid, $minBound, $maxBound, $validator, $allowEqual = false, $msg = false)
{
$roleId = 33;
$setting = 'scaling';
$methodName = 'checkBounds';
$defaultErrMsg = 'Invalid bounds.';
$checkBoundsFn = self::getAccessibleMethod($this->builder, $methodName);
$checkTypeFn = $validator === 'integer' ? 'is_int' : 'is_float';
$errCountBefore = $this->builder->errors['error_count'];
$ret = $checkBoundsFn->invoke($this->builder, $roleId, $setting, $minBound, $maxBound, $validator, $allowEqual, $msg);
if ($valid) {
$this->assertTrue(is_array($ret) && count($ret) === 2 && isset($ret[0]) && $checkTypeFn($ret[0]) && isset($ret[1]) && $checkTypeFn($ret[1]) && ($allowEqual ? $ret[0] <= $ret[1] : $ret[0] < $ret[1]), 'Returns sorted array with two elements, both integer or float type.');
} else {
$this->assertFalse($ret, 'Check not passed.');
if ($msg === false) {
$this->assertEquals($errCountBefore, $this->builder->errors['error_count'], 'Explicitly set Error message to *FALSE* prevents set build error.');
} else {
$this->assertEquals($errCountBefore + 1, $this->builder->errors['error_count'], 'Error count have been incremented.');
if (!$msg) {
$this->assertEquals($defaultErrMsg, $this->builder->errors['roles'][$roleId][$setting], 'Not provided Error message leads to set default one.');
} else {
$this->assertEquals($msg, $this->builder->errors['roles'][$roleId][$setting], 'Provided Error message used.');
}
}
}
}