public function fieldIsOfTypeWithValue($name, $type, $value)
{
$this->valueOfTheFieldEquals($name, $value);
switch (strtolower($type)) {
case 'int':
case 'integer':
if (!preg_match('/^(0|[1-9]\\d*)$/', $value)) {
throw new Exception(sprintf('Field "%s" is not of the correct type: %s!', $name, $type));
}
// TODO: We didn't check if the value is as expected here.
break;
default:
throw new Exception('Unsupported data type: ' . $type);
break;
}
}