mirror of
https://github.com/vlucas/valitron.git
synced 2025-12-30 23:01:52 +00:00
Merge pull request #84 from Typeform/master
Add PHPUnit as development require, instanceOf validation and date allows DateTime object
This commit is contained in:
commit
839cad4284
@ -10,4 +10,4 @@ before_script:
|
|||||||
- composer install
|
- composer install
|
||||||
|
|
||||||
# Script to run tests
|
# Script to run tests
|
||||||
script: phpunit
|
script: ./vendor/bin/phpunit
|
||||||
|
|||||||
@ -16,6 +16,9 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.2"
|
"php": ">=5.3.2"
|
||||||
},
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "@stable"
|
||||||
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": {
|
"psr-0": {
|
||||||
"Valitron": "src/"
|
"Valitron": "src/"
|
||||||
|
|||||||
722
composer.lock
generated
Normal file
722
composer.lock
generated
Normal file
@ -0,0 +1,722 @@
|
|||||||
|
{
|
||||||
|
"_readme": [
|
||||||
|
"This file locks the dependencies of your project to a known state",
|
||||||
|
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
|
"This file is @generated automatically"
|
||||||
|
],
|
||||||
|
"hash": "bb275afaf8773b2e523ae45cba6be9a4",
|
||||||
|
"packages": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"packages-dev": [
|
||||||
|
{
|
||||||
|
"name": "phpunit/php-code-coverage",
|
||||||
|
"version": "2.0.9",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
||||||
|
"reference": "ed8ac99ce38c3fd134128c898f7ca74665abef7f"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ed8ac99ce38c3fd134128c898f7ca74665abef7f",
|
||||||
|
"reference": "ed8ac99ce38c3fd134128c898f7ca74665abef7f",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3",
|
||||||
|
"phpunit/php-file-iterator": "~1.3.1",
|
||||||
|
"phpunit/php-text-template": "~1.2.0",
|
||||||
|
"phpunit/php-token-stream": "~1.2.2",
|
||||||
|
"sebastian/environment": "~1.0.0",
|
||||||
|
"sebastian/version": "~1.0.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"ext-xdebug": ">=2.1.4",
|
||||||
|
"phpunit/phpunit": "~4.0.14"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-dom": "*",
|
||||||
|
"ext-xdebug": ">=2.2.1",
|
||||||
|
"ext-xmlwriter": "*"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"include-path": [
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Sebastian Bergmann",
|
||||||
|
"email": "sb@sebastian-bergmann.de",
|
||||||
|
"role": "lead"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
|
||||||
|
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
|
||||||
|
"keywords": [
|
||||||
|
"coverage",
|
||||||
|
"testing",
|
||||||
|
"xunit"
|
||||||
|
],
|
||||||
|
"time": "2014-06-29 08:14:40"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "phpunit/php-file-iterator",
|
||||||
|
"version": "1.3.4",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
|
||||||
|
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb",
|
||||||
|
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"File/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"include-path": [
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Sebastian Bergmann",
|
||||||
|
"email": "sb@sebastian-bergmann.de",
|
||||||
|
"role": "lead"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
|
||||||
|
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
|
||||||
|
"keywords": [
|
||||||
|
"filesystem",
|
||||||
|
"iterator"
|
||||||
|
],
|
||||||
|
"time": "2013-10-10 15:34:57"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "phpunit/php-text-template",
|
||||||
|
"version": "1.2.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/sebastianbergmann/php-text-template.git",
|
||||||
|
"reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
|
||||||
|
"reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"Text/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"include-path": [
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Sebastian Bergmann",
|
||||||
|
"email": "sb@sebastian-bergmann.de",
|
||||||
|
"role": "lead"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Simple template engine.",
|
||||||
|
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
|
||||||
|
"keywords": [
|
||||||
|
"template"
|
||||||
|
],
|
||||||
|
"time": "2014-01-30 17:20:04"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "phpunit/php-timer",
|
||||||
|
"version": "1.0.5",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/sebastianbergmann/php-timer.git",
|
||||||
|
"reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
|
||||||
|
"reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"PHP/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"include-path": [
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Sebastian Bergmann",
|
||||||
|
"email": "sb@sebastian-bergmann.de",
|
||||||
|
"role": "lead"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Utility class for timing",
|
||||||
|
"homepage": "https://github.com/sebastianbergmann/php-timer/",
|
||||||
|
"keywords": [
|
||||||
|
"timer"
|
||||||
|
],
|
||||||
|
"time": "2013-08-02 07:42:54"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "phpunit/php-token-stream",
|
||||||
|
"version": "1.2.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
||||||
|
"reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/ad4e1e23ae01b483c16f600ff1bebec184588e32",
|
||||||
|
"reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-tokenizer": "*",
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.2-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"PHP/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"include-path": [
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Sebastian Bergmann",
|
||||||
|
"email": "sb@sebastian-bergmann.de",
|
||||||
|
"role": "lead"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Wrapper around PHP's tokenizer extension.",
|
||||||
|
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
|
||||||
|
"keywords": [
|
||||||
|
"tokenizer"
|
||||||
|
],
|
||||||
|
"time": "2014-03-03 05:10:30"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "phpunit/phpunit",
|
||||||
|
"version": "4.1.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
|
"reference": "939cb801b3b2aa253aedd0b279f40bb8f35cec91"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/939cb801b3b2aa253aedd0b279f40bb8f35cec91",
|
||||||
|
"reference": "939cb801b3b2aa253aedd0b279f40bb8f35cec91",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-dom": "*",
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-pcre": "*",
|
||||||
|
"ext-reflection": "*",
|
||||||
|
"ext-spl": "*",
|
||||||
|
"php": ">=5.3.3",
|
||||||
|
"phpunit/php-code-coverage": "~2.0",
|
||||||
|
"phpunit/php-file-iterator": "~1.3.1",
|
||||||
|
"phpunit/php-text-template": "~1.2",
|
||||||
|
"phpunit/php-timer": "~1.0.2",
|
||||||
|
"phpunit/phpunit-mock-objects": "~2.1",
|
||||||
|
"sebastian/comparator": "~1.0",
|
||||||
|
"sebastian/diff": "~1.1",
|
||||||
|
"sebastian/environment": "~1.0",
|
||||||
|
"sebastian/exporter": "~1.0",
|
||||||
|
"sebastian/version": "~1.0",
|
||||||
|
"symfony/yaml": "~2.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"phpunit/php-invoker": "~1.1"
|
||||||
|
},
|
||||||
|
"bin": [
|
||||||
|
"phpunit"
|
||||||
|
],
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "4.1.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"include-path": [
|
||||||
|
"",
|
||||||
|
"../../symfony/yaml/"
|
||||||
|
],
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Sebastian Bergmann",
|
||||||
|
"email": "sebastian@phpunit.de",
|
||||||
|
"role": "lead"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "The PHP Unit Testing framework.",
|
||||||
|
"homepage": "http://www.phpunit.de/",
|
||||||
|
"keywords": [
|
||||||
|
"phpunit",
|
||||||
|
"testing",
|
||||||
|
"xunit"
|
||||||
|
],
|
||||||
|
"time": "2014-06-11 14:15:47"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "phpunit/phpunit-mock-objects",
|
||||||
|
"version": "2.1.5",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
|
||||||
|
"reference": "7878b9c41edb3afab92b85edf5f0981014a2713a"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/7878b9c41edb3afab92b85edf5f0981014a2713a",
|
||||||
|
"reference": "7878b9c41edb3afab92b85edf5f0981014a2713a",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3",
|
||||||
|
"phpunit/php-text-template": "~1.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "~4.1"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-soap": "*"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.1.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"include-path": [
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Sebastian Bergmann",
|
||||||
|
"email": "sb@sebastian-bergmann.de",
|
||||||
|
"role": "lead"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Mock Object library for PHPUnit",
|
||||||
|
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
|
||||||
|
"keywords": [
|
||||||
|
"mock",
|
||||||
|
"xunit"
|
||||||
|
],
|
||||||
|
"time": "2014-06-12 07:22:15"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "sebastian/comparator",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/sebastianbergmann/comparator.git",
|
||||||
|
"reference": "f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2",
|
||||||
|
"reference": "f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3",
|
||||||
|
"sebastian/diff": "~1.1",
|
||||||
|
"sebastian/exporter": "~1.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "~4.1"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Sebastian Bergmann",
|
||||||
|
"email": "sebastian@phpunit.de",
|
||||||
|
"role": "lead"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jeff Welch",
|
||||||
|
"email": "whatthejeff@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Volker Dusch",
|
||||||
|
"email": "github@wallbash.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Bernhard Schussek",
|
||||||
|
"email": "bschussek@2bepublished.at"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Provides the functionality to compare PHP values for equality",
|
||||||
|
"homepage": "http://www.github.com/sebastianbergmann/comparator",
|
||||||
|
"keywords": [
|
||||||
|
"comparator",
|
||||||
|
"compare",
|
||||||
|
"equality"
|
||||||
|
],
|
||||||
|
"time": "2014-05-02 07:05:58"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "sebastian/diff",
|
||||||
|
"version": "1.1.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/sebastianbergmann/diff.git",
|
||||||
|
"reference": "1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d",
|
||||||
|
"reference": "1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Sebastian Bergmann",
|
||||||
|
"email": "sebastian@phpunit.de",
|
||||||
|
"role": "lead"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Kore Nordmann",
|
||||||
|
"email": "mail@kore-nordmann.de"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Diff implementation",
|
||||||
|
"homepage": "http://www.github.com/sebastianbergmann/diff",
|
||||||
|
"keywords": [
|
||||||
|
"diff"
|
||||||
|
],
|
||||||
|
"time": "2013-08-03 16:46:33"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "sebastian/environment",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/sebastianbergmann/environment.git",
|
||||||
|
"reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/79517609ec01139cd7e9fded0dd7ce08c952ef6a",
|
||||||
|
"reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "4.0.*@dev"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Sebastian Bergmann",
|
||||||
|
"email": "sebastian@phpunit.de",
|
||||||
|
"role": "lead"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Provides functionality to handle HHVM/PHP environments",
|
||||||
|
"homepage": "http://www.github.com/sebastianbergmann/environment",
|
||||||
|
"keywords": [
|
||||||
|
"Xdebug",
|
||||||
|
"environment",
|
||||||
|
"hhvm"
|
||||||
|
],
|
||||||
|
"time": "2014-02-18 16:17:19"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "sebastian/exporter",
|
||||||
|
"version": "1.0.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/sebastianbergmann/exporter.git",
|
||||||
|
"reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529",
|
||||||
|
"reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "4.0.*@dev"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Sebastian Bergmann",
|
||||||
|
"email": "sebastian@phpunit.de",
|
||||||
|
"role": "lead"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jeff Welch",
|
||||||
|
"email": "whatthejeff@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Volker Dusch",
|
||||||
|
"email": "github@wallbash.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Adam Harvey",
|
||||||
|
"email": "aharvey@php.net",
|
||||||
|
"role": "Lead"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Bernhard Schussek",
|
||||||
|
"email": "bschussek@2bepublished.at"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Provides the functionality to export PHP variables for visualization",
|
||||||
|
"homepage": "http://www.github.com/sebastianbergmann/exporter",
|
||||||
|
"keywords": [
|
||||||
|
"export",
|
||||||
|
"exporter"
|
||||||
|
],
|
||||||
|
"time": "2014-02-16 08:26:31"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "sebastian/version",
|
||||||
|
"version": "1.0.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/sebastianbergmann/version.git",
|
||||||
|
"reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43",
|
||||||
|
"reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Sebastian Bergmann",
|
||||||
|
"email": "sebastian@phpunit.de",
|
||||||
|
"role": "lead"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
||||||
|
"homepage": "https://github.com/sebastianbergmann/version",
|
||||||
|
"time": "2014-03-07 15:35:33"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/yaml",
|
||||||
|
"version": "v2.5.1",
|
||||||
|
"target-dir": "Symfony/Component/Yaml",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/Yaml.git",
|
||||||
|
"reference": "1057e87364c0b38b50f5695fc9df9dd189036bec"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/Yaml/zipball/1057e87364c0b38b50f5695fc9df9dd189036bec",
|
||||||
|
"reference": "1057e87364c0b38b50f5695fc9df9dd189036bec",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.5-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Symfony\\Component\\Yaml\\": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com",
|
||||||
|
"homepage": "http://fabien.potencier.org",
|
||||||
|
"role": "Lead Developer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "http://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony Yaml Component",
|
||||||
|
"homepage": "http://symfony.com",
|
||||||
|
"time": "2014-07-08 12:21:33"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"aliases": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"stability-flags": {
|
||||||
|
"phpunit/phpunit": 0
|
||||||
|
},
|
||||||
|
"platform": {
|
||||||
|
"php": ">=5.3.2"
|
||||||
|
},
|
||||||
|
"platform-dev": [
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -495,7 +495,13 @@ class Validator
|
|||||||
*/
|
*/
|
||||||
protected function validateDate($field, $value)
|
protected function validateDate($field, $value)
|
||||||
{
|
{
|
||||||
return strtotime($value) !== false;
|
$isDate = false;
|
||||||
|
if($value instanceof \DateTime) {
|
||||||
|
$isDate = true;
|
||||||
|
} else {
|
||||||
|
$isDate = strtotime($value) !== false;
|
||||||
|
}
|
||||||
|
return $isDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -667,6 +673,25 @@ class Validator
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function validateInstanceOf($field, $value, $params)
|
||||||
|
{
|
||||||
|
$isInstanceOf = false;
|
||||||
|
if(is_object($value)) {
|
||||||
|
if(is_object($params[0]) && $value instanceof $params[0]) {
|
||||||
|
$isInstanceOf = true;
|
||||||
|
}
|
||||||
|
if(get_class($value) === $params[0]) {
|
||||||
|
$isInstanceOf = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(is_string($value)) {
|
||||||
|
if(is_string($params[0]) && get_class($value) === $params[0]) {
|
||||||
|
$isInstanceOf = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $isInstanceOf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get array of fields and data
|
* Get array of fields and data
|
||||||
@ -713,8 +738,10 @@ class Validator
|
|||||||
$param = $param->format('Y-m-d');
|
$param = $param->format('Y-m-d');
|
||||||
}
|
}
|
||||||
// Use custom label instead of field name if set
|
// Use custom label instead of field name if set
|
||||||
if (isset($this->_labels[$param])) {
|
if(is_string($params[0])) {
|
||||||
$param = $this->_labels[$param];
|
if (isset($this->_labels[$param])) {
|
||||||
|
$param = $this->_labels[$param];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$values[] = $param;
|
$values[] = $param;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -413,6 +413,13 @@ class ValidateTest extends BaseTestCase
|
|||||||
$this->assertTrue($v->validate());
|
$this->assertTrue($v->validate());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testDateValidWithDateTimeObject()
|
||||||
|
{
|
||||||
|
$v = new Validator(array('date' => new DateTime()));
|
||||||
|
$v->rule('date', 'date');
|
||||||
|
$this->assertTrue($v->validate());
|
||||||
|
}
|
||||||
|
|
||||||
public function testDateInvalid()
|
public function testDateInvalid()
|
||||||
{
|
{
|
||||||
$v = new Validator(array('date' => 'no thanks'));
|
$v = new Validator(array('date' => 'no thanks'));
|
||||||
@ -800,6 +807,58 @@ class ValidateTest extends BaseTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testInstanceOfValidWithString()
|
||||||
|
{
|
||||||
|
$v = new Validator(array('attributeName' => new stdClass()));
|
||||||
|
$v->rule('instanceOf', 'attributeName', 'stdClass');
|
||||||
|
$this->assertTrue($v->validate());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testInstanceOfInvalidWithInstance()
|
||||||
|
{
|
||||||
|
$v = new Validator(array('attributeName' => new stdClass()));
|
||||||
|
$v->rule('instanceOf', 'attributeName', new Validator(array()));
|
||||||
|
$this->assertFalse($v->validate());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testInstanceOfValidWithInstance()
|
||||||
|
{
|
||||||
|
$v = new Validator(array('attributeName' => new stdClass()));
|
||||||
|
$v->rule('instanceOf', 'attributeName', new stdClass());
|
||||||
|
$this->assertTrue($v->validate());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testInstanceOfInvalidWithString()
|
||||||
|
{
|
||||||
|
$v = new Validator(array('attributeName' => new stdClass()));
|
||||||
|
$v->rule('instanceOf', 'attributeName', 'SomeOtherClass');
|
||||||
|
$this->assertFalse($v->validate());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testInstanceOfWithAlternativeSyntaxValid()
|
||||||
|
{
|
||||||
|
$v = new Validator(array('attributeName' => new stdClass()));
|
||||||
|
$v->rules(array(
|
||||||
|
'instanceOf' => array(
|
||||||
|
array('attributeName', 'stdClass')
|
||||||
|
)
|
||||||
|
));
|
||||||
|
$this->assertTrue($v->validate());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testInstanceOfWithAlternativeSyntaxInvalid()
|
||||||
|
{
|
||||||
|
$v = new Validator(array('attributeName' => new stdClass()));
|
||||||
|
$v->rules(array(
|
||||||
|
'instanceOf' => array(
|
||||||
|
array('attributeName', 'SomeOtherClassInAlternativeSyntaxInvalid')
|
||||||
|
)
|
||||||
|
));
|
||||||
|
$v->validate();
|
||||||
|
$this->assertFalse($v->validate());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sampleFunctionCallback($field, $value, array $params) {
|
function sampleFunctionCallback($field, $value, array $params) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user