Compare commits

..

No commits in common. "master" and "v1.1.2" have entirely different histories.

53 changed files with 873 additions and 6874 deletions

5
.gitattributes vendored
View File

@ -1,5 +0,0 @@
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml export-ignore

1
.github/FUNDING.yml vendored
View File

@ -1 +0,0 @@
tidelift: "packagist/vlucas/valitron"

View File

@ -1,73 +0,0 @@
name: Run Tests
on: [push, pull_request]
jobs:
test:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: ['ubuntu-latest']
php-versions:
- '5.4'
- '5.5'
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- '8.0'
# - '8.1'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Cache composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-versions }}-
- name: Validate composer configuration
run: |
composer validate
- name: Install dependencies
run: |
composer install --no-progress
- name: Run tests
run: |
composer run-script test
# test-hhvm:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Setup HHVM
# uses: azjezz/setup-hhvm@v1
# with:
# version: latest
# debug: false
# - name: Cache composer packages
# id: composer-cache
# uses: actions/cache@v2
# with:
# path: vendor
# key: ${{ runner.os }}-hhvm-${{ hashFiles('**/composer.lock') }}
# restore-keys: |
# ${{ runner.os }}-hhvm-
# - name: Validate composer configuration
# run: |
# composer validate
# - name: Install dependencies
# run: |
# composer install --no-progress
# - name: Run tests
# run: |
# composer run-script test

3
.gitignore vendored
View File

@ -1,6 +1,3 @@
.DS_Store
composer.phar
composer.lock
vendor
.idea/
.phpunit.result.cache

13
.travis.yml Normal file
View File

@ -0,0 +1,13 @@
# see http://about.travis-ci.org/docs/user/languages/php/ for more hints
language: php
# list any PHP version you want to test against
php:
- 5.3
- 5.4
before_script:
- composer install
# Script to run tests
script: phpunit

1143
README.md

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +1,24 @@
{
"name": "vlucas/valitron",
"version": "1.1.2",
"type": "library",
"description": "Simple, elegant, stand-alone validation library with NO dependencies",
"keywords": ["validation", "validator", "valid"],
"homepage": "https://github.com/vlucas/valitron",
"license": "BSD-3-Clause",
"authors": [
"homepage": "http://github.com/vlucas/valitron",
"license" : "BSD",
"authors" : [
{
"name": "Vance Lucas",
"email": "vance@vancelucas.com",
"homepage": "https://www.vancelucas.com"
"homepage": "http://www.vancelucas.com"
}
],
"require": {
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": ">=4.8.35"
},
"suggest": {
"ext-mbstring": "It can support the multiple bytes string length."
},
"autoload": {
"psr-4": {
"Valitron\\": "src/Valitron"
"psr-0": {
"Valitron": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Valitron\\": "tests/Valitron"
}
},
"scripts": {
"test": "./vendor/bin/phpunit"
}
}

View File

@ -1,5 +1,4 @@
<?php
return array(
'required' => "مطلوب",
'equals' => "يجب أن يكون مساوي لي '%s'",
@ -11,7 +10,6 @@ return array(
'min' => "يجب ان يكون اعلي من %s",
'max' => "يجب ان يكون اقل من %s",
'in' => "الُمدخل يغير صحيح",
'listContains' => "الُمدخل يغير صحيح",
'notIn' => "الُمدخل يغير صحيح",
'ip' => "رقم الإتصال غير صحيح",
'email' => "البريد الألكتروني غير صحيح",

View File

@ -1,35 +0,0 @@
<?php
return array(
'required' => "mütləqdir",
'equals' => "'%s' olmalıdır",
'different' => "'%s'-dən fərqli olmalıdır",
'accepted' => "Qeyd dilməlidir",
'numeric' => "rəqəm olmalıdır",
'integer' => "tam ədəd olmalıdır",
'length' => "%d qədər uzunluğu olmalıdır",
'min' => "minimum %s qədər olmalıdır",
'max' => "maksimum %s qədər olmalıdır",
'listContains' => "yalnış dəyər ehtiva edir",
'in' => "yalnış dəyər ehtiva edir",
'notIn' => "yalnış dəyər ehtiva edir",
'ip' => "düzgün IP ünvanı deyil",
'email' => "düzgün email ünvanı deyil",
'url' => "URL deyil",
'urlActive' => "aktiv domain olmalıdır",
'alpha' => "ancaq latın hərfləri ehtiva etməlidir",
'alphaNum' => "ancaq latın hərfləri və(və ya) rəqəmlər ehtiva etməlidir",
'slug' => "ancaq latın hərfləri,rəqəmlər,tire və altdan xət ehtiva etməlidir",
'regex' => "etiabrsız sinvollar ehtiva edir",
'date' => "tarix deyil",
'dateFormat' => "tarix formatı bu cür olmalıdır: %s",
'dateBefore' => "tarix %s -dən əvvəl olmamalıdır",
'dateAfter' => "tarix %s -dən sonra olmamalıdır",
'contains' => "%s ehtiva etməlidir",
'boolean' => "boolen olmalıdır",
'lengthBetween' => "%d - %d sinvolları arası ehtiva etməlidir",
'creditCard' => "kredir kart nömrəsi olmalıdır",
"lengthMin" => "%d -dən çox sinvol olmalıdır",
"lengthMax" => "%d -dən az sinvol olmalıdır",
"instanceOf" => "'%s' əvəzinə olmalıdır"
);

View File

@ -1,35 +0,0 @@
<?php
return array(
'required' => "е задължително",
'equals' => "трябва да бъде същото като '%s'",
'different' => "трябва да бъде различно от '%s'",
'accepted' => "трабва да бъде прието",
'numeric' => "трябва да бъде число",
'integer' => "трябва да бъде цифра (0-9)",
'length' => "трябва да бъде %d символа дълго",
'min' => "трябвя да бъде поне %s",
'max' => "трябва да бъде не повече от %s",
'listContains' => "съдържа невалидна стойност",
'in' => "съдържа невалидна стойност",
'notIn' => "съдържа невалидна стойност",
'ip' => "е невалиден IP адрес",
'email' => "е невалиден имейл адрес",
'url' => "е невалиден URL адрес",
'urlActive' => "трябва да бъде активен домейн",
'alpha' => "трябва да съдържа само букви a-z",
'alphaNum' => "трябва да съдържа само букви a-z и/или цифри 0-9",
'slug' => "трябва да съдържа само букви a-z, цифри 0-9, тирета и долни черти",
'regex' => "съдържа невалидни символи",
'date' => "е невалидна дата",
'dateFormat' => "трябва да бъде дата с формат '%s'",
'dateBefore' => "трябва да бъде дата преди '%s'",
'dateAfter' => "трябва да бъде дата след '%s'",
'contains' => "трябв да съдържа %s",
'boolean' => "трябва да бъде истина или лъжа",
'lengthBetween' => "трябва да бъде между %d и %d символа",
'creditCard' => "трябва да бъде валиден номер на кредитна карта",
'lengthMin' => "трябва да бъде поне %d символа дълго",
'lengthMax' => "не трябва да надвишава %d символа",
'instanceOf' => "трябва да бъде инстанция от '%s'"
);

View File

@ -1,34 +0,0 @@
<?php
return array(
'required' => "ist erforderlich",
'equals' => "muss identisch mit '%s' sein",
'different' => "muss sich von '%s' unterscheiden",
'accepted' => "muss markiert sein",
'numeric' => "muss eine Zahl sein",
'integer' => "muss eine ganze Zahl sein",
'length' => "kann nicht länger als %d sein",
'min' => "muss größer als %s sein",
'max' => "muss kleiner als %s sein",
'listContains' => "enthält einen ungültigen Wert",
'in' => "enthält einen ungültigen Wert",
'notIn' => "enthält einen ungültigen Wert",
'ip' => "enthält keine gültige IP-Addresse",
'email' => "enthält keine gültige E-Mail-Adresse",
'url' => "enthält keine gültige URL",
'urlActive' => "muss eine aktive Domain sein",
'alpha' => "darf nur Buchstaben enthalten",
'alphaNum' => "darf nur Buchstaben und Ganzzahlen enthalten",
'slug' => "darf nur Buchstaben, Ganzzahlen, Schrägstriche und Grundstriche enthalten",
'regex' => "enthält ungültige Zeichen",
'date' => "enthält kein gültiges Datum",
'dateFormat' => "benötigt ein Datum im Format '%s'",
'dateBefore' => "benötigt ein Datum, das vor dem '%s' liegt",
'dateAfter' => "benötigt ein Datum, das nach dem '%s' liegt",
'contains' => "muss %s beinhalten",
'boolean' => "muss ein Wahrheitswert sein",
'lengthBetween' => "benötigt zwischen %d und %d Zeichen",
'creditCard' => "muss eine gültige Kreditkartennummer sein",
"lengthMin" => "muss mindestens %d Zeichen enthalten",
"lengthMax" => "kann nicht mehr als %d Zeichen enthalten"
);

View File

@ -1,35 +0,0 @@
<?php
return array(
'required' => "είναι απαραίτητο",
'equals' => "πρέπει να είναι ίδιο με '%s'",
'different' => "πρέπει να διαφέρει από '%s'",
'accepted' => "πρέπει να έχει αποδεχτεί",
'numeric' => "πρέπει να είναι αριθμός",
'integer' => "πρέπει να είναι ακέραιος αριθμός",
'length' => "πρέπει να είναι μεγαλύτερο από %d",
'min' => "πρέπει να είναι τουλάχιστον %s",
'max' => "δεν πρέπει να είναι περισσότερο από %s",
'listContains' => "περιέχει μη έγκυρη τιμή",
'in' => "περιέχει μη έγκυρη τιμή",
'notIn' => "περιέχει μη έγκυρη τιμή",
'ip' => "δεν είναι έγκυρη διεύθυνση IP",
'email' => "δεν είναι έγκυρη διεύθυνση email",
'url' => "δεν είναι URL",
'urlActive' => "πρέπει να είναι ενεργό domain",
'alpha' => "πρέπει να περιέχει μόνο χαρακτήρες",
'alphaNum' => "πρέπει να περιέχει μόνο χαρακτήρες και/ή αριθμούς",
'slug' => "πρέπει να περιέχει μόνο χαρακτήρες, αριθμούς, παύλες και κάτω παύλες",
'regex' => "περιέχει μη έγκυρους χαρακτήρες",
'date' => "δεν είναι έγκυρη ημερομηνία",
'dateFormat' => "πρέπει να είναι ημερομηνία της μορφής '%s'",
'dateBefore' => "πρέπει να είναι ημερομηνία πριν από '%s'",
'dateAfter' => "πρέπει να είναι ημερομηνία μετά από '%s'",
'contains' => "πρέπει να περιέχει %s",
'boolean' => "πρέπει να είναι boolean",
'lengthBetween' => "πρέπει να είναι μεταξύ %d και %d χαρακτήρων",
'creditCard' => "πρέπει να είναι ένα έγκυρο νούμερο πιστωτικής κάρτας",
"lengthMin" => "πρέπει να περιέχει περισσότερους από %d χαρακτήρες",
"lengthMax" => "πρέπει να περιέχει λιγότερους από %d χαρακτήρες",
"instanceOf" => "πρέπει να είναι αντικείμενο της '%s'"
);

View File

@ -1,42 +1,29 @@
<?php
return array(
'required' => "is required",
'equals' => "must be the same as '%s'",
'different' => "must be different than '%s'",
'accepted' => "must be accepted",
'numeric' => "must be numeric",
'integer' => "must be an integer",
'length' => "must be %d characters long",
'min' => "must be at least %s",
'max' => "must be no more than %s",
'listContains' => "contains invalid value",
'in' => "contains invalid value",
'notIn' => "contains invalid value",
'ip' => "is not a valid IP address",
'ipv4' => "is not a valid IPv4 address",
'ipv6' => "is not a valid IPv6 address",
'email' => "is not a valid email address",
'url' => "is not a valid URL",
'urlActive' => "must be an active domain",
'alpha' => "must contain only letters a-z",
'alphaNum' => "must contain only letters a-z and/or numbers 0-9",
'slug' => "must contain only letters a-z, numbers 0-9, dashes and underscores",
'regex' => "contains invalid characters",
'date' => "is not a valid date",
'dateFormat' => "must be date with format '%s'",
'dateBefore' => "must be date before '%s'",
'dateAfter' => "must be date after '%s'",
'contains' => "must contain %s",
'boolean' => "must be a boolean",
'lengthBetween' => "must be between %d and %d characters",
'creditCard' => "must be a valid credit card number",
'lengthMin' => "must be at least %d characters long",
'lengthMax' => "must not exceed %d characters",
'instanceOf' => "must be an instance of '%s'",
'containsUnique' => "must contain unique elements only",
'requiredWith' => "is required",
'requiredWithout'=> "is required",
'subset' => "contains an item that is not in the list",
'arrayHasKeys' => "does not contain all required keys",
'required' => "is required",
'equals' => "must be the same as '%s'",
'different' => "must be different than '%s'",
'accepted' => "must be accepted",
'numeric' => "must be numeric",
'integer' => "must be an integer (0-9)",
'length' => "must be longer than %d",
'min' => "must be greater than %s",
'max' => "must be less than %s",
'in' => "contains invalid value",
'notIn' => "contains invalid value",
'ip' => "is not a valid IP address",
'email' => "is not a valid email address",
'url' => "not a URL",
'urlActive' => "must be an active domain",
'alpha' => "must contain only letters a-z",
'alphaNum' => "must contain only letters a-z and/or numbers 0-9",
'slug' => "must contain only letters a-z, numbers 0-9, dashes and underscores",
'regex' => "contains invalid chatacters",
'date' => "is not a valid date",
'dateFormat' => "must be date with format '%s'",
'dateBefore' => "must be date before '%s'",
'dateAfter' => "must be date after '%s'",
'contains' => "must contain %s"
);

View File

@ -1,37 +0,0 @@
<?php
return array(
'required' => "es obligatorio",
'equals' => "debe ser igual a '%s'",
'different' => "debe ser diferente a '%s'",
'accepted' => "debe ser aceptado",
'numeric' => "debe ser numérico",
'integer' => "debe ser un entero",
'length' => "debe ser mas largo de %d",
'min' => "debe ser mayor de %s",
'max' => "debe ser menor de %s",
'in' => "contiene un valor inválido",
'notIn' => "contiene un valor inválido",
'ip' => "no es una dirección IP",
'email' => "no es un correo electrónico válido",
'url' => "no es una URL",
'urlActive' => "debe ser un dominio activo",
'alpha' => "debe contener solo letras a-z",
'alphaNum' => "debe contener solo letras a-z o números 0-9",
'slug' => "debe contener solo letras a-z, números 0-9, barras y guiones bajos",
'regex' => "contiene caracteres inválidos",
'date' => "no es una fecha válida",
'dateFormat' => "debe ser una fecha con formato '%s'",
'dateBefore' => "debe ser una fecha antes de '%s'",
'dateAfter' => "debe ser una fecha después de '%s'",
'contains' => "debe contener %s",
'boolean' => "debe ser booleano",
'lengthBetween' => "debe tener entre %d y %d caracteres",
'creditCard' => "debe ser un numero de tarjeta de crédito válido",
"lengthMin" => "debe tener al menos %d caracteres",
"lengthMax" => "debe tener menos de %d caracteres",
"instanceOf" => "debe ser una instancia de '%s'",
'containsUnique' => "debe contener solo valores únicos",
'subset' => "contiene un elemento que no está en la lista",
'arrayHasKeys' => "no contiene todas las claves requeridas"
);

View File

@ -1,42 +0,0 @@
<?php
return array(
'required' => "الزامی است",
'equals' => " باید برابر باشد با '%s'",
'different' => "باید متفاوت باشد از '%s'",
'accepted' => "باید پذیرفته شده باشد",
'numeric' => "باید مقدار عددی باشد",
'integer' => "باید عددی طبیعی باشد",
'length' => "طول باید %d باشد",
'min' => "حداقل باید %s کاراکتر باشد",
'max' => "نباید بیشتر از %s کارکتر باشد",
'listContains' => "حاوی مقدار نامعتبر",
'in' => "حاوی مقدار نامعتبر",
'notIn' => "حاوی مقدار نامعتبر",
'ip' => " آدرس معتبر نیست IP",
'ipv4' => "آدرس معتبر نیست IPv4",
'ipv6' => "آدرس معتبر نیست IPv6",
'email' => "آدرس ایمیل معتبر نیست",
'url' => "معتبر نیست URL",
'urlActive' => "دامنه باید فعال باشد",
'alpha' => "باید حاوی حروف a-z باشد",
'alphaNum' => "باید حاوی حروف a-z و/یا اعداد 0-9 باشد",
'slug' => "باید حاوی حروف a-z, اعداد 0-9, دش و آندراسکور باشد",
'regex' => "حاوی کارکترهای نامعتبر",
'date' => "تاریخ معتبر نیست",
'dateFormat' => "فرمت تاریخ باید به این شکل '%s' باشد",
'dateBefore' => "تاریخ باید قبل از '%s' باشد",
'dateAfter' => "تاریخ باید بعد از '%s' باشد",
'contains' => "باید حاوی %s باشد",
'boolean' => "مقدار باید بولین باشد",
'lengthBetween' => "طول باید بین %d و %d کاراکتر باشد",
'creditCard' => "شماره کارت اعتباری معتبر نیست",
'lengthMin' => "طول باید حداقل %d کاراکتر باشد",
'lengthMax' => "طول نباید بیشتر از %d کاراکتر باشد",
'instanceOf' => "باید آبجکتی از نوع '%s' باشد",
'containsUnique' => "باید حاوی المان ها یونیک باشد",
'requiredWith' => "الزامی است",
'requiredWithout'=> "الزامی است",
'subset' => "حاوی آیتمی است که در لیست موجود نیست",
'arrayHasKeys' => "همه کلیدهای الزامی را ندارد",
);

View File

@ -1,35 +0,0 @@
<?php
return array(
'required' => "vaaditaan",
'equals' => "ei ole sama kuin '%s'",
'different' => "on sama kuin '%s'",
'accepted' => "ei ole hyväksytty",
'numeric' => "ei ole numeerinen",
'integer' => "ei ole kokonaisluku",
'length' => "on lyhyempi kuin %d",
'min' => "ei ole vähintään %s",
'max' => "ei ole enintään %s",
'listContains' => "sisältää virheellisen arvon",
'in' => "sisältää virheellisen arvon",
'notIn' => "sisältää virheellisen arvon",
'ip' => "ei ole oikeanmuotoinen IP-osoite",
'email' => "ei ole oikeanmuotoinen sähköpostiosoite",
'url' => "ei ole URL",
'urlActive' => "ei ole aktiivinen verkkotunnus",
'alpha' => "sisältää muita merkkejä kuin a-z",
'alphaNum' => "sisältää muita merkkejä kuin a-z ja 0-9",
'slug' => "sisältää muita merkkejä kuin a-z, 0-9, - ja _",
'regex' => "sisältää virheellisiä merkkejä",
'date' => "ei ole oikeanmuotoinen päivämäärä",
'dateFormat' => "ei ole päivämäärä muotoa '%s'",
'dateBefore' => "ei ole päivämäärä ennen '%s'",
'dateAfter' => "ei ole päivämäärä '%s' jälkeen",
'contains' => "ei sisällä merkkijonoa %s",
'boolean' => "ei ole totuusarvo",
'lengthBetween' => "ei ole %d-%d merkkiä pitkä",
'creditCard' => "ei ole pätevä luottokortin numero",
"lengthMin" => "ei ole vähintään %d merkkiä pitkä",
"lengthMax" => "ei ole enintään %d merkkiä pitkä",
"instanceOf" => "ei ole luokan '%s' ilmentymä"
);

View File

@ -1,40 +0,0 @@
<?php
return array(
'required' => "est obligatoire",
'equals' => "doit être identique à '%s'",
'different' => "doit être différent de '%s'",
'accepted' => "doit être accepté",
'numeric' => "doit être numérique",
'integer' => "doit être un entier",
'length' => "doit être plus long que %d",
'min' => "doit être plus grand que %s",
'max' => "doit être plus petit que %s",
'listContains' => "contient une valeur non valide",
'in' => "contient une valeur non valide",
'notIn' => "contient une valeur non valide",
'ip' => "n'est pas une adresse IP valide",
'email' => "n'est pas une adresse email valide",
'url' => "n'est pas une URL",
'urlActive' => "doit être un domaine actif",
'alpha' => "doit contenir uniquement les lettres a-z",
'alphaNum' => "doit contenir uniquement des lettres de a-z et/ou des chiffres 0-9",
'slug' => "doit contenir uniquement des lettres de a-z, des chiffres 0-9, des tirets et des traits soulignés",
'regex' => "contient des caractères invalides",
'date' => "n'est pas une date valide",
'dateFormat' => "doit être une date avec le format '%s'",
'dateBefore' => "doit être une date avant '%s'",
'dateAfter' => "doit être une date après '%s'",
'contains' => "doit contenir %s",
'boolean' => "doit être un booléen",
'lengthBetween' => "doit être entre %d et %d caractères",
'creditCard' => "doit être un numéro de carte de crédit valide",
'lengthMin' => "doit avoir au moins %d caractères",
'lengthMax' => "ne doit pas dépasser %d caractères",
'instanceOf' => "doit être une instance de '%s'",
"containsUnique" => "doit contenir des élements unique",
"requiredWith" => "est requis",
"requiredWithout" => "est requis",
"subset" => "contient un élement qui n'est pas dans la liste",
"arrayHasKeys" => "ne contient pas toutes les clés requises"
);

View File

@ -1,34 +0,0 @@
<?php
return array(
'required' => "harus diisi",
'equals' => "harus sama dengan '%s'",
'different' => "harus berbeda dengan '%s'",
'accepted' => "harus diterima (accepted)",
'numeric' => "harus berupa nomor/angka",
'integer' => "harus berupa nilai integer",
'length' => "harus lebih panjang dari %d",
'min' => "harus lebih besar dari %s",
'max' => "harus kurang dari %s",
'listContains' => "berisi nilai/value yang tidak valid",
'in' => "berisi nilai/value yang tidak valid",
'notIn' => "berisi nilai/value yang tidak valid",
'ip' => "format alamat IP tidak benar",
'email' => "format alamat email tidak benar",
'url' => "bukan format URL yang benar",
'urlActive' => "harus berupa domain aktif",
'alpha' => "hanya boleh menggunakan huruf a-z",
'alphaNum' => "hanya boleh menggunakan huruf a-z dan atau nomor 0-9",
'slug' => "hanya boleh menggunakan huruf a-z, nomor 0-9, tanda minus (-), dan uderscore atau strip bawah (_)",
'regex' => "berisi karakter yang tidak valid",
'date' => "format tanggal tidak valid",
'dateFormat' => "harus berupa tanggal dengan format '%s'",
'dateBefore' => "tanggal harus sebelum tanggal '%s'",
'dateAfter' => "tanggal harus sesudah tanggal '%s'",
'contains' => "harus berisi %s",
'boolean' => "harus berupa nilai boolean",
'lengthBetween' => "harus diantara karakter %d dan %d",
'creditCard' => "nomor kartu kredit harus valid",
"lengthMin" => "minimal berisi %d karakter",
"lengthMax" => "maksimal berisi %d karakter"
);

View File

@ -1,35 +0,0 @@
<?php
return array(
'required' => "è obbligatorio",
'equals' => "deve essere uguale a '%s'",
'different' => "deve essere differente da '%s'",
'accepted' => "deve essere accettato",
'numeric' => "deve essere numerico",
'integer' => "deve essere un intero",
'length' => "deve avere una lunghezza di %d",
'min' => "deve essere superiore a %s",
'max' => "deve essere inferiore a %s",
'listContains' => "contiene un valore non valido",
'in' => "contiene un valore non valido",
'notIn' => "contiene un valore non valido",
'ip' => "non è un indirizzo IP valido",
'email' => "non è un indirizzo email valido",
'url' => "non è una URL",
'urlActive' => "deve essere un dominio attivo",
'alpha' => "deve contenere solamente lettere (a-z)",
'alphaNum' => "deve contenere solamente lettere (a-z) e/o numeri (0-9)",
'slug' => "deve contenere solamente lettere (a-z), numeri (0-9), trattini (-) e trattini bassi (_)",
'regex' => "contiene caratteri non validi",
'date' => "non è una data valida",
'dateFormat' => "deve essere una data nel formato '%s'",
'dateBefore' => "deve essere una data precedente al '%s'",
'dateAfter' => "deve essere una data successiva al '%s'",
'contains' => "deve contenere %s",
'boolean' => "deve essere un booleano",
'lengthBetween' => "deve essere compreso tra %d e %d caratteri",
'creditCard' => "deve essere un numero di carta di credito valido",
'lengthMin' => "deve essere lungo almeno %d caratteri",
'lengthMax' => "non deve superare %d caratteri",
'instanceOf' => "deve essere un'istanza di '%s'",
);

View File

@ -1,42 +0,0 @@
<?php
return array(
'required' => "を入力してください",
'equals' => "は「%s」と同じ内容を入力してください",
'different' => "は「%s」と異なる内容を入力してください",
'accepted' => "に同意してください",
'numeric' => "は数値を入力してください",
'integer' => "は半角数字で入力してください",
'length' => "は%d文字で入力してください",
'min' => "には%sより大きな値を入力してください",
'max' => "には%sより小さな値を入力してください",
'listContains' => "には選択できない値が含まれています",
'in' => "には選択できない値が含まれています",
'notIn' => "には選択できない値が含まれています",
'ip' => "はIPアドレスの書式として正しくありません",
'ipv4' => "はIPv4のIPアドレスの書式として正しくありません",
'ipv6' => "はIPv6のIPアドレスの書式として正しくありません",
'email' => "はメールアドレスの書式として正しくありません",
'url' => "はURLの書式として正しくありません",
'urlActive' => "はアクティブなドメインではありません",
'alpha' => "は半角英字で入力してください",
'alphaNum' => "は半角英数字で入力してください",
'slug' => "は半角英数字、もしくは「-」「_」の文字で入力してください",
'regex' => "の書式が正しくありません",
'date' => "は日付の書式として正しくありません",
'dateFormat' => "は「%s」の書式で日付を入力してください",
'dateBefore' => "は「%s」以前の日付を入力してください",
'dateAfter' => "は「%s」以後の日付を入力してください",
'contains' => "は「%s」を含んでいなければいけません",
'boolean' => "は真偽値である必要があります",
'lengthBetween' => "は%d〜%d文字で入力してください",
'creditCard' => "はクレジットカード番号の書式として正しくありません",
'lengthMin' => "は%d文字以上入力してください",
'lengthMax' => "は%d文字以内で入力してください",
'instanceOf' => "は「%s」のインスタンスではありません",
'containsUnique' => "は重複のないように入力してください",
'requiredWith' => "を入力してください",
'requiredWithout' => "を入力してください",
'subset' => "には選択できない値が含まれています",
'arrayHasKeys' => "の必要な項目が選択されていません",
);

View File

@ -1,35 +0,0 @@
<?php
return array(
'required' => "을(를) 입력해야 합니다.",
'equals' => "은(는) '%s'와(과) 같아야 합니다.",
'different' => "은(는) '%s'와(과) 달라야 합니다.",
'accepted' => "을(를) 동의해야 합니다.",
'numeric' => "은(는) 숫자여야 합니다.",
'integer' => "은(는) 정수여야 합니다.",
'length' => "의 길이는 %d 이어야 합니다.",
'min' => "은(는) %s 이상이어야 합니다.",
'max' => "은(는) %s 이하여야 합니다.",
'listContains' => "은(는) 올바르지 않은 값을 포함하고 있습니다.",
'in' => "은(는) 올바르지 않은 값을 포함하고 있습니다.",
'notIn' => "은(는) 올바르지 않은 값을 포함하고 있습니다.",
'ip' => "은(는) 올바르지 않은 IP입니다.",
'email' => "은(는) 올바르지 않은 email입니다.",
'url' => "은(는) 올바르지 않은 URL입니다.",
'urlActive' => "은(는) 접속 가능한 도메인이어야 합니다.",
'alpha' => "은(는) 영문자(a-z)로만 이루어져야 합니다.",
'alphaNum' => "은(는) 영문자(a-z)와 숫자(0-9)로만 이루어져야 합니다.",
'slug' => "은(는) 영문자(a-z)와 숫자(0-9), 특수문자 -와 _로만 이루어져야 합니다.",
'regex' => "은(는) 올바르지 않은 문자를 포함하고 있습니다.",
'date' => "은(는) 올바르지 않은 날짜입니다.",
'dateFormat' => "은(는) '%s' 형태의 날짜여야 합니다.",
'dateBefore' => "은(는) '%s' 보다 이전이어야 합니다.",
'dateAfter' => "은(는) '%s' 보다 이후여야 합니다.",
'contains' => "은(는) '%s'을(를) 포함해야 합니다.",
'boolean' => "은(는) boolean이어야 합니다.",
'lengthBetween' => "의 길이는 %d에서 %d 사이여야 합니다.",
'creditCard' => "은(는) 올바른 신용카드 번호가 아닙니다.",
'lengthMin' => "의 길이는 %d 이상이어야 합니다.",
'lengthMax' => "의 길이는 %d을(를) 넘을 수 없습니다.",
'instanceOf' => "는 '%s'의 객체여야 합니다."
);

View File

@ -1,38 +0,0 @@
<?php
return array(
'required' => "yra privalomas",
'equals' => "reikšmė turi būti tokia pati, kaip „%s“",
'different' => "turi būti kitokia, nei „%s“",
'accepted' => "turi būti priimta",
'numeric' => "turi būti sveikasis skaičius",
'integer' => "turi būti skaičius",
'length' => "turi būti %d ženklų ilgio",
'min' => "turi būti bent %s",
'max' => "turi būti ne daugiau kaip %s",
'listContains' => "turi neteisingą vertę",
'in' => "turi neteisingą vertę",
'notIn' => "turi neteisingą vertę",
'ip' => "nėra teisingas IP adresas",
'ipv4' => "nėra teisingas IPv4 adresas",
'ipv6' => "nėra teisingas IPv6 adresas",
'email' => "nėra teisingas el. pašto adresas",
'url' => "nėra teisingas URL",
'urlActive' => "turi būti aktyvus domenas",
'alpha' => "turi turėti tik raides a-ž",
'alphaNum' => "turi turėti tik raides a-ž ir/ar skaičius 0-9",
'slug' => "turi turėti tik raides a-ž, skaičius 0-9, brukšnelius ir apatinius brukšnelius",
'regex' => "yra neteisingų ženklų",
'date' => "nėra teisinga data",
'dateFormat' => "turi būti „%s“ formato data",
'dateBefore' => "turi būti data, ankstesnė nei „%s“",
'dateAfter' => "turi būti data, vėlesnė nei „%s“",
'contains' => "turi turėti %s",
'boolean' => "turi būti būlio (taip/ne) tipo",
'lengthBetween' => "turi būti nuo %d iki %d ilgio",
'creditCard' => "turi būti teisingas kreditinės kortelės numeris",
'lengthMin' => "turi būti bent %d ženklų ilgio",
'lengthMax' => "turi būti ne ilgesnis nei %d ženklų",
'instanceOf' => "turi būti „%s“ atvejis",
'containsUnique' => "turi turėti tik unikalius elementus",
'subset' => "turi elementą, kurio nėra sąraše"
);

View File

@ -1,32 +0,0 @@
<?php
return array(
'required' => "ir obligāts lauks",
'equals' => "jāsakrīt ar '%s'",
'different' => "nedrīkst sakrist ar '%s' lauku",
'accepted' => "laukam jābūt apstiprinātam",
'numeric' => "jābūt skaitliskai vērtībai",
'integer' => "jābūt ciparam (0-9)",
'length' => "nedrīkst būt garāks par %d simboliem",
'min' => "jābūt garākam par %s simboliem",
'max' => "jābūt īsākam par %s simboliem",
'listContains' => "lauks satur nederīgu vērtību",
'in' => "lauks satur nederīgu vērtību",
'notIn' => "lauks satur nederīgu vērtību",
'ip' => " lauks nav derīga IP adrese",
'email' => "lauks nav norādīta derīga epasta adrese",
'url' => "lauks nav tīmekļa saite",
'urlActive' => "saite neatrodas esošajā domēna vārdā",
'alpha' => "lauks var saturēt tikai alfabēta burtus a-z",
'alphaNum' => "lauks var saturēt tikai alfabēta burtus un/vai ciparus 0-9",
'slug' => "lauks var saturēt tikai alfabēta burtus un/vai ciparus 0-9, domuzīmes and zemsvītras",
'regex' => "lauks satur nederīgus simbolus",
'date' => "lauks ir nederīgā datuma formātā",
'dateFormat' => "laukam jābūt datuma formātā '%s'",
'dateBefore' => "lauka datumam jābūt pirms '%s'",
'dateAfter' => "lauka datumam jābūt pēc '%s'",
'contains' => "laukam jāsatur %s",
'boolean' => "laukam jābūt ir/nav vērtībai",
'lengthBetween' => "lauka garumam jābūt no %d līdz %d simbolu garam",
'creditCard' => "laukam jābūt derīgam kredītkartes numuram"
);

View File

@ -1,39 +0,0 @@
<?php
// Norwegian Bokmål (nb)
return array(
'required' => "er påkrevd",
'equals' => "må være lik '%s'",
'different' => "må være annerledes enn '%s'",
'accepted' => "må aksepteres",
'numeric' => "må være numerisk",
'integer' => "må være et heltall",
'length' => "må være %d tegn langt",
'min' => "må være minst %s",
'max' => "må ikke være mer enn %s",
'listContains' => "inneholder ugyldig verdi",
'in' => "inneholder ugyldig verdi",
'notIn' => "inneholder ugyldig verdi",
'ip' => "er ikke en gyldig IP adresse",
'ipv4' => "er ikke en gyldig IPv4 adresse",
'ipv6' => "er ikke en gyldig IPv6 adresse",
'email' => "er ikke en gyldig e-postadresse",
'url' => "er ikke en gyldig URL",
'urlActive' => "må være et aktivt domene",
'alpha' => "må bare innholde bokstaver a-z",
'alphaNum' => "må bare innholde bokstaver a-z og/eller tall 0-9",
'slug' => "må bare innholde bokstaver a-z og/eller tall 0-9, bindestreker og understreker",
'regex' => "inneholder ulovlige tegn",
'date' => "er ikke en gyldig dato",
'dateFormat' => "må være en dato med format '%s'",
'dateBefore' => "må være en dato før '%s'",
'dateAfter' => "må være en dato etter '%s'",
'contains' => "må inneholde %s",
'boolean' => "må være en boolsk verdi",
'lengthBetween' => "må være mellom %d og %d tegn",
'creditCard' => "må være et gyldig kredittkortnummer",
'lengthMin' => "må være minst %d tegn langt",
'lengthMax' => "må ikke overstige %d tegn",
'instanceOf' => "må være en instans av '%s'",
'containsUnique'=> "må inneholde kun unike elementer",
'subset' => "inneholder et element som ikke er i listen"
);

View File

@ -1,35 +0,0 @@
<?php
return array(
'required' => "is verplicht",
'equals' => "moet gelijk zijn aan '%s'",
'different' => "moet verschillend zijn van '%s'",
'accepted' => "moet aanvaard worden",
'numeric' => "moet numeriek zijn",
'integer' => "moet een cijfer zijn",
'length' => "moet minstens %d karakters lang zijn",
'min' => "moet minstens %s zijn",
'max' => "mag niet meer zijn dan %s",
'listContains' => "bevat een ongeldige waarde",
'in' => "bevat een ongeldige waarde",
'notIn' => "bevat een ongeldige waarde",
'ip' => "is geen geldig IP-adres",
'email' => "is geen geldig e-mailadres",
'url' => "is geen geldige URL",
'urlActive' => "moet een actief domein zijn",
'alpha' => "mag enkel letters (a-z) bevatten",
'alphaNum' => "mag enkel letters (a-z) en/of cijfers (0-9) bevatten",
'slug' => "mag enkel letters (a-z), cijfers (0-9) en liggende streepjes (_,-) bevatten",
'regex' => "bevat ongeldige karakters",
'date' => "is geen geldige datum",
'dateFormat' => "moet een datum zijn in het formaat '%s'",
'dateBefore' => "moet een datum voor '%s' zijn",
'dateAfter' => "moet een datum na '%s' zijn",
'contains' => "moet '%s' bevatten",
'boolean' => "moet een booleaanse waarde zijn",
'lengthBetween' => "moet tussen %d en %d karakters lang zijn",
'creditCard' => "moet een geldig kredietkaartnummer zijn",
"lengthMin" => "moet meer dan %d karakters lang zijn",
"lengthMax" => "mag niet meer dan %d karakters lang zijn",
"instanceOf" => "moet een instantie zijn van '%s'"
);

View File

@ -1,35 +0,0 @@
<?php
return array(
'required' => "er nødvendig",
'equals' => "må være de samme som '%s'",
'different' => "må være annerledes enn '%s'",
'accepted' => "må aksepteres",
'numeric' => "må være numerisk",
'integer' => "må være et heltall",
'length' => "må være %d tegn",
'min' => "må være minst %s",
'max' => "må ikke være mer enn %s",
'listContains' => "inneholder ugyldig verdi",
'in' => "inneholder ugyldig verdi",
'notIn' => "inneholder ugyldig verdi",
'ip' => "er ikkje ein gyldig IP Adresse",
'email' => "er ikkje ein gyldig E-post adresse",
'url' => "er ikkje ein gyldig URL",
'urlActive' => "må være eit aktivt domene",
'alpha' => "må bare innholde bokstaver a-z",
'alphaNum' => "må bare innholde bokstaver a-z og/eller tall 0-9",
'slug' => "må bare innholde bokstaver a-z og/eller tall 0-9, bindestreker og understreker",
'regex' => "inneholder ulovlige tegn",
'date' => "er ikkje ein gylid dato",
'dateFormat' => "må være ein dato med formatet '%s'",
'dateBefore' => "må være ein dato før '%s'",
'dateAfter' => "må være ein dato etter '%s'",
'contains' => "må inneholde %s",
'boolean' => "må være ein boolsk verdi",
'lengthBetween' => "må være imellom %d og %d tegn",
'creditCard' => "må være et gyldig kredittkortnummer",
'lengthMin' => "må være minst %d tegn",
'lengthMax' => "må ikkje overstige %d tegn",
'instanceOf' => "må være ein instans av '%s'"
);

View File

@ -1,3 +0,0 @@
<?php
return include __DIR__ . '/nn.php';

View File

@ -1,35 +0,0 @@
<?php
return array(
'required' => "jest wymagane",
'equals' => "musi być takie same jak '%s'",
'different' => "musi być różne od '%s'",
'accepted' => "musi być zaakceptowane",
'numeric' => "musi być liczbą",
'integer' => "musi być liczbą całkowitą",
'length' => "musi być dłuższe niż %d",
'min' => "musi być przynajmniej %s",
'max' => "nie może być większe niż %s",
'listContains' => "zawiera nieprawidłową wartość",
'in' => "zawiera nieprawidłową wartość",
'notIn' => "zawiera nieprawidłową wartość",
'ip' => "nie jest prawidłowym adresem IP",
'email' => "nie jest prawidłowym adresem email",
'url' => "nie jest URL",
'urlActive' => "musi być aktywną domeną",
'alpha' => "musi zawierać tylko litery a-z",
'alphaNum' => "musi zawierać tylko litery a-z i/lub cyfry 0-9",
'slug' => "musi zawierać tylko litery a-z i/lub cyfry 0-9, myślinik I podkreślnik",
'regex' => "zawiera nieprawidłowe znaki",
'date' => "nie jest prawidłową datą",
'dateFormat' => "Data musi być w formacie '%s'",
'dateBefore' => "Data musi występować przed '%s'",
'dateAfter' => "Data musi następować po '%s'",
'contains' => "Musi zawierać %s",
'boolean' => "musi być wartością logiczną",
'lengthBetween' => "ilość znaków musi być między %d a %d",
'creditCard' => "musi być prawidłowym numerem karty kredytowej",
"lengthMin" => "musi zawierać więcej niż %d znaków",
"lengthMax" => "musi zawierać mniej niż %d znaków",
"instanceOf" => "musi być instancją '%s'",
);

View File

@ -1,37 +0,0 @@
<?php
return array(
'required' => "é obrigatório",
'equals' => "deve ser o mesmo que '%s'",
'different' => "deve ser diferente de '%s'",
'accepted' => "deve ser aceito",
'numeric' => "deve ser um número",
'integer' => "deve ser um inteiro",
'length' => "deve ter %d caracteres",
'min' => "deve ser maior que %s",
'max' => "deve ser menor que %s",
'in' => "contém um valor inválido",
'notIn' => "contém um valor inválido",
'ip' => "não é um IP válido",
'email' => "não é um email válido",
'url' => "não é uma URL válida",
'urlActive' => "deve ser um domínio ativo",
'alpha' => "deve conter as letras a-z",
'alphaNum' => "deve conter apenas letras a-z e/ou números 0-9",
'slug' => "deve conter apenas letras a-z, números 0-9, ou os caracteres - ou _",
'regex' => "contém caracteres inválidos",
'date' => "não é uma data válida",
'dateFormat' => "deve ser uma data no formato '%s'",
'dateBefore' => "deve ser uma data anterior a '%s'",
'dateAfter' => "deve ser uma data posterior a '%s'",
'contains' => "deve conter %s",
'boolean' => "deve ser um booleano",
'lengthBetween' => "deve estar entre %d e %d caracteres",
'creditCard' => "deve ser um numero de cartão de credito válido",
'lengthMin' => "deve ter ao menos %d caracteres",
'lengthMax' => "não deve exceder %d caracteres",
'instanceOf' => "deve ser uma instância de '%s'",
'containsUnique' => "deve conter apenas valores únicos",
'subset' => "contém um item que não está na lista",
'arrayHasKeys' => "não contém todas as chaves requeridas"
);

View File

@ -1,35 +0,0 @@
<?php
return array(
'required' => "se cere",
'equals' => "trebuie sa fie la fel ca '%s'",
'different' => "trebuie sa fie diferit de '%s'",
'accepted' => "trebuie sa fie acceptat",
'numeric' => "trebuie sa fie numeric",
'integer' => "trebuie sa fie intreg",
'length' => "trebuie sa fie mai lung decat %d",
'min' => "trebuie sa fie cel putin %s",
'max' => "nu trebuie sa fie mai mult de %s",
'listContains' => "contine caractere invalide",
'in' => "contine caractere invalide",
'notIn' => "contine o valoare invalida",
'ip' => "nu este o adresa IP valida",
'email' => "nu este o adresa de email valida",
'url' => "nu este un URL",
'urlActive' => "trebuie sa fie un domeniu activ",
'alpha' => "trebuie sa contina doar litere de la a-z",
'alphaNum' => "trebuie sa contina doar numere de la a-z si/sau numere 0-9",
'slug' => "trebuie sa contina doar litere de la a-z, numere de la 0-9, cratime si underline '_'",
'regex' => "contine caractere invalide",
'date' => "nu este o data valida",
'dateFormat' => "trebuie sa fie o data care sa aiba forma '%s'",
'dateBefore' => "trebuie sa fie o data inainte de '%s'",
'dateAfter' => "trebuie sa fie o data dupa '%s'",
'contains' => "trebuie sa contina %s",
'boolean' => "trebuie sa fie o constructie logica",
'lengthBetween' => "trebuie sa contina intre %d si %d caractere",
'creditCard' => "trebuie sa fie nu numar de card de credit valid",
"lengthMin" => "trebuie sa contina caractere mai multe decat %d",
"lengthMax" => "trebuie sa contina mai putin de %d caractere",
"instanceOf" => "trebuie sa fie un exemplu de '%s",
);

View File

@ -1,39 +0,0 @@
<?php
return array(
'required' => "обязательно для заполнения",
'equals' => "должно совпадать со значением '%s'",
'different' => "должно отличаться от '%s'",
'accepted' => "должно быть указано",
'numeric' => "должно содержать числовое значение",
'integer' => "должно быть числом",
'length' => "должно быть длиннее, чем %d",
'min' => "должно быть не менее, чем %s",
'max' => "должно быть не более, чем %s",
'listContains' => "содержит неверное значение",
'in' => "содержит неверное значение",
'notIn' => "содержит неверное значение",
'ip' => "не является валидным IP адресом",
'ipv4' => "не является валидным IPv4 адресом",
'ipv6' => "не является валидным IPv6 адресом",
'email' => "не является валидным email адресом",
'url' => "не является валидной ссылкой",
'urlActive' => "содержит не активную ссылку",
'alpha' => "должно содержать только латинские символы",
'alphaNum' => "должно содержать только латинские символы и/или цифры",
'slug' => "должно содержать только латинские символы, цифры, тире и подчёркивания",
'regex' => "содержит недопустимые символы",
'date' => "не является датой",
'dateFormat' => "должно содержать дату следующего формата: %s",
'dateBefore' => "должно содержать дату не позднее, чем %s",
'dateAfter' => "должно содержать дату не ранее, чем %s",
'contains' => "должно содержать %s",
'boolean' => "должно содержать логическое значение",
'lengthBetween' => "должно содержать от %d до %d символов",
'creditCard' => "должно быть номером кредитной карты",
'lengthMin' => "должно содержать более %d символов",
'lengthMax' => "должно содержать менее %d символов",
'instanceOf' => "должно быть объектом класса '%s'",
'containsUnique' => "должно содержать только уникальные элементы",
'subset' => "содержит элемент, не указанный в списке",
);

View File

@ -1,35 +0,0 @@
<?php
return array(
'required' => "je povinná položka",
'equals' => "musí byť rovnaký ako '%s'",
'different' => "musí byť rôzny od '%s'",
'accepted' => "musí byť akceptovaný",
'numeric' => "musí byť číslo",
'integer' => "musí byť celé číslo",
'length' => "musí byť dlhý aspoň %d",
'min' => "musí byť dlhý minimálne %s",
'max' => "musí byť maximálne %s",
'listContains' => "obsahuje nepovolenú hodnotu",
'in' => "obsahuje nepovolenú hodnotu",
'notIn' => "obsahuje nepovolenú hodnotu",
'ip' => "nie je korektná IP adresa",
'email' => "nie je korektný e-mail",
'url' => "nie je URL",
'urlActive' => "musí byť aktívna URL",
'alpha' => "musí obsahovať len písmená a-z",
'alphaNum' => "musí obsahovať len písmená a-z a/alebo čísla 0-9",
'slug' => "musí obsahovať len písmená a-z, čísla 0-9, pomlčky alebo podtržítka",
'regex' => "obsahuje nepovolené znaky",
'date' => "nie je korektný formáť",
'dateFormat' => "musí byť dátum formátu '%s'",
'dateBefore' => "musí byť dátum pred '%s'",
'dateAfter' => "musí byť dátum po '%s'",
'contains' => "musí obsahovať %s",
'boolean' => "musí byť pravdivostná hodnota (boolean)",
'lengthBetween' => "musí byť %d až %d znakov dlhý",
'creditCard' => "musí byť korektné číslo kreditnej karty",
"lengthMin" => "musí byť aspoň %d znakov dlhý",
"lengthMax" => "musí byť najviac %d znakov dlhý",
"instanceOf" => "musí byť inštanciou '%s'"
);

View File

@ -1,42 +0,0 @@
<?php
return array(
'required' => "potrebno",
'equals' => "mora biti enak '% s'",
'different' => "mora biti drugačen od '% s'",
'accepted' => "mora biti označeno",
'numeric' => "mora biti številka",
'integer' => "mora biti celo število",
'length' => "ne sme biti daljši od% d",
'min' => "mora biti večji od% s",
'max' => "mora biti manjši od% s",
'listContains' => "vsebuje neveljavno vrednost",
'in' => "vsebuje neveljavno vrednost",
'notIn' => "vsebuje neveljavno vrednost",
'ip' => "ni veljaven naslov IP",
'ipv4' => "ni veljaven naslov IPv4",
'ipv6' => "ni veljaven naslov IPv6",
'email' => "ni veljaven e-poštni naslov",
'url' => "ni veljaven URL",
'urlActive' => "mora biti aktivna domena",
'alpha' => "mora vsebovati samo črke a-z",
'alphaNum' => "mora vsebovati samo črke a-z in / ali številke 0-9",
'slug' => "mora vsebovati samo črke a-z, številke 0-9, črtice in podčrtaje",
'regex' => "vsebuje neveljavne znake",
'date' => "ni veljaven datum",
'dateFormat' => "mora biti datum s formatom '% s'",
'dateBefore' => "mora biti datum pred '% s'",
'dateAfter' => "mora biti datum za '% s'",
'contains' => "mora vsebovati% s",
'boolean' => "mora biti boolean",
'lengthBetween' => "mora biti med% d in% d znaki",
'creditCard' => "mora biti veljavna številka kreditne kartice",
'lengthMin' => "mora biti dolg vsaj% d znakov",
'lengthMax' => "ne sme presegati% d znakov",
'instanceOf' => "mora biti primerek '% s'",
'containsUnique' => "mora vsebovati samo edinstvene elemente",
'requiredWith' => "je potrebno",
'requiredWithout'=> "je potrebno",
'subset' => "vsebuje element, ki ga ni na seznamu",
'arrayHasKeys' => "ne vsebuje vseh potrebnih tipk",
);

View File

@ -1,35 +0,0 @@
<?php
return array(
'required' => "är obligatorisk",
'equals' => "måste vara samma som '%s'",
'different' => "får inte vara samma som '%s'",
'accepted' => "måste accepteras",
'numeric' => "måste vara numerisk",
'integer' => "måste vara ett heltal",
'length' => "måste vara %d tecken långt",
'min' => "måste vara minst %s",
'max' => "får inte vara mer än %s",
'listContains' => "innehåller ogiltigt värde",
'in' => "innehåller ogiltigt värde",
'notIn' => "innehåller ogiltigt värde",
'ip' => "är inte en giltig IP-adress",
'email' => "är inte en giltig e-postadress",
'url' => "är inte en giltig URL",
'urlActive' => "måste vara ett aktivt domännamn",
'alpha' => "får bara innehålla bokstäver a-z",
'alphaNum' => "får bara innehålla bokstäver a-z och/eller siffror 0-9",
'slug' => "får bara innehålla bokstäver a-z och/eller siffror 0-9, bindesstreck och understreck",
'regex' => "innehåller ogiltiga tecken",
'date' => "är inte ett giltigt datum",
'dateFormat' => "måste vara ett datum med formatet '%s'",
'dateBefore' => "måste vara ett datum före '%s'",
'dateAfter' => "måste vara ett datum efter '%s'",
'contains' => "måste innehålla %s",
'boolean' => "måste vara ett booleskt värde",
'lengthBetween' => "måste vara mellan %d och %d tecken långt",
'creditCard' => "måste vara ett giltigt kreditkortsnummer",
'lengthMin' => "måste vara minst %d tecken långt",
'lengthMax' => "får inte överstiga %d tecken",
'instanceOf' => "måste vara en instans av '%s'"
);

View File

@ -1,35 +0,0 @@
<?php
return array(
'required' => "นั้นจำเป็นต้องมี",
'equals' => "ต้องเหมือนกับ '%s'",
'different' => "ต้องแตกต่างจาก '%s'",
'accepted' => "ต้องถูกยอมรับ",
'numeric' => "ต้องเป็นตัวเลข",
'integer' => "ต้องเป็นตัวเลข integer",
'length' => "ต้องมีความยาวมากกว่า %d",
'min' => "ต้องมีอย่างน้อย %s",
'max' => "ต้องไม่มากเกิน %s",
'listContains' => "ประกอบด้วยค่าที่ไม่ถูกต้อง",
'in' => "ประกอบด้วยค่าที่ไม่ถูกต้อง",
'notIn' => "ประกอบด้วยค่าที่ไม่ถูกต้อง",
'ip' => "ไม่ใช่ IP ที่ถูกต้อง",
'email' => "ไม่ใช่อีเมลที่ถูกต้อง",
'url' => "ไม่ใช่ลิงก์",
'urlActive' => "ต้องไม่ใช่โดเมนที่ใช้งานอยู่",
'alpha' => "ต้องมีแค่ตัวอักษร a-z",
'alphaNum' => "ต้องมีแค่ตัวอักษร a-z และ/หรือ ตัวเลข 0-9",
'slug' => "ต้องมีแค่ตัวอักษร a-z ตัวเลข 0-9 / และ _",
'regex' => "มีตัวอักษรที่ไม่ถูกต้อง",
'date' => "ไม่ใช่วันที่ที่ถูกต้อง",
'dateFormat' => "ต้องเป็นวันที่ในรูปแบบ '%s'",
'dateBefore' => "ต้องเป็นวันที่ก่อน '%s'",
'dateAfter' => "ต้องเป็นวันที่หลัง '%s'",
'contains' => "ต้องมี %s",
'boolean' => "ต้องเป็น boolean",
'lengthBetween' => "ต้องอยู่ระหว่าง %d ถึง %d ตัวอักษร",
'creditCard' => "ต้องเป็นหมายเลขบัตรเครดิตที่ถูกต้อง",
"lengthMin" => "ต้องมีมากกว่า %d ตัวอักษร",
"lengthMax" => "ต้องมีน้อยกว่า %d ตัวอักษร",
"instanceOf" => "ต้องเป็นส่วนหนึ่งของ '%s'"
);

View File

@ -1,35 +0,0 @@
<?php
return array(
'required' => "gerekli ",
'equals' => "bununla aynı olmalı '%s'",
'different' => "bundan değişik olmalı '%s'",
'accepted' => "kabul edilebilir olmalı",
'numeric' => "numerik olmalı",
'integer' => "sayı olmalı",
'length' => "en az %d adet uzunluğunda olmalı",
'min' => "en az böyle olmalı %s",
'max' => "bundan daha fazla olmalı %s",
'listContains' => "geçersiz değer içeriyor",
'in' => "geçersiz değer içeriyor",
'notIn' => "geçersiz değer içeriyor",
'ip' => "geçerli bir IP adresi değil",
'email' => "geçerli bir eposta adresi değil",
'url' => "bir URL değil",
'urlActive' => "aktif bir alan adı olmalı",
'alpha' => "sadece harf içermeli a-z",
'alphaNum' => "sadece harf (a-z) ve/veya sayılar (0-9) içermeli",
'slug' => "sadece harf (a-z), numbers sayılar (0-9), tire ve alt tire içermeli",
'regex' => "geçersiz karakterler içeriyor",
'date' => "geçerli bir karakter değil",
'dateFormat' => "bu biçimde bir tarih olmalı '%s'",
'dateBefore' => "bu tarihden önce olmalı '%s'",
'dateAfter' => "bu tarihden sonra olmalı '%s'",
'contains' => "bunu içermeli %s",
'boolean' => "boolean olmalı",
'lengthBetween' => "%d ve %d karakter arasında olmalı",
'creditCard' => "geçerli bir kredi kartı numarası olmalı",
"lengthMin" => "%d karakterden fazla içermeli",
"lengthMax" => "%d karakterden az içermeli",
"instanceOf" => "bunun bir örneği olmalı '%s'"
);

View File

@ -1,34 +0,0 @@
<?php
return array(
'required' => "обов'язкове для заповнення",
'equals' => "має містити '%s'",
'different' => "має відрізнятися від '%s'",
'accepted' => "має бути вказаним",
'numeric' => "має містити числове значення",
'integer' => "має бути числом",
'length' => "має бути довшим, ніж %d",
'min' => "має бути більше, ніж %s",
'max' => "повинно бути менше, ніж %s",
'listContains' => "містить невірне значення",
'in' => "містить невірне значення",
'notIn' => "містить невірне значення",
'ip' => "не є валідною IP адресою",
'email' => "не є валідною email адресою",
'url' => "не є посиланням",
'urlActive' => "містить не активне посилання",
'alpha' => "повинно містити тільки латинські символи",
'alphaNum' => "повинно містити тільки латинські символи та/або цифри",
'slug' => "повинно містити тільки латинські символи, цифри, тире і підкреслення",
'regex' => "містить неприпустимі символи",
'date' => "не є датою",
'dateFormat' => "має містити дату наступного формату:%s",
'dateBefore' => "має містити дату не пізнішу, ніж %s",
'dateAfter' => "має містити дату не ранішу, ніж %s",
'contains' => "має містити %s",
'boolean' => "має містити логічне значення",
'lengthBetween' => "має містити від %d в до %d символів",
'creditCard' => "має бути номером кредитної картки",
"lengthMin" => "має містити більше %d символів",
"lengthMax" => "має містити менше %d символів"
);

View File

@ -1,35 +0,0 @@
<?php
return array(
'required' => "là bắt buộc",
'equals' => "phải giống '%s'",
'different' => "phải khác '%s'",
'accepted' => "được chấp nhận",
'numeric' => "phải là số",
'integer' => "phải là số nguyên",
'length' => "phải dài hơn %d",
'min' => "ít nhất %s",
'max' => "tối đa %s",
'listContains' => "chứa giá trị không hợp lệ",
'in' => "chứa giá trị không hợp lệ",
'notIn' => "chứa giá trị không hợp lệ",
'ip' => "địa chỉ IP không hợp lệ",
'email' => "địa chỉ email không hợp lệ",
'url' => "không phải là URL",
'urlActive' => "Domain chưa được kích hoạt",
'alpha' => "chỉ chứa các kí tự a-z",
'alphaNum' => "chỉ chứa các kí tự a-z hoặc số 0-9",
'slug' => "chỉ chứa các kí tự a-z, số 0-9, gạch nối và gạch dưới",
'regex' => "chứa kí tự không hợp lệ",
'date' => "thời gian hợp lệ",
'dateFormat' => "thời gian nên được định dạng '%s'",
'dateBefore' => "thời gian nên trước '%s'",
'dateAfter' => "thời gian nên sau '%s'",
'contains' => "phải chứa %s",
'boolean' => "phải là boolean",
'lengthBetween' => "phải từ %d đến %d kí tự",
'creditCard' => "credit card không hợp lệ",
"lengthMin" => "ít nhất %d kí tự",
"lengthMax" => "tối đa %d kí tự",
"instanceOf" => "phải là instance của '%s'"
);

View File

@ -1,40 +1,29 @@
<?php
return array(
'required' => "不能为空",
'equals' => "必须和 '%s' 一致",
'different' => "必须和 '%s' 不一致",
'accepted' => "必须接受",
'numeric' => "只能是数字",
'integer' => "只能是整数",
'length' => "长度必须等于 %d",
'min' => "必须大于 %s",
'max' => "必须小于 %s",
'listContains' => "无效的值",
'in' => "无效的值",
'notIn' => "无效的值",
'ip' => "无效IP地址",
'email' => "无效邮箱地址",
'url' => "无效的URL",
'urlActive' => "必须是可用的域名",
'alpha' => "只能包括英文字母(a-z)",
'alphaNum' => "只能包括英文字母(a-z)和数字(0-9)",
'slug' => "只能包括英文字母(a-z)、数字(0-9)、破折号和下划线",
'regex' => "无效格式",
'date' => "无效的日期",
'dateFormat' => "日期的格式应该为 '%s'",
'dateBefore' => "日期必须在 '%s' 之前",
'dateAfter' => "日期必须在 '%s' 之后",
'contains' => "必须包含 %s",
'boolean' => "必须是真或假",
'lengthBetween' => "长度只能介于 %d 和 %d 之间",
'creditCard' => "信用卡号码不正确",
'lengthMin' => "长度必须大于 %d",
'lengthMax' => "长度必须小于 %d",
'instanceOf' => "必须是 '%s' 的实例",
'containsUnique' => "必须仅包含唯一的元素",
'requiredWith' => "是必须的",
'requiredWithout' => "是必须的",
'subset' => "包含不在列表中的项目",
'arrayHasKeys' => "不包含所有必需的键",
'required' => "不能为空",
'equals' => "必须和 '%s' 一致",
'different' => "必须和 '%s' 不一致",
'accepted' => "必须接受",
'numeric' => "只能是数字",
'integer' => "只能是整数(0-9)",
'length' => "长度必须大于 %d",
'min' => "必须大于 %s",
'max' => "必须小于 %s",
'in' => "无效的值",
'notIn' => "无效的值",
'ip' => "无效IP地址",
'email' => "无效邮箱地址",
'url' => "无效的URL",
'urlActive' => "必须是可用的域名",
'alpha' => "只能包括英文字母(a-z)",
'alphaNum' => "只能包括英文字母(a-z)和数字(0-9)",
'slug' => "只能包括英文字母(a-z)、数字(0-9)、破折号和下划线",
'regex' => "无效格式",
'date' => "无效的日期",
'dateFormat' => "日期的格式应该为 '%s'",
'dateBefore' => "日期必须在 '%s' 之前",
'dateAfter' => "日期必须在 '%s' 之后",
'contains' => "必须包含 %s"
);

View File

@ -1,40 +0,0 @@
<?php
return array(
'required' => "不能為空",
'equals' => "必須和 '%s' 一致",
'different' => "必須和 '%s' 不一致",
'accepted' => "必須接受",
'numeric' => "只能是數字",
'integer' => "只能是整數",
'length' => "長度必須大於 %d",
'min' => "必須大於 %s",
'max' => "必須小於 %s",
'listContains' => "無效的值",
'in' => "無效的值",
'notIn' => "無效的值",
'ip' => "無效IP地址",
'email' => "無效郵箱地址",
'url' => "無效的URL",
'urlActive' => "必須是可用的域名",
'alpha' => "只能包括英文字母(a-z)",
'alphaNum' => "只能包括英文字母(a-z)和數字(0-9)",
'slug' => "只能包括英文字母(a-z)、數字(0-9)、破折號和下劃線",
'regex' => "無效格式",
'date' => "無效的日期",
'dateFormat' => "日期的格式應該為 '%s'",
'dateBefore' => "日期必須在 '%s' 之前",
'dateAfter' => "日期必須在 '%s' 之後",
'contains' => "必須包含 %s",
'boolean' => "必須是真或假",
'lengthBetween' => "長度只能介於 %d 和 %d 之間",
'creditCard' => "信用卡號碼不正確",
'lengthMin' => "長度必須大於 %d",
'lengthMax' => "長度必須小於 %d",
'instanceOf' => "必須是 '%s' 的實例",
'containsUnique' => "必須僅包含唯一的元素",
'requiredWith' => "是必須的",
'requiredWithout' => "是必須的",
'subset' => "包含不在列表中的項目",
'arrayHasKeys' => "不包含所有必需的鍵",
);

View File

@ -7,11 +7,12 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
>
<testsuites>
<testsuite name="Valitron Test Suite">
<directory suffix="Test.php">tests/Valitron</directory>
<directory suffix=".php">tests/Valitron</directory>
</testsuite>
</testsuites>
</phpunit>

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +0,0 @@
<?php
use PHPUnit\Framework\TestCase;
class BaseTestCase extends TestCase
{
/*
public function tearDown()
{
$this->resetProperty('_lang');
$this->resetProperty('_langDir');
$this->resetProperty('_rules', array());
$this->resetProperty('_ruleMessages', array());
}
protected function resetProperty($name, $value = null)
{
$prop = new \ReflectionProperty('Valitron\Validator', $name);
$prop->setAccessible(true);
$prop->setValue($value);
$prop->setAccessible(false);
}
*/
}

View File

@ -1,8 +1,7 @@
<?php
use Valitron\Validator;
class ErrorMessagesTest extends BaseTestCase
class ErrorMessagesTest extends \PHPUnit_Framework_TestCase
{
public function testErrorMessageIncludesFieldName()
{
@ -12,25 +11,12 @@ class ErrorMessagesTest extends BaseTestCase
$this->assertSame(array("Name is required"), $v->errors('name'));
}
/**
* Test the disabling of prepending the field labels
* to error messages.
*/
public function testErrorMessageExcludeFieldName()
{
$v = new Validator(array());
$v->setPrependLabels(false);
$v->rule('required', 'name');
$v->validate();
$this->assertSame(array("is required"), $v->errors('name'));
}
public function testAccurateErrorMessageParams()
{
$v = new Validator(array('num' => 5));
$v->rule('min', 'num', 6);
$v->validate();
$this->assertSame(array("Num must be at least 6"), $v->errors('num'));
$this->assertSame(array("Num must be greater than 6"), $v->errors('num'));
}
public function testCustomErrorMessage()
@ -71,21 +57,5 @@ class ErrorMessagesTest extends BaseTestCase
$errors = $v->errors();
$this->assertEquals($messages, $errors);
}
public function testMessageWithFieldSet()
{
$v = new Validator(array('name' => ''), array(), 'en', __DIR__ . '/../lang');
$v->rule('required', 'name');
$v->validate();
$this->assertEquals($v->errors('name'), array('A value is required for Name'));
}
public function testMessageWithFieldAndLabelSet()
{
$v = new Validator(array('name' => ''), array(), 'en', __DIR__ . '/../lang');
$v->rule('required', 'name')->label('my name');
$v->validate();
$this->assertEquals($v->errors('name'), array('A value is required for my name'));
}
}

View File

@ -1,64 +0,0 @@
<?php
use Valitron\Validator;
class LangTest extends BaseTestCase
{
protected function getLangDir()
{
return __DIR__.'/../../lang';
}
/**
* Lang defined statically should not be override by constructor default
*/
public function testLangDefinedStatically()
{
$lang = 'ar';
Validator::lang($lang);
$this->assertEquals($lang, Validator::lang());
Validator::lang('en');
}
/**
* LangDir defined statically should not be override by constructor default
*/
public function testLangDirDefinedStatically()
{
$langDir = $this->getLangDir();
Validator::langDir($langDir);
$validator = new Validator(array());
$this->assertEquals($langDir, Validator::langDir());
}
public function testDefaultLangShouldBeEn()
{
$validator = new Validator(array());
$this->assertEquals('en', Validator::lang());
}
public function testDefaultLangDirShouldBePackageLangDir()
{
$validator = new Validator(array());
$this->assertEquals(realpath($this->getLangDir()), realpath(Validator::langDir()));
}
public function testLangException()
{
try{
new Validator(array(), array(), 'en', '/this/dir/does/not/exists');
} catch (Exception $exception){
$this->assertInstanceOf("InvalidArgumentException", $exception);
$this->assertEquals("Fail to load language file '/this/dir/does/not/exists/en.php'", $exception->getMessage());
}
}
public function testLoadingNorwegianLoadsNNVariant(){
$validator = new Validator(array(), array(),'no', $this->getLangDir());
$validator->rule('required','test');
$validator->validate();
$errors =$validator->errors('test');
$this->assertEquals('Test er nødvendig', $errors[0]);
}
}

View File

@ -1,102 +0,0 @@
<?php
use Valitron\Validator;
class MapRulesTest extends BaseTestCase
{
public function testMapSingleFieldRules()
{
$rules = array(
'required',
array('lengthMin', 4)
);
$v = new Validator(array());
$v->mapFieldRules('myField', $rules);
$this->assertFalse($v->validate());
$this->assertEquals(2, sizeof($v->errors('myField')));
$v2 = new Validator(array('myField' => 'myVal'));
$v2->mapFieldRules('myField', $rules);
$this->assertTrue($v2->validate());
}
public function testSingleFieldDot()
{
$v = new Valitron\Validator(array(
'settings' => array(
array('threshold' => 50),
array('threshold' => 90)
)
));
$v->mapFieldRules('settings.*.threshold', array(
array('max', 50)
));
$this->assertFalse($v->validate());
}
public function testMapMultipleFieldsRules()
{
$rules = array(
'myField1' => array(
'required',
array('lengthMin', 4)
),
'myField2' => array(
'required',
array('lengthMin', 5)
)
);
$v = new Validator(array(
'myField1' => 'myVal'
));
$v->mapFieldsRules($rules);
$this->assertFalse($v->validate());
$this->assertFalse($v->errors('myField1'));
$this->assertEquals(2, sizeof($v->errors('myField2')));
}
public function testCustomMessageSingleField()
{
$rules = array(
array('lengthMin', 14, 'message' => 'My Custom Error')
);
$v = new Validator(array(
'myField' => 'myVal'
));
$v->mapFieldRules('myField', $rules);
$this->assertFalse($v->validate());
$errors = $v->errors('myField');
$this->assertEquals('My Custom Error', $errors[0]);
}
public function testCustomMessageMultipleFields()
{
$rules = array(
'myField1' => array(
array('lengthMin', 14, 'message' => 'My Custom Error 1')
),
'myField2' => array(
array('lengthMin', 14, 'message' => 'My Custom Error 2')
)
);
$v = new Validator(array(
'myField1' => 'myVal',
'myField2' => 'myVal',
));
$v->mapFieldsRules($rules);
$this->assertFalse($v->validate());
$errors1 = $v->errors('myField1');
$this->assertEquals('My Custom Error 1', $errors1[0]);
$errors2 = $v->errors('myField2');
$this->assertEquals('My Custom Error 2', $errors2[0]);
}
}

View File

@ -1,32 +0,0 @@
<?php
use Valitron\Validator;
class StaticVsInstanceTest extends BaseTestCase
{
public function testInstanceOverrideStaticLang()
{
Validator::lang('ar');
new Validator(array(), array(), 'en');
$this->assertEquals(
'ar', Validator::lang(), 'instance defined lang should not replace static global lang'
);
Validator::lang('en');
}
/**
* Fix bug where rules messages added with Validator::addRule were replaced after creating validator instance
*/
public function testRuleMessagesReplacedAfterConstructor()
{
$customMessage = 'custom message';
$ruleName = 'customRule';
$fieldName = 'fieldName';
Validator::addRule($ruleName, function() {}, $customMessage);
$v = new Validator(array($fieldName => $fieldName));
$v->rule($ruleName, $fieldName);
$v->validate();
$messages = $v->errors();
$this->assertArrayHasKey($fieldName, $messages);
$this->assertEquals(ucfirst("$fieldName $customMessage"), $messages[$fieldName][0]);
}
}

View File

@ -1,28 +0,0 @@
<?php
use Valitron\Validator;
class StopOnFirstFail extends BaseTestCase
{
public function testStopOnFirstFail()
{
$rules = array(
'myField1' => array(
array('lengthMin', 5, 'message' => 'myField1 must be 5 characters minimum'),
array('url', 'message' => 'myField1 is not a valid url'),
array('urlActive', 'message' => 'myField1 is not an active url')
)
);
$v = new Validator(array(
'myField1' => 'myVal'
));
$v->mapFieldsRules($rules);
$v->stopOnFirstFail(true);
$this->assertFalse($v->validate());
$errors = $v->errors();
$this->assertCount(1, $errors['myField1']);
}
}

619
tests/Valitron/Validate.php Normal file
View File

@ -0,0 +1,619 @@
<?php
use Valitron\Validator;
class ValidateTest extends \PHPUnit_Framework_TestCase
{
public function testValidWithNoRules()
{
$v = new Validator(array('name' => 'Chester Tester'));
$this->assertTrue($v->validate());
}
public function testOptionalFieldFilter()
{
$v = new Validator(array('foo' => 'bar', 'bar' => 'baz'), array('foo'));
$this->assertEquals($v->data(), array('foo' => 'bar'));
}
public function testAccurateErrorCount()
{
$v = new Validator(array('name' => 'Chester Tester'));
$v->rule('required', 'name');
$this->assertSame(1, count($v->errors('name')));
}
public function testArrayOfFieldsToValidate()
{
$v = new Validator(array('name' => 'Chester Tester', 'email' => 'chester@tester.com'));
$v->rule('required', array('name', 'email'));
$this->assertTrue($v->validate());
}
public function testArrayOfFieldsToValidateOneEmpty()
{
$v = new Validator(array('name' => 'Chester Tester', 'email' => ''));
$v->rule('required', array('name', 'email'));
$this->assertFalse($v->validate());
}
public function testRequiredValid()
{
$v = new Validator(array('name' => 'Chester Tester'));
$v->rule('required', 'name');
$this->assertTrue($v->validate());
}
public function testRequiredNonExistentField()
{
$v = new Validator(array('name' => 'Chester Tester'));
$v->rule('required', 'nonexistent_field');
$this->assertFalse($v->validate());
}
public function testEqualsValid()
{
$v = new Validator(array('foo' => 'bar', 'bar' => 'bar'));
$v->rule('equals', 'foo', 'bar');
$this->assertTrue($v->validate());
}
public function testEqualsInvalid()
{
$v = new Validator(array('foo' => 'foo', 'bar' => 'bar'));
$v->rule('equals', 'foo', 'bar');
$this->assertFalse($v->validate());
}
public function testDifferentValid()
{
$v = new Validator(array('foo' => 'bar', 'bar' => 'baz'));
$v->rule('different', 'foo', 'bar');
$this->assertTrue($v->validate());
}
public function testDifferentInvalid()
{
$v = new Validator(array('foo' => 'baz', 'bar' => 'baz'));
$v->rule('different', 'foo', 'bar');
$this->assertFalse($v->validate());
}
public function testAcceptedValid()
{
$v = new Validator(array('agree' => 'yes'));
$v->rule('accepted', 'agree');
$this->assertTrue($v->validate());
}
public function testAcceptedInvalid()
{
$v = new Validator(array('agree' => 'no'));
$v->rule('accepted', 'agree');
$this->assertFalse($v->validate());
}
public function testNumericValid()
{
$v = new Validator(array('num' => '42.341569'));
$v->rule('numeric', 'num');
$this->assertTrue($v->validate());
}
public function testNumericInvalid()
{
$v = new Validator(array('num' => 'nope'));
$v->rule('numeric', 'num');
$this->assertFalse($v->validate());
}
public function testIntegerValid()
{
$v = new Validator(array('num' => '41243'));
$v->rule('integer', 'num');
$this->assertTrue($v->validate());
}
public function testIntegerInvalid()
{
$v = new Validator(array('num' => '42.341569'));
$v->rule('integer', 'num');
$this->assertFalse($v->validate());
}
public function testLengthValid()
{
$v = new Validator(array('str' => 'happy'));
$v->rule('length', 'str', 5);
$this->assertTrue($v->validate());
}
public function testLengthInvalid()
{
$v = new Validator(array('str' => 'sad'));
$v->rule('length', 'str', 6);
$this->assertFalse($v->validate());
}
public function testLengthBetweenValid()
{
$v = new Validator(array('str' => 'happy'));
$v->rule('length', 'str', 2, 8);
$this->assertTrue($v->validate());
}
public function testLengthBetweenInvalid()
{
$v = new Validator(array('str' => 'sad'));
$v->rule('length', 'str', 4, 10);
$this->assertFalse($v->validate());
}
public function testMinValid()
{
$v = new Validator(array('num' => 5));
$v->rule('min', 'num', 2);
$this->assertTrue($v->validate());
}
public function testMinInvalid()
{
$v = new Validator(array('num' => 5));
$v->rule('min', 'num', 6);
$this->assertFalse($v->validate());
}
public function testMaxValid()
{
$v = new Validator(array('num' => 5));
$v->rule('max', 'num', 6);
$this->assertTrue($v->validate());
}
public function testMaxInvalid()
{
$v = new Validator(array('num' => 5));
$v->rule('max', 'num', 4);
$this->assertFalse($v->validate());
}
public function testInValid()
{
$v = new Validator(array('color' => 'green'));
$v->rule('in', 'color', array('red', 'green', 'blue'));
$this->assertTrue($v->validate());
}
public function testInInvalid()
{
$v = new Validator(array('color' => 'yellow'));
$v->rule('in', 'color', array('red', 'green', 'blue'));
$this->assertFalse($v->validate());
}
public function testNotInValid()
{
$v = new Validator(array('color' => 'yellow'));
$v->rule('notIn', 'color', array('red', 'green', 'blue'));
$this->assertTrue($v->validate());
}
public function testNotInInvalid()
{
$v = new Validator(array('color' => 'blue'));
$v->rule('notIn', 'color', array('red', 'green', 'blue'));
$this->assertFalse($v->validate());
}
public function testIpValid()
{
$v = new Validator(array('ip' => '127.0.0.1'));
$v->rule('ip', 'ip');
$this->assertTrue($v->validate());
}
public function testIpInvalid()
{
$v = new Validator(array('ip' => 'buy viagra now!'));
$v->rule('ip', 'ip');
$this->assertFalse($v->validate());
}
public function testEmailValid()
{
$v = new Validator(array('name' => 'Chester Tester', 'email' => 'chester@tester.com'));
$v->rule('email', 'email');
$this->assertTrue($v->validate());
}
public function testEmailInvalid()
{
$v = new Validator(array('name' => 'Chester Tester', 'email' => 'chestertesterman'));
$v->rule('email', 'email');
$this->assertFalse($v->validate());
}
public function testUrlValid()
{
$v = new Validator(array('website' => 'http://google.com'));
$v->rule('url', 'website');
$this->assertTrue($v->validate());
}
public function testUrlInvalid()
{
$v = new Validator(array('website' => 'shoobedobop'));
$v->rule('url', 'website');
$this->assertFalse($v->validate());
}
public function testUrlActive()
{
$v = new Validator(array('website' => 'http://google.com'));
$v->rule('urlActive', 'website');
$this->assertTrue($v->validate());
}
public function testUrlInactive()
{
$v = new Validator(array('website' => 'http://sonotgoogleitsnotevenfunny.dev'));
$v->rule('urlActive', 'website');
$this->assertFalse($v->validate());
}
public function testAlphaValid()
{
$v = new Validator(array('test' => 'abcDEF'));
$v->rule('alpha', 'test');
$this->assertTrue($v->validate());
}
public function testAlphaInvalid()
{
$v = new Validator(array('test' => 'abc123'));
$v->rule('alpha', 'test');
$this->assertFalse($v->validate());
}
public function testAlphaNumValid()
{
$v = new Validator(array('test' => 'abc123'));
$v->rule('alphaNum', 'test');
$this->assertTrue($v->validate());
}
public function testAlphaNumInvalid()
{
$v = new Validator(array('test' => 'abc123$%^'));
$v->rule('alphaNum', 'test');
$this->assertFalse($v->validate());
}
public function testAlphaDashValid()
{
$v = new Validator(array('test' => 'abc-123_DEF'));
$v->rule('slug', 'test');
$this->assertTrue($v->validate());
}
public function testAlphaDashInvalid()
{
$v = new Validator(array('test' => 'abc-123_DEF $%^'));
$v->rule('slug', 'test');
$this->assertFalse($v->validate());
}
public function testRegexValid()
{
$v = new Validator(array('test' => '42'));
$v->rule('regex', 'test', '/[\d]+/');
$this->assertTrue($v->validate());
}
public function testRegexInvalid()
{
$v = new Validator(array('test' => 'istheanswer'));
$v->rule('regex', 'test', '/[\d]+/');
$this->assertFalse($v->validate());
}
public function testDateValid()
{
$v = new Validator(array('date' => '2013-01-27'));
$v->rule('date', 'date');
$this->assertTrue($v->validate());
}
public function testDateInvalid()
{
$v = new Validator(array('date' => 'no thanks'));
$v->rule('date', 'date');
$this->assertFalse($v->validate());
}
/**
* @group issue-13
*/
public function testDateValidWhenEmptyButNotRequired()
{
$v = new Validator(array('date' => ''));
$v->rule('date', 'date');
$this->assertTrue($v->validate());
}
public function testDateFormatValid()
{
$v = new Validator(array('date' => '2013-01-27'));
$v->rule('dateFormat', 'date', 'Y-m-d');
$this->assertTrue($v->validate());
}
public function testDateFormatInvalid()
{
$v = new Validator(array('date' => 'no thanks'));
$v->rule('dateFormat', 'date', 'Y-m-d');
$this->assertFalse($v->validate());
}
public function testDateBeforeValid()
{
$v = new Validator(array('date' => '2013-01-27'));
$v->rule('dateBefore', 'date', new \DateTime('2013-01-28'));
$this->assertTrue($v->validate());
}
public function testDateBeforeInvalid()
{
$v = new Validator(array('date' => '2013-01-27'));
$v->rule('dateBefore', 'date', '2013-01-26');
$this->assertFalse($v->validate());
}
public function testDateAfterValid()
{
$v = new Validator(array('date' => '2013-01-27'));
$v->rule('dateAfter', 'date', new \DateTime('2013-01-26'));
$this->assertTrue($v->validate());
}
public function testDateAfterInvalid()
{
$v = new Validator(array('date' => '2013-01-27'));
$v->rule('dateAfter', 'date', '2013-01-28');
$this->assertFalse($v->validate());
}
public function testContainsValid()
{
$v = new Validator(array('test_string' => 'this is a test'));
$v->rule('contains', 'test_string', 'a test');
$this->assertTrue($v->validate());
}
public function testContainsNotFound()
{
$v = new Validator(array('test_string' => 'this is a test'));
$v->rule('contains', 'test_string', 'foobar');
$this->assertFalse($v->validate());
}
public function testContainsInvalidValue()
{
$v = new Validator(array('test_string' => 'this is a test'));
$v->rule('contains', 'test_string', array('test'));
$this->assertFalse($v->validate());
}
public function testAcceptBulkRulesWithSingleParams()
{
$rules = array(
'required' => 'nonexistent_field',
'accepted' => 'foo',
'integer' => 'foo'
);
$v1 = new Validator(array('foo' => 'bar', 'bar' => 'baz'));
$v1->rules($rules);
$v1->validate();
$v2 = new Validator(array('foo' => 'bar', 'bar' => 'baz'));
$v2->rule('required', 'nonexistent_field');
$v2->rule('accepted', 'foo');
$v2->rule('integer', 'foo');
$v2->validate();
$this->assertEquals($v1->errors(), $v2->errors());
}
public function testAcceptBulkRulesWithMultipleParams()
{
$rules = array(
'required' => array(
array(array('nonexistent_field', 'other_missing_field'))
),
'equals' => array(
array('foo', 'bar')
),
'length' => array(
array('foo', 5)
)
);
$v1 = new Validator(array('foo' => 'bar', 'bar' => 'baz'));
$v1->rules($rules);
$v1->validate();
$v2 = new Validator(array('foo' => 'bar', 'bar' => 'baz'));
$v2->rule('required', array('nonexistent_field', 'other_missing_field'));
$v2->rule('equals', 'foo', 'bar');
$v2->rule('length', 'foo', 5);
$v2->validate();
$this->assertEquals($v1->errors(), $v2->errors());
}
public function testAcceptBulkRulesWithNestedRules()
{
$rules = array(
'length' => array(
array('foo', 5),
array('bar', 5)
)
);
$v1 = new Validator(array('foo' => 'bar', 'bar' => 'baz'));
$v1->rules($rules);
$v1->validate();
$v2 = new Validator(array('foo' => 'bar', 'bar' => 'baz'));
$v2->rule('length', 'foo', 5);
$v2->rule('length', 'bar', 5);
$v2->validate();
$this->assertEquals($v1->errors(), $v2->errors());
}
public function testAcceptBulkRulesWithNestedRulesAndMultipleFields()
{
$rules = array(
'length' => array(
array(array('foo', 'bar'), 5),
array('baz', 5)
)
);
$v1 = new Validator(array('foo' => 'bar', 'bar' => 'baz', 'baz' => 'foo'));
$v1->rules($rules);
$v1->validate();
$v2 = new Validator(array('foo' => 'bar', 'bar' => 'baz', 'baz' => 'foo'));
$v2->rule('length', array('foo', 'bar'), 5);
$v2->rule('length', 'baz', 5);
$v2->validate();
$this->assertEquals($v1->errors(), $v2->errors());
}
public function testAcceptBulkRulesWithMultipleArrayParams()
{
$rules = array(
'in' => array(
array(array('foo', 'bar'), array('x', 'y'))
)
);
$v1 = new Validator(array('foo' => 'bar', 'bar' => 'baz', 'baz' => 'foo'));
$v1->rules($rules);
$v1->validate();
$v2 = new Validator(array('foo' => 'bar', 'bar' => 'baz', 'baz' => 'foo'));
$v2->rule('in', array('foo', 'bar'), array('x', 'y'));
$v2->validate();
$this->assertEquals($v1->errors(), $v2->errors());
}
public function testCustomLabelInMessage()
{
$v = new Valitron\Validator(array());
$v->rule('required', 'name')->message('{field} is required')->label('NAME!!!');
$v->validate();
$this->assertEquals(array('NAME!!! is required'), $v->errors('name'));
}
public function testCustomLabelArrayInMessage()
{
$v = new Valitron\Validator(array());
$v->rule('required', array('name', 'email'))->message('{field} is required');
$v->labels(array(
'name' => 'Name',
'email' => 'Email address'
));
$v->validate();
$this->assertEquals(array(
'name' => array('Name is required'),
'email' => array('Email address is required')
), $v->errors());
}
/**
* Custom rules and callbacks
*/
public function testAddRuleClosure()
{
$v = new Validator(array('name' => 'Chester Tester'));
$v->addRule('testRule', function() { return true; });
$v->rule('testRule', 'name');
$this->assertTrue($v->validate());
}
public function testAddRuleClosureReturnsFalse()
{
$v = new Validator(array('name' => 'Chester Tester'));
$v->addRule('testRule', function() { return false; });
$v->rule('testRule', 'name');
$this->assertFalse($v->validate());
}
public function testAddRuleClosureWithFieldArray()
{
$v = new Validator(array('name' => 'Chester Tester', 'email' => 'foo@example.com'));
$v->addRule('testRule', function() { return true; });
$v->rule('testRule', array('name', 'email'));
$this->assertTrue($v->validate());
}
public function testAddRuleClosureWithArrayAsExtraParameter()
{
$v = new Validator(array('name' => 'Chester Tester'));
$v->addRule('testRule', function() { return true; });
$v->rule('testRule', 'name', array('foo', 'bar'));
$this->assertTrue($v->validate());
}
public function testAddRuleCallback()
{
$v = new Validator(array('name' => 'Chester Tester'));
$v->addRule('testRule', 'sampleFunctionCallback');
$v->rule('testRule', 'name');
$this->assertTrue($v->validate());
}
public function sampleObjectCallback() { return true; }
public function sampleObjectCallbackFalse() { return false; }
public function testAddRuleCallbackArray()
{
$v = new Validator(array('name' => 'Chester Tester'));
$v->addRule('testRule', array($this, 'sampleObjectCallback'));
$v->rule('testRule', 'name');
$this->assertTrue($v->validate());
}
public function testAddRuleCallbackArrayWithArrayAsExtraParameter()
{
$v = new Validator(array('name' => 'Chester Tester'));
$v->addRule('testRule', array($this, 'sampleObjectCallback'));
$v->rule('testRule', 'name', array('foo', 'bar'));
$this->assertTrue($v->validate());
}
public function testAddRuleCallbackArrayWithArrayAsExtraParameterAndCustomMessage()
{
$v = new Validator(array('name' => 'Chester Tester'));
$v->addRule('testRule', array($this, 'sampleObjectCallbackFalse'));
$v->rule('testRule', 'name', array('foo', 'bar'))->message('Invalid name selected.');
$this->assertFalse($v->validate());
}
public function testAddRuleCallbackArrayWithArrayAsExtraParameterAndCustomMessageLabel()
{
$v = new Validator(array('name' => 'Chester Tester'));
$v->labels(array('name' => 'Name'));
$v->addRule('testRule', array($this, 'sampleObjectCallbackFalse'));
$v->rule('testRule', 'name', array('foo', 'bar'))->message('Invalid name selected.');
$this->assertFalse($v->validate());
}
}
function sampleFunctionCallback($field, $value, array $params) {
return true;
}

View File

@ -1,120 +0,0 @@
<?php
use Valitron\Validator;
function callbackTestFunction($item, $value)
{
return $value === "bar";
}
class ValidateAddInstanceRuleTest extends BaseTestCase
{
/**
* @param Validator $v
*/
protected function assertValid($v)
{
$msg = "\tErrors:\n";
$status = $v->validate();
foreach ($v->errors() as $label => $messages) {
foreach ($messages as $theMessage) {
$msg .= "\n\t{$label}: {$theMessage}";
}
}
$this->assertTrue($v->validate(), $msg);
}
public function testAddInstanceRule()
{
$v = new Validator(array(
"foo" => "bar",
"fuzz" => "bazz",
));
$v->addInstanceRule("fooRule", function ($field, $value) {
return $field !== "foo" || $value !== "barz";
});
Validator::addRule("fuzzerRule", function ($field, $value) {
return $field !== "fuzz" || $value === "bazz";
});
$v->rule("required", array("foo", "fuzz"));
$v->rule("fuzzerRule", "fuzz");
$v->rule("fooRule", "foo");
$this->assertValid($v);
}
public function testAddInstanceRuleFail()
{
$v = new Validator(array("foo" => "bar"));
$v->addInstanceRule("fooRule", function ($field) {
return $field === "for";
});
$v->rule("fooRule", "foo");
$this->assertFalse($v->validate());
}
public function testAddAddRuleWithCallback()
{
$v = new Validator(array("foo" => "bar"));
$v->rule(function ($field, $value) {
return $field === "foo" && $value === "bar";
}, "foo");
$this->assertValid($v);
}
public function testAddAddRuleWithCallbackFail()
{
$v = new Validator(array("foo" => "baz"));
$v->rule(function ($field, $value) {
return $field === "foo" && $value === "bar";
}, "foo");
$this->assertFalse($v->validate());
}
public function testAddAddRuleWithCallbackFailMessage()
{
$v = new Validator(array("foo" => "baz"));
$v->rule(function ($field, $value) {
return $field === "foo" && $value === "bar";
}, "foo", "test error message");
$this->assertFalse($v->validate());
$errors = $v->errors();
$this->assertArrayHasKey("foo", $errors);
$this->assertCount(1, $errors["foo"]);
$this->assertEquals("Foo test error message", $errors["foo"][0]);
}
public function testAddRuleWithNamedCallbackOk()
{
$v = new Validator(array("bar" => "foo"));
$v->rule("callbackTestFunction", "bar");
$this->assertFalse($v->validate());
}
public function testAddRuleWithNamedCallbackErr()
{
$v = new Validator(array("foo" => "bar"));
$v->rule("callbackTestFunction", "foo");
$this->assertTrue($v->validate());
}
public function testUniqueRuleName()
{
$v = new Validator(array());
$args = array("foo", "bar");
$this->assertEquals("foo_bar_rule", $v->getUniqueRuleName($args));
$this->assertEquals("foo_rule", $v->getUniqueRuleName("foo"));
$v->addInstanceRule("foo_rule", function () {
});
$u = $v->getUniqueRuleName("foo");
$this->assertRegExp("/^foo_rule_[0-9]{1,5}$/", $u);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -16,4 +16,3 @@ if($vendorPos !== false) {
$loader = require __DIR__.'/../vendor/autoload.php';
}
require_once __DIR__ . '/Valitron/BaseTestCase.php';

View File

@ -1,5 +0,0 @@
<?php
$original = include __DIR__ . '/../../lang/en.php';
$original['required'] = 'A value is required for {field}';
return $original;