Behat\RestTestingContext\RestContext::fieldIsOfTypeWithValue PHP Метод

fieldIsOfTypeWithValue() публичный Метод

public fieldIsOfTypeWithValue ( string $name, string $type, string $value ) : void
$name string
$type string
$value string
Результат void
    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;
        }
    }