diff --git a/composer.lock b/composer.lock index 58c6e8e73dd538705edf9b3a288704716a04307a..025d5bf798625537cb6a0fa5c5ce20b22a1e4d11 100644 --- a/composer.lock +++ b/composer.lock @@ -2197,24 +2197,82 @@ ], "time": "2015-08-04 21:39:18" }, + { + "name": "zendframework/zend-hydrator", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-hydrator.git", + "reference": "f3ed8b833355140350bbed98d8a7b8b66875903f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-hydrator/zipball/f3ed8b833355140350bbed98d8a7b8b66875903f", + "reference": "f3ed8b833355140350bbed98d8a7b8b66875903f", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "zendframework/zend-stdlib": "^2.5.1" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "^2.0@dev", + "zendframework/zend-eventmanager": "^2.5.1", + "zendframework/zend-filter": "^2.5.1", + "zendframework/zend-inputfilter": "^2.5.1", + "zendframework/zend-serializer": "^2.5.1", + "zendframework/zend-servicemanager": "^2.5.1" + }, + "suggest": { + "zendframework/zend-eventmanager": "^2.5.1, to support aggregate hydrator usage", + "zendframework/zend-filter": "^2.5.1, to support naming strategy hydrator usage", + "zendframework/zend-serializer": "^2.5.1, to use the SerializableStrategy", + "zendframework/zend-servicemanager": "^2.5.1, to support hydrator plugin manager usage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev", + "dev-develop": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Hydrator\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-hydrator", + "keywords": [ + "hydrator", + "zf2" + ], + "time": "2015-09-17 14:06:43" + }, { "name": "zendframework/zend-stdlib", - "version": "2.6.0", + "version": "2.7.3", "source": { "type": "git", "url": "https://github.com/zendframework/zend-stdlib.git", - "reference": "a35758803fc9051ec1aff43989e679b6b451b1b4" + "reference": "8ac0c77ff567fcf49b58689ee3bfa7595be102bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/a35758803fc9051ec1aff43989e679b6b451b1b4", - "reference": "a35758803fc9051ec1aff43989e679b6b451b1b4", + "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/8ac0c77ff567fcf49b58689ee3bfa7595be102bc", + "reference": "8ac0c77ff567fcf49b58689ee3bfa7595be102bc", "shasum": "" }, "require": { - "php": ">=5.5" + "php": ">=5.5", + "zendframework/zend-hydrator": "~1.0" }, "require-dev": { + "athletic/athletic": "~0.1", "fabpot/php-cs-fixer": "1.7.*", "phpunit/phpunit": "~4.0", "zendframework/zend-config": "~2.5", @@ -2233,8 +2291,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev", - "dev-develop": "2.7-dev" + "dev-master": "2.7-dev", + "dev-develop": "2.8-dev" } }, "autoload": { @@ -2251,7 +2309,7 @@ "stdlib", "zf2" ], - "time": "2015-07-21 17:08:05" + "time": "2015-09-25 04:06:33" } ], "packages-dev": [ @@ -2529,16 +2587,16 @@ }, { "name": "mikey179/vfsStream", - "version": "v1.5.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/mikey179/vfsStream.git", - "reference": "4dc0d2f622412f561f5b242b19b98068bbbc883a" + "reference": "73bcb605b741a7d5044b47592338c633788b0eb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/4dc0d2f622412f561f5b242b19b98068bbbc883a", - "reference": "4dc0d2f622412f561f5b242b19b98068bbbc883a", + "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/73bcb605b741a7d5044b47592338c633788b0eb7", + "reference": "73bcb605b741a7d5044b47592338c633788b0eb7", "shasum": "" }, "require": { @@ -2550,7 +2608,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5.x-dev" + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -2571,7 +2629,7 @@ ], "description": "Virtual file system to mock the real file system in unit tests.", "homepage": "http://vfs.bovigo.org/", - "time": "2015-03-29 11:19:49" + "time": "2015-10-06 16:59:57" }, { "name": "phpdocumentor/reflection-docblock", @@ -2684,16 +2742,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.2.3", + "version": "2.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f" + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef1ca6835468857944d5c3b48fa503d5554cff2f", - "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", "shasum": "" }, "require": { @@ -2742,7 +2800,7 @@ "testing", "xunit" ], - "time": "2015-09-14 06:51:16" + "time": "2015-10-06 15:47:00" }, { "name": "phpunit/php-file-iterator", @@ -2924,16 +2982,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.8.10", + "version": "4.8.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "463163747474815c5ccd4ae12b5b355ec12158e8" + "reference": "bdd199472410fd7e32751f9c814c7e06f2c21bd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/463163747474815c5ccd4ae12b5b355ec12158e8", - "reference": "463163747474815c5ccd4ae12b5b355ec12158e8", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bdd199472410fd7e32751f9c814c7e06f2c21bd5", + "reference": "bdd199472410fd7e32751f9c814c7e06f2c21bd5", "shasum": "" }, "require": { @@ -2992,7 +3050,7 @@ "testing", "xunit" ], - "time": "2015-10-01 09:14:30" + "time": "2015-10-07 10:39:46" }, { "name": "phpunit/phpunit-mock-objects", diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index f3dd55e5435021b3d60d3b6b22a31e850204f0e4..8d5b5ef27e423b41ea0f84bdc5fdaac939e4d98a 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -7,6 +7,7 @@ return array( 'Zend\\Stdlib\\' => array($vendorDir . '/zendframework/zend-stdlib/src'), + 'Zend\\Hydrator\\' => array($vendorDir . '/zendframework/zend-hydrator/src'), 'Zend\\Feed\\' => array($vendorDir . '/zendframework/zend-feed/src'), 'Zend\\Escaper\\' => array($vendorDir . '/zendframework/zend-escaper/src'), 'Zend\\Diactoros\\' => array($vendorDir . '/zendframework/zend-diactoros/src'), diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index c29170ad1b75c8d5059d1370c6c939d1b4f53ea8..fdd91a9b42b12c99b0fae16e26b3c69d85d777bd 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -256,54 +256,6 @@ } ] }, - { - "name": "mikey179/vfsStream", - "version": "v1.5.0", - "version_normalized": "1.5.0.0", - "source": { - "type": "git", - "url": "https://github.com/mikey179/vfsStream.git", - "reference": "4dc0d2f622412f561f5b242b19b98068bbbc883a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/4dc0d2f622412f561f5b242b19b98068bbbc883a", - "reference": "4dc0d2f622412f561f5b242b19b98068bbbc883a", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.5" - }, - "time": "2015-03-29 11:19:49", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.5.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "org\\bovigo\\vfs\\": "src/main/php" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Frank Kleine", - "homepage": "http://frankkleine.de/", - "role": "Developer" - } - ], - "description": "Virtual file system to mock the real file system in unit tests.", - "homepage": "http://vfs.bovigo.org/" - }, { "name": "doctrine/lexer", "version": "v1.0.1", @@ -1204,64 +1156,6 @@ "sparql" ] }, - { - "name": "zendframework/zend-stdlib", - "version": "2.6.0", - "version_normalized": "2.6.0.0", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-stdlib.git", - "reference": "a35758803fc9051ec1aff43989e679b6b451b1b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/a35758803fc9051ec1aff43989e679b6b451b1b4", - "reference": "a35758803fc9051ec1aff43989e679b6b451b1b4", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0", - "zendframework/zend-config": "~2.5", - "zendframework/zend-eventmanager": "~2.5", - "zendframework/zend-filter": "~2.5", - "zendframework/zend-inputfilter": "~2.5", - "zendframework/zend-serializer": "~2.5", - "zendframework/zend-servicemanager": "~2.5" - }, - "suggest": { - "zendframework/zend-eventmanager": "To support aggregate hydrator usage", - "zendframework/zend-filter": "To support naming strategy hydrator usage", - "zendframework/zend-serializer": "Zend\\Serializer component", - "zendframework/zend-servicemanager": "To support hydrator plugin manager usage" - }, - "time": "2015-07-21 17:08:05", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev", - "dev-develop": "2.7-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Zend\\Stdlib\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "homepage": "https://github.com/zendframework/zend-stdlib", - "keywords": [ - "stdlib", - "zf2" - ] - }, { "name": "zendframework/zend-escaper", "version": "2.5.1", @@ -2530,144 +2424,6 @@ "tokenizer" ] }, - { - "name": "phpunit/php-code-coverage", - "version": "2.2.3", - "version_normalized": "2.2.3.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef1ca6835468857944d5c3b48fa503d5554cff2f", - "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" - }, - "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" - }, - "time": "2015-09-14 06:51:16", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "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" - ] - }, - { - "name": "phpunit/phpunit", - "version": "4.8.10", - "version_normalized": "4.8.10.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "463163747474815c5ccd4ae12b5b355ec12158e8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/463163747474815c5ccd4ae12b5b355ec12158e8", - "reference": "463163747474815c5ccd4ae12b5b355ec12158e8", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": ">=1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.1", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.1|~3.0" - }, - "suggest": { - "phpunit/php-invoker": "~1.1" - }, - "time": "2015-10-01 09:14:30", - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.8.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ] - }, { "name": "symfony/class-loader", "version": "v2.7.5", @@ -3697,5 +3453,309 @@ "validation", "versioning" ] + }, + { + "name": "mikey179/vfsStream", + "version": "v1.6.0", + "version_normalized": "1.6.0.0", + "source": { + "type": "git", + "url": "https://github.com/mikey179/vfsStream.git", + "reference": "73bcb605b741a7d5044b47592338c633788b0eb7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/73bcb605b741a7d5044b47592338c633788b0eb7", + "reference": "73bcb605b741a7d5044b47592338c633788b0eb7", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.5" + }, + "time": "2015-10-06 16:59:57", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "org\\bovigo\\vfs\\": "src/main/php" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Frank Kleine", + "homepage": "http://frankkleine.de/", + "role": "Developer" + } + ], + "description": "Virtual file system to mock the real file system in unit tests.", + "homepage": "http://vfs.bovigo.org/" + }, + { + "name": "phpunit/php-code-coverage", + "version": "2.2.4", + "version_normalized": "2.2.4.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "^1.3.2", + "sebastian/version": "~1.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" + }, + "time": "2015-10-06 15:47:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "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" + ] + }, + { + "name": "phpunit/phpunit", + "version": "4.8.11", + "version_normalized": "4.8.11.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "bdd199472410fd7e32751f9c814c7e06f2c21bd5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bdd199472410fd7e32751f9c814c7e06f2c21bd5", + "reference": "bdd199472410fd7e32751f9c814c7e06f2c21bd5", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpspec/prophecy": "^1.3.1", + "phpunit/php-code-coverage": "~2.1", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": ">=1.0.6", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.1", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.3", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", + "sebastian/version": "~1.0", + "symfony/yaml": "~2.1|~3.0" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "time": "2015-10-07 10:39:46", + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.8.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ] + }, + { + "name": "zendframework/zend-hydrator", + "version": "1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-hydrator.git", + "reference": "f3ed8b833355140350bbed98d8a7b8b66875903f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-hydrator/zipball/f3ed8b833355140350bbed98d8a7b8b66875903f", + "reference": "f3ed8b833355140350bbed98d8a7b8b66875903f", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "zendframework/zend-stdlib": "^2.5.1" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "^2.0@dev", + "zendframework/zend-eventmanager": "^2.5.1", + "zendframework/zend-filter": "^2.5.1", + "zendframework/zend-inputfilter": "^2.5.1", + "zendframework/zend-serializer": "^2.5.1", + "zendframework/zend-servicemanager": "^2.5.1" + }, + "suggest": { + "zendframework/zend-eventmanager": "^2.5.1, to support aggregate hydrator usage", + "zendframework/zend-filter": "^2.5.1, to support naming strategy hydrator usage", + "zendframework/zend-serializer": "^2.5.1, to use the SerializableStrategy", + "zendframework/zend-servicemanager": "^2.5.1, to support hydrator plugin manager usage" + }, + "time": "2015-09-17 14:06:43", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev", + "dev-develop": "1.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Zend\\Hydrator\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-hydrator", + "keywords": [ + "hydrator", + "zf2" + ] + }, + { + "name": "zendframework/zend-stdlib", + "version": "2.7.3", + "version_normalized": "2.7.3.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-stdlib.git", + "reference": "8ac0c77ff567fcf49b58689ee3bfa7595be102bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/8ac0c77ff567fcf49b58689ee3bfa7595be102bc", + "reference": "8ac0c77ff567fcf49b58689ee3bfa7595be102bc", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "zendframework/zend-hydrator": "~1.0" + }, + "require-dev": { + "athletic/athletic": "~0.1", + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "zendframework/zend-config": "~2.5", + "zendframework/zend-eventmanager": "~2.5", + "zendframework/zend-filter": "~2.5", + "zendframework/zend-inputfilter": "~2.5", + "zendframework/zend-serializer": "~2.5", + "zendframework/zend-servicemanager": "~2.5" + }, + "suggest": { + "zendframework/zend-eventmanager": "To support aggregate hydrator usage", + "zendframework/zend-filter": "To support naming strategy hydrator usage", + "zendframework/zend-serializer": "Zend\\Serializer component", + "zendframework/zend-servicemanager": "To support hydrator plugin manager usage" + }, + "time": "2015-09-25 04:06:33", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev", + "dev-develop": "2.8-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Zend\\Stdlib\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-stdlib", + "keywords": [ + "stdlib", + "zf2" + ] } ] diff --git a/vendor/mikey179/vfsStream/CHANGELOG.md b/vendor/mikey179/vfsStream/CHANGELOG.md index b3f2eb1cb60897f980c56400d91e320103e0cdcc..126c5ff1d534567f286c2f45ae68d25f70bc470a 100644 --- a/vendor/mikey179/vfsStream/CHANGELOG.md +++ b/vendor/mikey179/vfsStream/CHANGELOG.md @@ -1,3 +1,10 @@ +1.6.0 (2015-10-06) +------------------ + + * added `vfsStreamWrapper::unregister()`, provided by @malkusch with #114 + * fixed #115: incorrect handling of `..` in root directory on PHP 5.5, fix provided by @acoulton with #116 + + 1.5.0 (2015-03-29) ------------------ diff --git a/vendor/mikey179/vfsStream/readme.md b/vendor/mikey179/vfsStream/README.md similarity index 73% rename from vendor/mikey179/vfsStream/readme.md rename to vendor/mikey179/vfsStream/README.md index 9eb78c506f688aec603354c6f412bfe4e8cf2f24..74554bf728adf94f873f143b7fe314f77c251eb5 100644 --- a/vendor/mikey179/vfsStream/readme.md +++ b/vendor/mikey179/vfsStream/README.md @@ -1,4 +1,7 @@ -For more information have a look in the [wiki](https://github.com/mikey179/vfsStream/wiki). +You can find documentation in the [wiki](https://github.com/mikey179/vfsStream/wiki). + +Also you might want to check [vfsStream examples](https://github.com/mikey179/vfsStream-examples). + [![Build Status](https://secure.travis-ci.org/mikey179/vfsStream.png)](http://travis-ci.org/mikey179/vfsStream) [![Coverage Status](https://coveralls.io/repos/mikey179/vfsStream/badge.png?branch=master)](https://coveralls.io/r/mikey179/vfsStream?branch=master) diff --git a/vendor/mikey179/vfsStream/composer.json b/vendor/mikey179/vfsStream/composer.json index c87f5fe6bce091546f49122311325a2e655deab1..c18e37ddd3163f349e02ec72a3d51edd520de921 100644 --- a/vendor/mikey179/vfsStream/composer.json +++ b/vendor/mikey179/vfsStream/composer.json @@ -27,7 +27,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.5.x-dev" + "dev-master": "1.6.x-dev" } } } diff --git a/vendor/mikey179/vfsStream/composer.lock b/vendor/mikey179/vfsStream/composer.lock new file mode 100644 index 0000000000000000000000000000000000000000..99e11306cd883562dbad8cc7489f0008d6836701 --- /dev/null +++ b/vendor/mikey179/vfsStream/composer.lock @@ -0,0 +1,972 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "e3c2dd0d4b4daf3d2c9e0bedd344592a", + "content-hash": "59c3102c5db7e3c4d78a920d4712790d", + "packages": [], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14 21:17:01" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "dflydev/markdown": "~1.0", + "erusev/parsedown": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "phpDocumentor": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" + } + ], + "time": "2015-02-03 12:10:50" + }, + { + "name": "phpspec/prophecy", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", + "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "phpdocumentor/reflection-docblock": "~2.0", + "sebastian/comparator": "~1.1" + }, + "require-dev": { + "phpspec/phpspec": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2015-08-13 10:07:40" + }, + { + "name": "phpunit/php-code-coverage", + "version": "2.2.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef1ca6835468857944d5c3b48fa503d5554cff2f", + "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "^1.3.2", + "sebastian/version": "~1.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "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": "2015-09-14 06:51:16" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "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": "2015-06-21 13:08:43" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "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": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21 13:50:34" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.7", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "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": "2015-06-21 08:01:12" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2015-09-15 10:49:45" + }, + { + "name": "phpunit/phpunit", + "version": "4.8.10", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "463163747474815c5ccd4ae12b5b355ec12158e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/463163747474815c5ccd4ae12b5b355ec12158e8", + "reference": "463163747474815c5ccd4ae12b5b355ec12158e8", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpspec/prophecy": "^1.3.1", + "phpunit/php-code-coverage": "~2.1", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": ">=1.0.6", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.1", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.3", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", + "sebastian/version": "~1.0", + "symfony/yaml": "~2.1|~3.0" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.8.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": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2015-10-01 09:14:30" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "2.3.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": ">=5.3.3", + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "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": "2015-10-02 06:51:40" + }, + { + "name": "sebastian/comparator", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2015-07-26 15:48:44" + }, + { + "name": "sebastian/diff", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "http://www.github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2015-02-22 15:13:53" + }, + { + "name": "sebastian/environment", + "version": "1.3.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", + "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2015-08-03 06:14:51" + }, + { + "name": "sebastian/exporter", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2015-06-21 07:55:53" + }, + { + "name": "sebastian/global-state", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2014-10-06 09:23:50" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "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": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2015-06-21 08:04:50" + }, + { + "name": "sebastian/version", + "version": "1.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "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": "2015-06-21 13:59:46" + }, + { + "name": "symfony/yaml", + "version": "v2.7.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/31cb2ad0155c95b88ee55fe12bc7ff92232c1770", + "reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2015-09-14 14:14:09" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.3.0" + }, + "platform-dev": [] +} diff --git a/vendor/mikey179/vfsStream/phpunit.xml.dist b/vendor/mikey179/vfsStream/phpunit.xml.dist new file mode 100644 index 0000000000000000000000000000000000000000..f5e0556375bb08ba64ee66d736fac0606a884c0d --- /dev/null +++ b/vendor/mikey179/vfsStream/phpunit.xml.dist @@ -0,0 +1,43 @@ + + + + + ./src/test/php + + + + + + src/main/php + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php b/vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php index 5ec4352ed3ae5ff6a01a25683a311084ca0e86ab..0467451a2732c892c363304469b374b3c6a0dc1f 100644 --- a/vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php +++ b/vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php @@ -148,7 +148,7 @@ public function getType() * sets the last modification time of the stream content * * @param int $filemtime - * @return vfsStreamContent + * @return $this */ public function lastModified($filemtime) { @@ -170,7 +170,7 @@ public function filemtime() * sets last access time of the stream content * * @param int $fileatime - * @return vfsStreamContent + * @return $this * @since 0.9 */ public function lastAccessed($fileatime) @@ -194,7 +194,7 @@ public function fileatime() * sets the last attribute modification time of the stream content * * @param int $filectime - * @return vfsStreamContent + * @return $this * @since 0.9 */ public function lastAttributeModified($filectime) @@ -218,7 +218,7 @@ public function filectime() * adds content to given container * * @param vfsStreamContainer $container - * @return vfsStreamContent + * @return $this */ public function at(vfsStreamContainer $container) { @@ -230,7 +230,7 @@ public function at(vfsStreamContainer $container) * change file mode to given permissions * * @param int $permissions - * @return vfsStreamContent + * @return $this */ public function chmod($permissions) { @@ -314,7 +314,7 @@ public function isExecutable($user, $group) * change owner of file to given user * * @param int $user - * @return vfsStreamContent + * @return $this */ public function chown($user) { @@ -348,7 +348,7 @@ public function getUser() * change owner group of file to given group * * @param int $group - * @return vfsStreamContent + * @return $this */ public function chgrp($group) { @@ -416,4 +416,4 @@ public function url() return vfsStream::url($this->path()); } } -?> \ No newline at end of file +?> diff --git a/vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php b/vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php index 31c021e0c3b449a4b84f42481aab4af16fd07c17..911334a8c0075b497d69fbdfde19916e392a3a04 100644 --- a/vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php +++ b/vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php @@ -115,6 +115,33 @@ public static function register() self::$registered = true; } + /** + * Unregisters a previously registered URL wrapper for the vfs scheme. + * + * If this stream wrapper wasn't registered, the method returns silently. + * + * If unregistering fails, or if the URL wrapper for vfs:// was not + * registered with this class, a vfsStreamException will be thrown. + * + * @throws vfsStreamException + * @since 1.6.0 + */ + public static function unregister() + { + if (!self::$registered) { + if (in_array(vfsStream::SCHEME, stream_get_wrappers())) { + throw new vfsStreamException('The URL wrapper for the protocol ' . vfsStream::SCHEME . ' was not registered with this version of vfsStream.'); + } + return; + } + + if (!@stream_wrapper_unregister(vfsStream::SCHEME)) { + throw new vfsStreamException('Failed to unregister the URL wrapper for the ' . vfsStream::SCHEME . ' protocol.'); + } + + self::$registered = false; + } + /** * sets the root content * @@ -231,7 +258,7 @@ protected function resolvePath($path) if ('.' !== $pathPart) { if ('..' !== $pathPart) { $newPath[] = $pathPart; - } else { + } elseif (count($newPath) > 1) { array_pop($newPath); } } diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/DirectoryIterationTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/DirectoryIterationTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..4f30b038b6b0fd840260bd974d249dc7c95ebc90 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/DirectoryIterationTestCase.php @@ -0,0 +1,318 @@ +assertEquals($expectedCount, + $actualCount, + 'Directory foo contains ' . $expectedCount . ' children, but got ' . $actualCount . ' children while iterating over directory contents' + ); + } + + /** + * @param \Closure $dotFilesSwitch + * @param string[] $expectedDirectories + * @test + * @dataProvider provideSwitchWithExpectations + */ + public function directoryIteration(\Closure $dotFilesSwitch, array $expectedDirectories) + { + $dotFilesSwitch(); + $dir = dir($this->fooURL); + $i = 0; + while (false !== ($entry = $dir->read())) { + $i++; + $this->assertTrue(in_array($entry, $expectedDirectories)); + } + + $this->assertDirectoryCount(count($expectedDirectories), $i); + $dir->rewind(); + $i = 0; + while (false !== ($entry = $dir->read())) { + $i++; + $this->assertTrue(in_array($entry, $expectedDirectories)); + } + + $this->assertDirectoryCount(count($expectedDirectories), $i); + $dir->close(); + } + + /** + * @param \Closure $dotFilesSwitch + * @param string[] $expectedDirectories + * @test + * @dataProvider provideSwitchWithExpectations + */ + public function directoryIterationWithDot(\Closure $dotFilesSwitch, array $expectedDirectories) + { + $dotFilesSwitch(); + $dir = dir($this->fooURL . '/.'); + $i = 0; + while (false !== ($entry = $dir->read())) { + $i++; + $this->assertTrue(in_array($entry, $expectedDirectories)); + } + + $this->assertDirectoryCount(count($expectedDirectories), $i); + $dir->rewind(); + $i = 0; + while (false !== ($entry = $dir->read())) { + $i++; + $this->assertTrue(in_array($entry, $expectedDirectories)); + } + + $this->assertDirectoryCount(count($expectedDirectories), $i); + $dir->close(); + } + + /** + * assure that a directory iteration works as expected + * + * @param \Closure $dotFilesSwitch + * @param string[] $expectedDirectories + * @test + * @dataProvider provideSwitchWithExpectations + * @group regression + * @group bug_2 + */ + public function directoryIterationWithOpenDir_Bug_2(\Closure $dotFilesSwitch, array $expectedDirectories) + { + $dotFilesSwitch(); + $handle = opendir($this->fooURL); + $i = 0; + while (false !== ($entry = readdir($handle))) { + $i++; + $this->assertTrue(in_array($entry, $expectedDirectories)); + } + + $this->assertDirectoryCount(count($expectedDirectories), $i); + + rewinddir($handle); + $i = 0; + while (false !== ($entry = readdir($handle))) { + $i++; + $this->assertTrue(in_array($entry, $expectedDirectories)); + } + + $this->assertDirectoryCount(count($expectedDirectories), $i); + closedir($handle); + } + + /** + * assure that a directory iteration works as expected + * + * @author Christoph Bloemer + * @param \Closure $dotFilesSwitch + * @param string[] $expectedDirectories + * @test + * @dataProvider provideSwitchWithExpectations + * @group regression + * @group bug_4 + */ + public function directoryIteration_Bug_4(\Closure $dotFilesSwitch, array $expectedDirectories) + { + $dotFilesSwitch(); + $dir = $this->fooURL; + $list1 = array(); + if ($handle = opendir($dir)) { + while (false !== ($listItem = readdir($handle))) { + if ('.' != $listItem && '..' != $listItem) { + if (is_file($dir . '/' . $listItem) === true) { + $list1[] = 'File:[' . $listItem . ']'; + } elseif (is_dir($dir . '/' . $listItem) === true) { + $list1[] = 'Folder:[' . $listItem . ']'; + } + } + } + + closedir($handle); + } + + $list2 = array(); + if ($handle = opendir($dir)) { + while (false !== ($listItem = readdir($handle))) { + if ('.' != $listItem && '..' != $listItem) { + if (is_file($dir . '/' . $listItem) === true) { + $list2[] = 'File:[' . $listItem . ']'; + } elseif (is_dir($dir . '/' . $listItem) === true) { + $list2[] = 'Folder:[' . $listItem . ']'; + } + } + } + + closedir($handle); + } + + $this->assertEquals($list1, $list2); + $this->assertEquals(2, count($list1)); + $this->assertEquals(2, count($list2)); + } + + /** + * assure that a directory iteration works as expected + * + * @param \Closure $dotFilesSwitch + * @param string[] $expectedDirectories + * @test + * @dataProvider provideSwitchWithExpectations + */ + public function directoryIterationShouldBeIndependent(\Closure $dotFilesSwitch, array $expectedDirectories) + { + $dotFilesSwitch(); + $list1 = array(); + $list2 = array(); + $handle1 = opendir($this->fooURL); + if (false !== ($listItem = readdir($handle1))) { + $list1[] = $listItem; + } + + $handle2 = opendir($this->fooURL); + if (false !== ($listItem = readdir($handle2))) { + $list2[] = $listItem; + } + + if (false !== ($listItem = readdir($handle1))) { + $list1[] = $listItem; + } + + if (false !== ($listItem = readdir($handle2))) { + $list2[] = $listItem; + } + + closedir($handle1); + closedir($handle2); + $this->assertEquals($list1, $list2); + $this->assertEquals(2, count($list1)); + $this->assertEquals(2, count($list2)); + } + + /** + * @test + * @group issue_50 + */ + public function recursiveDirectoryIterationWithDotsEnabled() + { + vfsStream::enableDotfiles(); + vfsStream::setup(); + $structure = array( + 'Core' => array( + 'AbstractFactory' => array( + 'test.php' => 'some text content', + 'other.php' => 'Some more text content', + 'Invalid.csv' => 'Something else', + ), + 'AnEmptyFolder' => array(), + 'badlocation.php' => 'some bad content', + ) + ); + $root = vfsStream::create($structure); + $rootPath = vfsStream::url($root->getName()); + + $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($rootPath), + \RecursiveIteratorIterator::CHILD_FIRST); + $pathes = array(); + foreach ($iterator as $fullFileName => $fileSPLObject) { + $pathes[] = $fullFileName; + } + + $this->assertEquals(array('vfs://root'.DIRECTORY_SEPARATOR.'.', + 'vfs://root'.DIRECTORY_SEPARATOR.'..', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'.', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'..', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'AbstractFactory'.DIRECTORY_SEPARATOR.'.', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'AbstractFactory'.DIRECTORY_SEPARATOR.'..', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'AbstractFactory'.DIRECTORY_SEPARATOR.'test.php', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'AbstractFactory'.DIRECTORY_SEPARATOR.'other.php', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'AbstractFactory'.DIRECTORY_SEPARATOR.'Invalid.csv', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'AbstractFactory', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'AnEmptyFolder'.DIRECTORY_SEPARATOR.'.', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'AnEmptyFolder'.DIRECTORY_SEPARATOR.'..', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'AnEmptyFolder', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'badlocation.php', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core' + ), + $pathes + ); + } + + /** + * @test + * @group issue_50 + */ + public function recursiveDirectoryIterationWithDotsDisabled() + { + vfsStream::disableDotfiles(); + vfsStream::setup(); + $structure = array( + 'Core' => array( + 'AbstractFactory' => array( + 'test.php' => 'some text content', + 'other.php' => 'Some more text content', + 'Invalid.csv' => 'Something else', + ), + 'AnEmptyFolder' => array(), + 'badlocation.php' => 'some bad content', + ) + ); + $root = vfsStream::create($structure); + $rootPath = vfsStream::url($root->getName()); + + $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($rootPath), + \RecursiveIteratorIterator::CHILD_FIRST); + $pathes = array(); + foreach ($iterator as $fullFileName => $fileSPLObject) { + $pathes[] = $fullFileName; + } + + $this->assertEquals(array('vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'AbstractFactory'.DIRECTORY_SEPARATOR.'test.php', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'AbstractFactory'.DIRECTORY_SEPARATOR.'other.php', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'AbstractFactory'.DIRECTORY_SEPARATOR.'Invalid.csv', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'AbstractFactory', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'AnEmptyFolder', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'badlocation.php', + 'vfs://root'.DIRECTORY_SEPARATOR.'Core' + ), + $pathes + ); + } +} \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/Issue104TestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/Issue104TestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..89ae146b1e55a6984aa71668f34eca054229fb04 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/Issue104TestCase.php @@ -0,0 +1,52 @@ + array( + 'schema.xsd' => ' + + ', + ) + ); + vfsStream::setup('root', null, $structure); + $doc = new \DOMDocument(); + $this->assertTrue($doc->load(vfsStream::url('root/foo bar/schema.xsd'))); + } + + /** + * @test + */ + public function vfsStreamCanHandleUrlEncodedPath() + { + $content = ' + + '; + $structure = array('foo bar' => array( + 'schema.xsd' => $content, + ) + ); + vfsStream::setup('root', null, $structure); + $this->assertEquals( + $content, + file_get_contents(vfsStream::url('root/foo%20bar/schema.xsd')) + ); + } +} + diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/PermissionsTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/PermissionsTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..56767ac7b495feb107b5ff10512a2ed2910c2b45 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/PermissionsTestCase.php @@ -0,0 +1,118 @@ + array('test.file' => '')); + $this->root = vfsStream::setup('root', null, $structure); + } + + /** + * @test + * @group issue_52 + */ + public function canNotChangePermissionWhenDirectoryNotWriteable() + { + $this->root->getChild('test_directory')->chmod(0444); + $this->assertFalse(@chmod(vfsStream::url('root/test_directory/test.file'), 0777)); + } + + /** + * @test + * @group issue_53 + */ + public function canNotChangePermissionWhenFileNotOwned() + { + $this->root->getChild('test_directory')->getChild('test.file')->chown(vfsStream::OWNER_USER_1); + $this->assertFalse(@chmod(vfsStream::url('root/test_directory/test.file'), 0777)); + } + + /** + * @test + * @group issue_52 + */ + public function canNotChangeOwnerWhenDirectoryNotWriteable() + { + $this->root->getChild('test_directory')->chmod(0444); + $this->assertFalse(@chown(vfsStream::url('root/test_directory/test.file'), vfsStream::OWNER_USER_2)); + } + + /** + * @test + * @group issue_53 + */ + public function canNotChangeOwnerWhenFileNotOwned() + { + $this->root->getChild('test_directory')->getChild('test.file')->chown(vfsStream::OWNER_USER_1); + $this->assertFalse(@chown(vfsStream::url('root/test_directory/test.file'), vfsStream::OWNER_USER_2)); + } + + /** + * @test + * @group issue_52 + */ + public function canNotChangeGroupWhenDirectoryNotWriteable() + { + $this->root->getChild('test_directory')->chmod(0444); + $this->assertFalse(@chgrp(vfsStream::url('root/test_directory/test.file'), vfsStream::GROUP_USER_2)); + } + + /** + * @test + * @group issue_53 + */ + public function canNotChangeGroupWhenFileNotOwned() + { + $this->root->getChild('test_directory')->getChild('test.file')->chown(vfsStream::OWNER_USER_1); + $this->assertFalse(@chgrp(vfsStream::url('root/test_directory/test.file'), vfsStream::GROUP_USER_2)); + } + + /** + * @test + * @group issue_107 + * @expectedException PHPUnit_Framework_Error + * @expectedExceptionMessage Can not create new file in non-writable path root + * @requires PHP 5.4 + * @since 1.5.0 + */ + public function touchOnNonWriteableDirectoryTriggersError() + { + $this->root->chmod(0555); + touch($this->root->url() . '/touch.txt'); + } + + /** + * @test + * @group issue_107 + * @requires PHP 5.4 + * @since 1.5.0 + */ + public function touchOnNonWriteableDirectoryDoesNotCreateFile() + { + $this->root->chmod(0555); + $this->assertFalse(@touch($this->root->url() . '/touch.txt')); + $this->assertFalse($this->root->hasChild('touch.txt')); + } +} diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/QuotaTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/QuotaTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..7007183e06d73ede157a0c520e9d73ae57a87540 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/QuotaTestCase.php @@ -0,0 +1,81 @@ +quota = new Quota(10); + } + + /** + * @test + */ + public function unlimitedQuotaIsNotLimited() + { + $this->assertFalse(Quota::unlimited()->isLimited()); + } + + /** + * @test + */ + public function limitedQuotaIsLimited() + { + $this->assertTrue($this->quota->isLimited()); + } + + /** + * @test + */ + public function unlimitedQuotaHasAlwaysSpaceLeft() + { + $this->assertEquals(303, Quota::unlimited()->spaceLeft(303)); + } + + /** + * @test + */ + public function hasNoSpaceLeftWhenUsedSpaceIsLargerThanQuota() + { + $this->assertEquals(0, $this->quota->spaceLeft(11)); + } + + /** + * @test + */ + public function hasNoSpaceLeftWhenUsedSpaceIsEqualToQuota() + { + $this->assertEquals(0, $this->quota->spaceLeft(10)); + } + + /** + * @test + */ + public function hasSpaceLeftWhenUsedSpaceIsLowerThanQuota() + { + $this->assertEquals(1, $this->quota->spaceLeft(9)); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/UnlinkTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/UnlinkTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..4f9fb17bc738d53a2bca61579b1eada25cf46dc0 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/UnlinkTestCase.php @@ -0,0 +1,58 @@ + array('test.file' => '')); + $root = vfsStream::setup('root', null, $structure); + $root->getChild('test_directory')->chmod(0777); + $root->getChild('test_directory')->getChild('test.file')->chmod(0444); + $this->assertTrue(@unlink(vfsStream::url('root/test_directory/test.file'))); + } + + /** + * @test + * @group issue_51 + */ + public function canNotRemoveWritableFileFromNonWritableDirectory() + { + $structure = array('test_directory' => array('test.file' => '')); + $root = vfsStream::setup('root', null, $structure); + $root->getChild('test_directory')->chmod(0444); + $root->getChild('test_directory')->getChild('test.file')->chmod(0777); + $this->assertFalse(@unlink(vfsStream::url('root/test_directory/test.file'))); + } + + /** + * @test + * @since 1.4.0 + * @group issue_68 + */ + public function unlinkNonExistingFileTriggersError() + { + vfsStream::setup(); + try { + $this->assertFalse(unlink('vfs://root/foo.txt')); + } catch (\PHPUnit_Framework_Error $fe) { + $this->assertEquals('unlink(vfs://root/foo.txt): No such file or directory', $fe->getMessage()); + } + } +} diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/content/LargeFileContentTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/content/LargeFileContentTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..c7a7458de23786541241d70b9f944200741f04c3 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/content/LargeFileContentTestCase.php @@ -0,0 +1,225 @@ +largeFileContent = new LargeFileContent(100); + } + + /** + * @test + */ + public function hasSizeOriginallyGiven() + { + $this->assertEquals(100, $this->largeFileContent->size()); + } + + /** + * @test + */ + public function contentIsFilledUpWithSpacesIfNoDataWritten() + { + $this->assertEquals( + str_repeat(' ', 100), + $this->largeFileContent->content() + ); + } + + /** + * @test + */ + public function readReturnsSpacesWhenNothingWrittenAtOffset() + { + $this->assertEquals( + str_repeat(' ', 10), + $this->largeFileContent->read(10) + ); + } + + /** + * @test + */ + public function readReturnsContentFilledWithSpaces() + { + $this->largeFileContent->write('foobarbaz'); + $this->largeFileContent->seek(0, SEEK_SET); + $this->assertEquals( + 'foobarbaz ', + $this->largeFileContent->read(10) + ); + } + + /** + * @test + */ + public function writesDataAtStartWhenOffsetNotMoved() + { + $this->assertEquals(9, $this->largeFileContent->write('foobarbaz')); + $this->assertEquals( + 'foobarbaz' . str_repeat(' ', 91), + $this->largeFileContent->content() + ); + } + + /** + * @test + */ + public function writeDataAtStartDoesNotIncreaseSize() + { + $this->assertEquals(9, $this->largeFileContent->write('foobarbaz')); + $this->assertEquals(100, $this->largeFileContent->size()); + } + + /** + * @test + */ + public function writesDataAtOffsetWhenOffsetMoved() + { + $this->largeFileContent->seek(50, SEEK_SET); + $this->assertEquals(9, $this->largeFileContent->write('foobarbaz')); + $this->assertEquals( + str_repeat(' ', 50) . 'foobarbaz' . str_repeat(' ', 41), + $this->largeFileContent->content() + ); + } + + /** + * @test + */ + public function writeDataInBetweenDoesNotIncreaseSize() + { + $this->largeFileContent->seek(50, SEEK_SET); + $this->assertEquals(9, $this->largeFileContent->write('foobarbaz')); + $this->assertEquals(100, $this->largeFileContent->size()); + } + + /** + * @test + */ + public function writesDataOverEndWhenOffsetAndDataLengthLargerThanSize() + { + $this->largeFileContent->seek(95, SEEK_SET); + $this->assertEquals(9, $this->largeFileContent->write('foobarbaz')); + $this->assertEquals( + str_repeat(' ', 95) . 'foobarbaz', + $this->largeFileContent->content() + ); + } + + /** + * @test + */ + public function writeDataOverLastOffsetIncreasesSize() + { + $this->largeFileContent->seek(95, SEEK_SET); + $this->assertEquals(9, $this->largeFileContent->write('foobarbaz')); + $this->assertEquals(104, $this->largeFileContent->size()); + } + + /** + * @test + */ + public function writesDataAfterEndWhenOffsetAfterEnd() + { + $this->largeFileContent->seek(0, SEEK_END); + $this->assertEquals(9, $this->largeFileContent->write('foobarbaz')); + $this->assertEquals( + str_repeat(' ', 100) . 'foobarbaz', + $this->largeFileContent->content() + ); + } + + /** + * @test + */ + public function writeDataAfterLastOffsetIncreasesSize() + { + $this->largeFileContent->seek(0, SEEK_END); + $this->assertEquals(9, $this->largeFileContent->write('foobarbaz')); + $this->assertEquals(109, $this->largeFileContent->size()); + } + + /** + * @test + */ + public function truncateReducesSize() + { + $this->assertTrue($this->largeFileContent->truncate(50)); + $this->assertEquals(50, $this->largeFileContent->size()); + } + + /** + * @test + */ + public function truncateRemovesWrittenContentAfterOffset() + { + $this->largeFileContent->seek(45, SEEK_SET); + $this->largeFileContent->write('foobarbaz'); + $this->assertTrue($this->largeFileContent->truncate(50)); + $this->assertEquals( + str_repeat(' ', 45) . 'fooba', + $this->largeFileContent->content() + ); + } + + /** + * @test + */ + public function createInstanceWithKilobytes() + { + $this->assertEquals( + 100 * 1024, + LargeFileContent::withKilobytes(100) + ->size() + ); + } + + /** + * @test + */ + public function createInstanceWithMegabytes() + { + $this->assertEquals( + 100 * 1024 * 1024, + LargeFileContent::withMegabytes(100) + ->size() + ); + } + + /** + * @test + */ + public function createInstanceWithGigabytes() + { + $this->assertEquals( + 100 * 1024 * 1024 * 1024, + LargeFileContent::withGigabytes(100) + ->size() + ); + } +} diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/content/StringBasedFileContentTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/content/StringBasedFileContentTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..d0e15edb42aefbe175edeeb9b52e7e18f1d12ed4 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/content/StringBasedFileContentTestCase.php @@ -0,0 +1,230 @@ +stringBasedFileContent = new StringBasedFileContent('foobarbaz'); + } + + /** + * @test + */ + public function hasContentOriginallySet() + { + $this->assertEquals('foobarbaz', $this->stringBasedFileContent->content()); + } + + /** + * @test + */ + public function hasNotReachedEofAfterCreation() + { + $this->assertFalse($this->stringBasedFileContent->eof()); + } + + /** + * @test + */ + public function sizeEqualsLengthOfGivenString() + { + $this->assertEquals(9, $this->stringBasedFileContent->size()); + } + + /** + * @test + */ + public function readReturnsSubstringWithRequestedLength() + { + $this->assertEquals('foo', $this->stringBasedFileContent->read(3)); + } + + /** + * @test + */ + public function readMovesOffset() + { + $this->assertEquals('foo', $this->stringBasedFileContent->read(3)); + $this->assertEquals('bar', $this->stringBasedFileContent->read(3)); + $this->assertEquals('baz', $this->stringBasedFileContent->read(3)); + } + + /** + * @test + */ + public function reaMoreThanSizeReturnsWholeContent() + { + $this->assertEquals('foobarbaz', $this->stringBasedFileContent->read(10)); + } + + /** + * @test + */ + public function readAfterEndReturnsEmptyString() + { + $this->stringBasedFileContent->read(9); + $this->assertEquals('', $this->stringBasedFileContent->read(3)); + } + + /** + * @test + */ + public function readDoesNotChangeSize() + { + $this->stringBasedFileContent->read(3); + $this->assertEquals(9, $this->stringBasedFileContent->size()); + } + + /** + * @test + */ + public function readLessThenSizeDoesNotReachEof() + { + $this->stringBasedFileContent->read(3); + $this->assertFalse($this->stringBasedFileContent->eof()); + } + + /** + * @test + */ + public function readSizeReachesEof() + { + $this->stringBasedFileContent->read(9); + $this->assertTrue($this->stringBasedFileContent->eof()); + } + + /** + * @test + */ + public function readMoreThanSizeReachesEof() + { + $this->stringBasedFileContent->read(10); + $this->assertTrue($this->stringBasedFileContent->eof()); + } + + /** + * @test + */ + public function seekWithInvalidOptionReturnsFalse() + { + $this->assertFalse($this->stringBasedFileContent->seek(0, 55)); + } + + /** + * @test + */ + public function canSeekToGivenOffset() + { + $this->assertTrue($this->stringBasedFileContent->seek(5, SEEK_SET)); + $this->assertEquals('rbaz', $this->stringBasedFileContent->read(10)); + } + + /** + * @test + */ + public function canSeekFromCurrentOffset() + { + $this->assertTrue($this->stringBasedFileContent->seek(5, SEEK_SET)); + $this->assertTrue($this->stringBasedFileContent->seek(2, SEEK_CUR)); + $this->assertEquals('az', $this->stringBasedFileContent->read(10)); + } + + /** + * @test + */ + public function canSeekToEnd() + { + $this->assertTrue($this->stringBasedFileContent->seek(0, SEEK_END)); + $this->assertEquals('', $this->stringBasedFileContent->read(10)); + } + + /** + * @test + */ + public function writeOverwritesExistingContentWhenOffsetNotAtEof() + { + $this->assertEquals(3, $this->stringBasedFileContent->write('bar')); + $this->assertEquals('barbarbaz', $this->stringBasedFileContent->content()); + } + + /** + * @test + */ + public function writeAppendsContentWhenOffsetAtEof() + { + $this->assertTrue($this->stringBasedFileContent->seek(0, SEEK_END)); + $this->assertEquals(3, $this->stringBasedFileContent->write('bar')); + $this->assertEquals('foobarbazbar', $this->stringBasedFileContent->content()); + } + + /** + * @test + * @group issue_33 + * @since 1.1.0 + */ + public function truncateRemovesSuperflouosContent() + { + $this->assertTrue($this->stringBasedFileContent->truncate(6)); + $this->assertEquals('foobar', $this->stringBasedFileContent->content()); + } + + /** + * @test + * @group issue_33 + * @since 1.1.0 + */ + public function truncateDecreasesSize() + { + $this->assertTrue($this->stringBasedFileContent->truncate(6)); + $this->assertEquals(6, $this->stringBasedFileContent->size()); + } + + /** + * @test + * @group issue_33 + * @since 1.1.0 + */ + public function truncateToGreaterSizeAddsZeroBytes() + { + $this->assertTrue($this->stringBasedFileContent->truncate(25)); + $this->assertEquals( + "foobarbaz\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", + $this->stringBasedFileContent->content() + ); + } + + /** + * @test + * @group issue_33 + * @since 1.1.0 + */ + public function truncateToGreaterSizeIncreasesSize() + { + $this->assertTrue($this->stringBasedFileContent->truncate(25)); + $this->assertEquals(25, $this->stringBasedFileContent->size()); + } +} diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/proxy/vfsStreamWrapperRecordingProxy.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/proxy/vfsStreamWrapperRecordingProxy.php new file mode 100644 index 0000000000000000000000000000000000000000..899931d6876cc8de91e399ce22cbe852ad67ec9c --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/proxy/vfsStreamWrapperRecordingProxy.php @@ -0,0 +1,326 @@ + + */ + public static function getMethodCalls($path) + { + if (isset(self::$calledMethods[$path]) === true) { + return self::$calledMethods[$path]; + } + + return array(); + } + + /** + * helper method for setting up vfsStream with the proxy + * + * @param string $rootDirName optional name of root directory + * @param int $permissions optional file permissions of root directory + * @return vfsStreamDirectory + * @throws vfsStreamException + */ + public static function setup($rootDirName = 'root', $permissions = null) + { + self::$root = vfsStream::newDirectory($rootDirName, $permissions); + if (true === self::$registered) { + return self::$root; + } + + if (@stream_wrapper_register(vfsStream::SCHEME, __CLASS__) === false) { + throw new vfsStreamException('A handler has already been registered for the ' . vfsStream::SCHEME . ' protocol.'); + } + + self::$registered = true; + return self::$root; + } + + /** + * open the stream + * + * @param string $path the path to open + * @param string $mode mode for opening + * @param string $options options for opening + * @param string $opened_path full path that was actually opened + * @return bool + */ + public function stream_open($path, $mode, $options, $opened_path) + { + $this->path = $path; + self::recordMethodCall('stream_open', $this->path); + return parent::stream_open($path, $mode, $options, $opened_path); + } + + /** + * closes the stream + */ + public function stream_close() + { + self::recordMethodCall('stream_close', $this->path); + return parent::stream_close(); + } + + /** + * read the stream up to $count bytes + * + * @param int $count amount of bytes to read + * @return string + */ + public function stream_read($count) + { + self::recordMethodCall('stream_read', $this->path); + return parent::stream_read($count); + } + + /** + * writes data into the stream + * + * @param string $data + * @return int amount of bytes written + */ + public function stream_write($data) + { + self::recordMethodCall('stream_write', $this->path); + return parent::stream_write($data); + } + + /** + * checks whether stream is at end of file + * + * @return bool + */ + public function stream_eof() + { + self::recordMethodCall('stream_eof', $this->path); + return parent::stream_eof(); + } + + /** + * returns the current position of the stream + * + * @return int + */ + public function stream_tell() + { + self::recordMethodCall('stream_tell', $this->path); + return parent::stream_tell(); + } + + /** + * seeks to the given offset + * + * @param int $offset + * @param int $whence + * @return bool + */ + public function stream_seek($offset, $whence) + { + self::recordMethodCall('stream_seek', $this->path); + return parent::stream_seek($offset, $whence); + } + + /** + * flushes unstored data into storage + * + * @return bool + */ + public function stream_flush() + { + self::recordMethodCall('stream_flush', $this->path); + return parent::stream_flush(); + } + + /** + * returns status of stream + * + * @return array + */ + public function stream_stat() + { + self::recordMethodCall('stream_stat', $this->path); + return parent::stream_stat(); + } + + /** + * retrieve the underlaying resource + * + * @param int $cast_as + * @return bool + */ + public function stream_cast($cast_as) + { + self::recordMethodCall('stream_cast', $this->path); + return parent::stream_cast($cast_as); + } + + /** + * set lock status for stream + * + * @param int $operation + * @return bool + */ + public function stream_lock($operation) + { + self::recordMethodCall('stream_link', $this->path); + return parent::stream_lock($operation); + } + + /** + * remove the data under the given path + * + * @param string $path + * @return bool + */ + public function unlink($path) + { + self::recordMethodCall('unlink', $path); + return parent::unlink($path); + } + + /** + * rename from one path to another + * + * @param string $path_from + * @param string $path_to + * @return bool + */ + public function rename($path_from, $path_to) + { + self::recordMethodCall('rename', $path_from); + return parent::rename($path_from, $path_to); + } + + /** + * creates a new directory + * + * @param string $path + * @param int $mode + * @param int $options + * @return bool + */ + public function mkdir($path, $mode, $options) + { + self::recordMethodCall('mkdir', $path); + return parent::mkdir($path, $mode, $options); + } + + /** + * removes a directory + * + * @param string $path + * @param int $options + * @return bool + */ + public function rmdir($path, $options) + { + self::recordMethodCall('rmdir', $path); + return parent::rmdir($path, $options); + } + + /** + * opens a directory + * + * @param string $path + * @param int $options + * @return bool + */ + public function dir_opendir($path, $options) + { + $this->path = $path; + self::recordMethodCall('dir_opendir', $this->path); + return parent::dir_opendir($path, $options); + } + + /** + * reads directory contents + * + * @return string + */ + public function dir_readdir() + { + self::recordMethodCall('dir_readdir', $this->path); + return parent::dir_readdir(); + } + + /** + * reset directory iteration + * + * @return bool + */ + public function dir_rewinddir() + { + self::recordMethodCall('dir_rewinddir', $this->path); + return parent::dir_rewinddir(); + } + + /** + * closes directory + * + * @return bool + */ + public function dir_closedir() + { + self::recordMethodCall('dir_closedir', $this->path); + return parent::dir_closedir(); + } + + /** + * returns status of url + * + * @param string $path path of url to return status for + * @param int $flags flags set by the stream API + * @return array + */ + public function url_stat($path, $flags) + { + self::recordMethodCall('url_stat', $path); + return parent::url_stat($path, $flags); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamAbstractContentTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamAbstractContentTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..9bb60795beb757c01a14ed487a84116b46008c1c --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamAbstractContentTestCase.php @@ -0,0 +1,1054 @@ +assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function executePermissionsForUser() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0100); + $this->assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertTrue($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function executePermissionsForGroup() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0010); + $this->assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function executePermissionsForOther() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0001); + $this->assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function writePermissionsForUser() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0200); + $this->assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertTrue($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function writePermissionsForGroup() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0020); + $this->assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function writePermissionsForOther() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0002); + $this->assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function executeAndWritePermissionsForUser() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0300); + $this->assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertTrue($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertTrue($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function executeAndWritePermissionsForGroup() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0030); + $this->assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function executeAndWritePermissionsForOther() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0003); + $this->assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function readPermissionsForUser() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0400); + $this->assertTrue($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function readPermissionsForGroup() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0040); + $this->assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function readPermissionsForOther() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0004); + $this->assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function readAndExecutePermissionsForUser() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0500); + $this->assertTrue($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertTrue($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function readAndExecutePermissionsForGroup() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0050); + $this->assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function readAndExecutePermissionsForOther() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0005); + $this->assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function readAndWritePermissionsForUser() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0600); + $this->assertTrue($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertTrue($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function readAndWritePermissionsForGroup() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0060); + $this->assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function readAndWritePermissionsForOther() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0006); + $this->assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function allPermissionsForUser() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0700); + $this->assertTrue($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertTrue($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertTrue($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function allPermissionsForGroup() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0070); + $this->assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + -1 + ) + ); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function allPermissionsForOther() + { + $abstractContent = new TestvfsStreamAbstractContent('foo', 0007); + $this->assertFalse($abstractContent->isReadable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isReadable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isReadable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isWritable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isWritable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isWritable(-1, + -1 + ) + ); + $this->assertFalse($abstractContent->isExecutable(vfsStream::getCurrentUser(), + vfsStream::getCurrentGroup() + ) + ); + $this->assertFalse($abstractContent->isExecutable(-1, + vfsStream::getCurrentGroup() + ) + ); + $this->assertTrue($abstractContent->isExecutable(-1, + -1 + ) + ); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamBlockTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamBlockTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..33222f7ae88f09e0b3227d9293403a2d092aa531 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamBlockTestCase.php @@ -0,0 +1,89 @@ +block = new vfsStreamBlock('foo'); + } + + /** + * test default values and methods + * + * @test + */ + public function defaultValues() + { + $this->assertEquals(vfsStreamContent::TYPE_BLOCK, $this->block->getType()); + $this->assertEquals('foo', $this->block->getName()); + $this->assertTrue($this->block->appliesTo('foo')); + $this->assertFalse($this->block->appliesTo('foo/bar')); + $this->assertFalse($this->block->appliesTo('bar')); + } + + /** + * tests how external functions see this object + * + * @test + */ + public function external() + { + $root = vfsStream::setup('root'); + $root->addChild(vfsStream::newBlock('foo')); + $this->assertEquals('block', filetype(vfsStream::url('root/foo'))); + } + + /** + * tests adding a complex structure + * + * @test + */ + public function addStructure() + { + $structure = array( + 'topLevel' => array( + 'thisIsAFile' => 'file contents', + '[blockDevice]' => 'block contents' + ) + ); + + $root = vfsStream::create($structure); + + $this->assertSame('block', filetype(vfsStream::url('root/topLevel/blockDevice'))); + } + + /** + * tests that a blank name for a block device throws an exception + * @test + * @expectedException org\bovigo\vfs\vfsStreamException + */ + public function createWithEmptyName() + { + $structure = array( + 'topLevel' => array( + 'thisIsAFile' => 'file contents', + '[]' => 'block contents' + ) + ); + + $root = vfsStream::create($structure); + } +} diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamContainerIteratorTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamContainerIteratorTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..e1b4fe112069cc8e688bf05c39429fc930226de8 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamContainerIteratorTestCase.php @@ -0,0 +1,112 @@ +dir = new vfsStreamDirectory('foo'); + $this->mockChild1 = $this->getMock('org\\bovigo\\vfs\\vfsStreamContent'); + $this->mockChild1->expects($this->any()) + ->method('getName') + ->will($this->returnValue('bar')); + $this->dir->addChild($this->mockChild1); + $this->mockChild2 = $this->getMock('org\\bovigo\\vfs\\vfsStreamContent'); + $this->mockChild2->expects($this->any()) + ->method('getName') + ->will($this->returnValue('baz')); + $this->dir->addChild($this->mockChild2); + } + + /** + * clean up test environment + */ + public function tearDown() + { + vfsStream::enableDotfiles(); + } + + /** + * @return array + */ + public function provideSwitchWithExpectations() + { + return array(array(function() { vfsStream::disableDotfiles(); }, + array() + ), + array(function() { vfsStream::enableDotfiles(); }, + array('.', '..') + ) + ); + } + + private function getDirName($dir) + { + if (is_string($dir)) { + return $dir; + } + + + return $dir->getName(); + } + + /** + * @param \Closure $dotFilesSwitch + * @param array $dirNames + * @test + * @dataProvider provideSwitchWithExpectations + */ + public function iteration(\Closure $dotFilesSwitch, array $dirs) + { + $dirs[] = $this->mockChild1; + $dirs[] = $this->mockChild2; + $dotFilesSwitch(); + $dirIterator = $this->dir->getIterator(); + foreach ($dirs as $dir) { + $this->assertEquals($this->getDirName($dir), $dirIterator->key()); + $this->assertTrue($dirIterator->valid()); + if (!is_string($dir)) { + $this->assertSame($dir, $dirIterator->current()); + } + + $dirIterator->next(); + } + + $this->assertFalse($dirIterator->valid()); + $this->assertNull($dirIterator->key()); + $this->assertNull($dirIterator->current()); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamDirectoryIssue18TestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamDirectoryIssue18TestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..89cde1ce8782ad67f9d9a72e4f3c2750494544ab --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamDirectoryIssue18TestCase.php @@ -0,0 +1,81 @@ +rootDirectory = vfsStream::newDirectory('/'); + $this->rootDirectory->addChild(vfsStream::newDirectory('var/log/app')); + $dir = $this->rootDirectory->getChild('var/log/app'); + $dir->addChild(vfsStream::newDirectory('app1')); + $dir->addChild(vfsStream::newDirectory('app2')); + $dir->addChild(vfsStream::newDirectory('foo')); + } + + /** + * @test + */ + public function shouldContainThreeSubdirectories() + { + $this->assertEquals(3, + count($this->rootDirectory->getChild('var/log/app')->getChildren()) + ); + } + + /** + * @test + */ + public function shouldContainSubdirectoryFoo() + { + $this->assertTrue($this->rootDirectory->getChild('var/log/app')->hasChild('foo')); + $this->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamDirectory', + $this->rootDirectory->getChild('var/log/app')->getChild('foo') + ); + } + + /** + * @test + */ + public function shouldContainSubdirectoryApp1() + { + $this->assertTrue($this->rootDirectory->getChild('var/log/app')->hasChild('app1')); + $this->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamDirectory', + $this->rootDirectory->getChild('var/log/app')->getChild('app1') + ); + } + + /** + * @test + */ + public function shouldContainSubdirectoryApp2() + { + $this->assertTrue($this->rootDirectory->getChild('var/log/app')->hasChild('app2')); + $this->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamDirectory', + $this->rootDirectory->getChild('var/log/app')->getChild('app2') + ); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamDirectoryTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamDirectoryTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..f8b93842fc18d0317c2383692600a091c2260029 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamDirectoryTestCase.php @@ -0,0 +1,335 @@ +dir = new vfsStreamDirectory('foo'); + } + + /** + * assure that a directory seperator inside the name throws an exception + * + * @test + * @expectedException org\bovigo\vfs\vfsStreamException + */ + public function invalidCharacterInName() + { + $dir = new vfsStreamDirectory('foo/bar'); + } + + /** + * test default values and methods + * + * @test + */ + public function defaultValues() + { + $this->assertEquals(vfsStreamContent::TYPE_DIR, $this->dir->getType()); + $this->assertEquals('foo', $this->dir->getName()); + $this->assertTrue($this->dir->appliesTo('foo')); + $this->assertTrue($this->dir->appliesTo('foo/bar')); + $this->assertFalse($this->dir->appliesTo('bar')); + $this->assertEquals(array(), $this->dir->getChildren()); + } + + /** + * test renaming the directory + * + * @test + */ + public function rename() + { + $this->dir->rename('bar'); + $this->assertEquals('bar', $this->dir->getName()); + $this->assertFalse($this->dir->appliesTo('foo')); + $this->assertFalse($this->dir->appliesTo('foo/bar')); + $this->assertTrue($this->dir->appliesTo('bar')); + } + + /** + * renaming the directory to an invalid name throws a vfsStreamException + * + * @test + * @expectedException org\bovigo\vfs\vfsStreamException + */ + public function renameToInvalidNameThrowsvfsStreamException() + { + $this->dir->rename('foo/baz'); + } + + /** + * @test + * @since 0.10.0 + */ + public function hasNoChildrenByDefault() + { + $this->assertFalse($this->dir->hasChildren()); + } + + /** + * @test + * @since 0.10.0 + */ + public function hasChildrenReturnsTrueIfAtLeastOneChildPresent() + { + $mockChild = $this->getMock('org\\bovigo\\vfs\\vfsStreamContent'); + $mockChild->expects($this->any()) + ->method('appliesTo') + ->will($this->returnValue(false)); + $mockChild->expects($this->any()) + ->method('getName') + ->will($this->returnValue('baz')); + $this->dir->addChild($mockChild); + $this->assertTrue($this->dir->hasChildren()); + } + + /** + * @test + */ + public function hasChildReturnsFalseForNonExistingChild() + { + $this->assertFalse($this->dir->hasChild('bar')); + } + + /** + * @test + */ + public function getChildReturnsNullForNonExistingChild() + { + $this->assertNull($this->dir->getChild('bar')); + } + + /** + * @test + */ + public function removeChildReturnsFalseForNonExistingChild() + { + $this->assertFalse($this->dir->removeChild('bar')); + } + + /** + * @test + */ + public function nonExistingChild() + { + $mockChild = $this->getMock('org\\bovigo\\vfs\\vfsStreamContent'); + $mockChild->expects($this->any()) + ->method('appliesTo') + ->will($this->returnValue(false)); + $mockChild->expects($this->any()) + ->method('getName') + ->will($this->returnValue('baz')); + $this->dir->addChild($mockChild); + $this->assertFalse($this->dir->removeChild('bar')); + } + + /** + * test that adding, handling and removing of a child works as expected + * + * @test + */ + public function childHandling() + { + $mockChild = $this->getMock('org\\bovigo\\vfs\\vfsStreamContent'); + $mockChild->expects($this->any()) + ->method('getType') + ->will($this->returnValue(vfsStreamContent::TYPE_FILE)); + $mockChild->expects($this->any()) + ->method('getName') + ->will($this->returnValue('bar')); + $mockChild->expects($this->any()) + ->method('appliesTo') + ->with($this->equalTo('bar')) + ->will($this->returnValue(true)); + $mockChild->expects($this->once()) + ->method('size') + ->will($this->returnValue(5)); + $this->dir->addChild($mockChild); + $this->assertTrue($this->dir->hasChild('bar')); + $bar = $this->dir->getChild('bar'); + $this->assertSame($mockChild, $bar); + $this->assertEquals(array($mockChild), $this->dir->getChildren()); + $this->assertEquals(0, $this->dir->size()); + $this->assertEquals(5, $this->dir->sizeSummarized()); + $this->assertTrue($this->dir->removeChild('bar')); + $this->assertEquals(array(), $this->dir->getChildren()); + $this->assertEquals(0, $this->dir->size()); + $this->assertEquals(0, $this->dir->sizeSummarized()); + } + + /** + * test that adding, handling and removing of a child works as expected + * + * @test + */ + public function childHandlingWithSubdirectory() + { + $mockChild = $this->getMock('org\\bovigo\\vfs\\vfsStreamContent'); + $mockChild->expects($this->any()) + ->method('getType') + ->will($this->returnValue(vfsStreamContent::TYPE_FILE)); + $mockChild->expects($this->any()) + ->method('getName') + ->will($this->returnValue('bar')); + $mockChild->expects($this->once()) + ->method('size') + ->will($this->returnValue(5)); + $subdir = new vfsStreamDirectory('subdir'); + $subdir->addChild($mockChild); + $this->dir->addChild($subdir); + $this->assertTrue($this->dir->hasChild('subdir')); + $this->assertSame($subdir, $this->dir->getChild('subdir')); + $this->assertEquals(array($subdir), $this->dir->getChildren()); + $this->assertEquals(0, $this->dir->size()); + $this->assertEquals(5, $this->dir->sizeSummarized()); + $this->assertTrue($this->dir->removeChild('subdir')); + $this->assertEquals(array(), $this->dir->getChildren()); + $this->assertEquals(0, $this->dir->size()); + $this->assertEquals(0, $this->dir->sizeSummarized()); + } + + /** + * dd + * + * @test + * @group regression + * @group bug_5 + */ + public function addChildReplacesChildWithSameName_Bug_5() + { + $mockChild1 = $this->getMock('org\\bovigo\\vfs\\vfsStreamContent'); + $mockChild1->expects($this->any()) + ->method('getType') + ->will($this->returnValue(vfsStreamContent::TYPE_FILE)); + $mockChild1->expects($this->any()) + ->method('getName') + ->will($this->returnValue('bar')); + $mockChild2 = $this->getMock('org\\bovigo\\vfs\\vfsStreamContent'); + $mockChild2->expects($this->any()) + ->method('getType') + ->will($this->returnValue(vfsStreamContent::TYPE_FILE)); + $mockChild2->expects($this->any()) + ->method('getName') + ->will($this->returnValue('bar')); + $this->dir->addChild($mockChild1); + $this->assertTrue($this->dir->hasChild('bar')); + $this->assertSame($mockChild1, $this->dir->getChild('bar')); + $this->dir->addChild($mockChild2); + $this->assertTrue($this->dir->hasChild('bar')); + $this->assertSame($mockChild2, $this->dir->getChild('bar')); + } + + /** + * When testing for a nested path, verify that directory separators are respected properly + * so that subdir1/subdir2 is not considered equal to subdir1Xsubdir2. + * + * @test + * @group bug_24 + * @group regression + */ + public function explicitTestForSeparatorWithNestedPaths_Bug_24() + { + $mockChild = $this->getMock('org\\bovigo\\vfs\\vfsStreamContent'); + $mockChild->expects($this->any()) + ->method('getType') + ->will($this->returnValue(vfsStreamContent::TYPE_FILE)); + $mockChild->expects($this->any()) + ->method('getName') + ->will($this->returnValue('bar')); + + $subdir1 = new vfsStreamDirectory('subdir1'); + $this->dir->addChild($subdir1); + + $subdir2 = new vfsStreamDirectory('subdir2'); + $subdir1->addChild($subdir2); + + $subdir2->addChild($mockChild); + + $this->assertTrue($this->dir->hasChild('subdir1'), "Level 1 path with separator exists"); + $this->assertTrue($this->dir->hasChild('subdir1/subdir2'), "Level 2 path with separator exists"); + $this->assertTrue($this->dir->hasChild('subdir1/subdir2/bar'), "Level 3 path with separator exists"); + $this->assertFalse($this->dir->hasChild('subdir1.subdir2'), "Path with period does not exist"); + $this->assertFalse($this->dir->hasChild('subdir1.subdir2/bar'), "Nested path with period does not exist"); + } + + + /** + * setting and retrieving permissions for a directory + * + * @test + * @group permissions + */ + public function permissions() + { + $this->assertEquals(0777, $this->dir->getPermissions()); + $this->assertSame($this->dir, $this->dir->chmod(0755)); + $this->assertEquals(0755, $this->dir->getPermissions()); + } + + /** + * setting and retrieving permissions for a directory + * + * @test + * @group permissions + */ + public function permissionsSet() + { + $this->dir = new vfsStreamDirectory('foo', 0755); + $this->assertEquals(0755, $this->dir->getPermissions()); + $this->assertSame($this->dir, $this->dir->chmod(0700)); + $this->assertEquals(0700, $this->dir->getPermissions()); + } + + /** + * setting and retrieving owner of a file + * + * @test + * @group permissions + */ + public function owner() + { + $this->assertEquals(vfsStream::getCurrentUser(), $this->dir->getUser()); + $this->assertTrue($this->dir->isOwnedByUser(vfsStream::getCurrentUser())); + $this->assertSame($this->dir, $this->dir->chown(vfsStream::OWNER_USER_1)); + $this->assertEquals(vfsStream::OWNER_USER_1, $this->dir->getUser()); + $this->assertTrue($this->dir->isOwnedByUser(vfsStream::OWNER_USER_1)); + } + + /** + * setting and retrieving owner group of a file + * + * @test + * @group permissions + */ + public function group() + { + $this->assertEquals(vfsStream::getCurrentGroup(), $this->dir->getGroup()); + $this->assertTrue($this->dir->isOwnedByGroup(vfsStream::getCurrentGroup())); + $this->assertSame($this->dir, $this->dir->chgrp(vfsStream::GROUP_USER_1)); + $this->assertEquals(vfsStream::GROUP_USER_1, $this->dir->getGroup()); + $this->assertTrue($this->dir->isOwnedByGroup(vfsStream::GROUP_USER_1)); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamExLockTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamExLockTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..976356008a63aa3e35b7a22cdcd88e6df033ed2c --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamExLockTestCase.php @@ -0,0 +1,56 @@ +at($root); + + } + + /** + * This test verifies the current behaviour where vfsStream URLs do not work + * with file_put_contents() and LOCK_EX. The test is intended to break once + * PHP changes this so we get notified about the change. + * + * @test + */ + public function filePutContentsLockShouldReportError() + { + @file_put_contents(vfsStream::url('root/testfile'), "some string\n", LOCK_EX); + $php_error = error_get_last(); + $this->assertEquals("file_put_contents(): Exclusive locks may only be set for regular files", $php_error['message']); + } + + /** + * @test + */ + public function flockSouldPass() + { + $fp = fopen(vfsStream::url('root/testfile'), 'w'); + flock($fp, LOCK_EX); + fwrite($fp, "another string\n"); + flock($fp, LOCK_UN); + fclose($fp); + $this->assertEquals("another string\n", file_get_contents(vfsStream::url('root/testfile'))); + } +} + diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamFileTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamFileTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..5fe15d030eb27e41c323af706d1490c754e16752 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamFileTestCase.php @@ -0,0 +1,306 @@ +file = new vfsStreamFile('foo'); + } + + /** + * test default values and methods + * + * @test + */ + public function defaultValues() + { + $this->assertEquals(vfsStreamContent::TYPE_FILE, $this->file->getType()); + $this->assertEquals('foo', $this->file->getName()); + $this->assertTrue($this->file->appliesTo('foo')); + $this->assertFalse($this->file->appliesTo('foo/bar')); + $this->assertFalse($this->file->appliesTo('bar')); + } + + /** + * test setting and getting the content of a file + * + * @test + */ + public function content() + { + $this->assertNull($this->file->getContent()); + $this->assertSame($this->file, $this->file->setContent('bar')); + $this->assertEquals('bar', $this->file->getContent()); + $this->assertSame($this->file, $this->file->withContent('baz')); + $this->assertEquals('baz', $this->file->getContent()); + } + + /** + * test renaming the directory + * + * @test + */ + public function rename() + { + $this->file->rename('bar'); + $this->assertEquals('bar', $this->file->getName()); + $this->assertFalse($this->file->appliesTo('foo')); + $this->assertFalse($this->file->appliesTo('foo/bar')); + $this->assertTrue($this->file->appliesTo('bar')); + } + + /** + * test reading contents from the file + * + * @test + */ + public function readEmptyFile() + { + $this->assertTrue($this->file->eof()); + $this->assertEquals(0, $this->file->size()); + $this->assertEquals('', $this->file->read(5)); + $this->assertEquals(5, $this->file->getBytesRead()); + $this->assertTrue($this->file->eof()); + } + + /** + * test reading contents from the file + * + * @test + */ + public function read() + { + $this->file->setContent('foobarbaz'); + $this->assertFalse($this->file->eof()); + $this->assertEquals(9, $this->file->size()); + $this->assertEquals('foo', $this->file->read(3)); + $this->assertEquals(3, $this->file->getBytesRead()); + $this->assertFalse($this->file->eof()); + $this->assertEquals(9, $this->file->size()); + $this->assertEquals('bar', $this->file->read(3)); + $this->assertEquals(6, $this->file->getBytesRead()); + $this->assertFalse($this->file->eof()); + $this->assertEquals(9, $this->file->size()); + $this->assertEquals('baz', $this->file->read(3)); + $this->assertEquals(9, $this->file->getBytesRead()); + $this->assertEquals(9, $this->file->size()); + $this->assertTrue($this->file->eof()); + $this->assertEquals('', $this->file->read(3)); + } + + /** + * test seeking to offset + * + * @test + */ + public function seekEmptyFile() + { + $this->assertFalse($this->file->seek(0, 55)); + $this->assertTrue($this->file->seek(0, SEEK_SET)); + $this->assertEquals(0, $this->file->getBytesRead()); + $this->assertTrue($this->file->seek(5, SEEK_SET)); + $this->assertEquals(5, $this->file->getBytesRead()); + $this->assertTrue($this->file->seek(0, SEEK_CUR)); + $this->assertEquals(5, $this->file->getBytesRead()); + $this->assertTrue($this->file->seek(2, SEEK_CUR)); + $this->assertEquals(7, $this->file->getBytesRead()); + $this->assertTrue($this->file->seek(0, SEEK_END)); + $this->assertEquals(0, $this->file->getBytesRead()); + $this->assertTrue($this->file->seek(2, SEEK_END)); + $this->assertEquals(2, $this->file->getBytesRead()); + } + + /** + * test seeking to offset + * + * @test + */ + public function seekRead() + { + $this->file->setContent('foobarbaz'); + $this->assertFalse($this->file->seek(0, 55)); + $this->assertTrue($this->file->seek(0, SEEK_SET)); + $this->assertEquals('foobarbaz', $this->file->readUntilEnd()); + $this->assertEquals(0, $this->file->getBytesRead()); + $this->assertTrue($this->file->seek(5, SEEK_SET)); + $this->assertEquals('rbaz', $this->file->readUntilEnd()); + $this->assertEquals(5, $this->file->getBytesRead()); + $this->assertTrue($this->file->seek(0, SEEK_CUR)); + $this->assertEquals('rbaz', $this->file->readUntilEnd()); + $this->assertEquals(5, $this->file->getBytesRead(), 5); + $this->assertTrue($this->file->seek(2, SEEK_CUR)); + $this->assertEquals('az', $this->file->readUntilEnd()); + $this->assertEquals(7, $this->file->getBytesRead()); + $this->assertTrue($this->file->seek(0, SEEK_END)); + $this->assertEquals('', $this->file->readUntilEnd()); + $this->assertEquals(9, $this->file->getBytesRead()); + $this->assertTrue($this->file->seek(2, SEEK_END)); + $this->assertEquals('', $this->file->readUntilEnd()); + $this->assertEquals(11, $this->file->getBytesRead()); + } + + /** + * test writing data into the file + * + * @test + */ + public function writeEmptyFile() + { + $this->assertEquals(3, $this->file->write('foo')); + $this->assertEquals('foo', $this->file->getContent()); + $this->assertEquals(3, $this->file->size()); + $this->assertEquals(3, $this->file->write('bar')); + $this->assertEquals('foobar', $this->file->getContent()); + $this->assertEquals(6, $this->file->size()); + } + + /** + * test writing data into the file + * + * @test + */ + public function write() + { + $this->file->setContent('foobarbaz'); + $this->assertTrue($this->file->seek(3, SEEK_SET)); + $this->assertEquals(3, $this->file->write('foo')); + $this->assertEquals('foofoobaz', $this->file->getContent()); + $this->assertEquals(9, $this->file->size()); + $this->assertEquals(3, $this->file->write('bar')); + $this->assertEquals('foofoobar', $this->file->getContent()); + $this->assertEquals(9, $this->file->size()); + } + + /** + * setting and retrieving permissions for a file + * + * @test + * @group permissions + */ + public function permissions() + { + $this->assertEquals(0666, $this->file->getPermissions()); + $this->assertSame($this->file, $this->file->chmod(0644)); + $this->assertEquals(0644, $this->file->getPermissions()); + } + + /** + * setting and retrieving permissions for a file + * + * @test + * @group permissions + */ + public function permissionsSet() + { + $this->file = new vfsStreamFile('foo', 0644); + $this->assertEquals(0644, $this->file->getPermissions()); + $this->assertSame($this->file, $this->file->chmod(0600)); + $this->assertEquals(0600, $this->file->getPermissions()); + } + + /** + * setting and retrieving owner of a file + * + * @test + * @group permissions + */ + public function owner() + { + $this->assertEquals(vfsStream::getCurrentUser(), $this->file->getUser()); + $this->assertTrue($this->file->isOwnedByUser(vfsStream::getCurrentUser())); + $this->assertSame($this->file, $this->file->chown(vfsStream::OWNER_USER_1)); + $this->assertEquals(vfsStream::OWNER_USER_1, $this->file->getUser()); + $this->assertTrue($this->file->isOwnedByUser(vfsStream::OWNER_USER_1)); + } + + /** + * setting and retrieving owner group of a file + * + * @test + * @group permissions + */ + public function group() + { + $this->assertEquals(vfsStream::getCurrentGroup(), $this->file->getGroup()); + $this->assertTrue($this->file->isOwnedByGroup(vfsStream::getCurrentGroup())); + $this->assertSame($this->file, $this->file->chgrp(vfsStream::GROUP_USER_1)); + $this->assertEquals(vfsStream::GROUP_USER_1, $this->file->getGroup()); + $this->assertTrue($this->file->isOwnedByGroup(vfsStream::GROUP_USER_1)); + } + + /** + * @test + * @group issue_33 + * @since 1.1.0 + */ + public function truncateRemovesSuperflouosContent() + { + $this->assertEquals(11, $this->file->write("lorem ipsum")); + $this->assertTrue($this->file->truncate(5)); + $this->assertEquals(5, $this->file->size()); + $this->assertEquals('lorem', $this->file->getContent()); + } + + /** + * @test + * @group issue_33 + * @since 1.1.0 + */ + public function truncateToGreaterSizeAddsZeroBytes() + { + $this->assertEquals(11, $this->file->write("lorem ipsum")); + $this->assertTrue($this->file->truncate(25)); + $this->assertEquals(25, $this->file->size()); + $this->assertEquals("lorem ipsum\0\0\0\0\0\0\0\0\0\0\0\0\0\0", $this->file->getContent()); + } + + /** + * @test + * @group issue_79 + * @since 1.3.0 + */ + public function withContentAcceptsAnyFileContentInstance() + { + $mockFileContent = $this->getMock('org\bovigo\vfs\content\FileContent'); + $mockFileContent->expects($this->once()) + ->method('content') + ->will($this->returnValue('foobarbaz')); + $this->assertEquals( + 'foobarbaz', + $this->file->withContent($mockFileContent) + ->getContent() + ); + } + + /** + * @test + * @group issue_79 + * @expectedException \InvalidArgumentException + * @since 1.3.0 + */ + public function withContentThrowsInvalidArgumentExceptionWhenContentIsNoStringAndNoFileContent() + { + $this->file->withContent(313); + } +} diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamGlobTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamGlobTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..24884edf62eabe351d2af0f05d26480f42224b6a --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamGlobTestCase.php @@ -0,0 +1,29 @@ +assertEmpty(glob(vfsStream::url('example'), GLOB_MARK)); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamResolveIncludePathTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamResolveIncludePathTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..106dae64997d132709f711ecc93c0660445ebc12 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamResolveIncludePathTestCase.php @@ -0,0 +1,62 @@ +backupIncludePath = get_include_path(); + vfsStream::setup(); + mkdir('vfs://root/a/path', 0777, true); + set_include_path('vfs://root/a' . PATH_SEPARATOR . $this->backupIncludePath); + } + + /** + * clean up test environment + */ + public function tearDown() + { + set_include_path($this->backupIncludePath); + } + + /** + * @test + */ + public function knownFileCanBeResolved() + { + file_put_contents('vfs://root/a/path/knownFile.php', ''); + $this->assertEquals('vfs://root/a/path/knownFile.php', stream_resolve_include_path('path/knownFile.php')); + } + + /** + * @test + */ + public function unknownFileCanNotBeResolvedYieldsFalse() + { + $this->assertFalse(@stream_resolve_include_path('path/unknownFile.php')); + } +} +?> diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..530d664ca21bdcfe0ad47028236278218c09fa13 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamTestCase.php @@ -0,0 +1,728 @@ +assertEquals('vfs://foo', vfsStream::url('foo')); + $this->assertEquals('vfs://foo/bar.baz', vfsStream::url('foo/bar.baz')); + $this->assertEquals('vfs://foo/bar.baz', vfsStream::url('foo\bar.baz')); + } + + /** + * assure that url2path conversion works correct + * + * @test + */ + public function path() + { + $this->assertEquals('foo', vfsStream::path('vfs://foo')); + $this->assertEquals('foo/bar.baz', vfsStream::path('vfs://foo/bar.baz')); + $this->assertEquals('foo/bar.baz', vfsStream::path('vfs://foo\bar.baz')); + } + + /** + * windows directory separators are converted into default separator + * + * @author Gabriel Birke + * @test + */ + public function pathConvertsWindowsDirectorySeparators() + { + $this->assertEquals('foo/bar', vfsStream::path('vfs://foo\\bar')); + } + + /** + * trailing whitespace should be removed + * + * @author Gabriel Birke + * @test + */ + public function pathRemovesTrailingWhitespace() + { + $this->assertEquals('foo/bar', vfsStream::path('vfs://foo/bar ')); + } + + /** + * trailing slashes are removed + * + * @author Gabriel Birke + * @test + */ + public function pathRemovesTrailingSlash() + { + $this->assertEquals('foo/bar', vfsStream::path('vfs://foo/bar/')); + } + + /** + * trailing slash and whitespace should be removed + * + * @author Gabriel Birke + * @test + */ + public function pathRemovesTrailingSlashAndWhitespace() + { + $this->assertEquals('foo/bar', vfsStream::path('vfs://foo/bar/ ')); + } + + /** + * double slashes should be replaced by single slash + * + * @author Gabriel Birke + * @test + */ + public function pathRemovesDoubleSlashes() + { + // Regular path + $this->assertEquals('my/path', vfsStream::path('vfs://my/path')); + // Path with double slashes + $this->assertEquals('my/path', vfsStream::path('vfs://my//path')); + } + + /** + * test to create a new file + * + * @test + */ + public function newFile() + { + $file = vfsStream::newFile('filename.txt'); + $this->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamFile', $file); + $this->assertEquals('filename.txt', $file->getName()); + $this->assertEquals(0666, $file->getPermissions()); + } + + /** + * test to create a new file with non-default permissions + * + * @test + * @group permissions + */ + public function newFileWithDifferentPermissions() + { + $file = vfsStream::newFile('filename.txt', 0644); + $this->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamFile', $file); + $this->assertEquals('filename.txt', $file->getName()); + $this->assertEquals(0644, $file->getPermissions()); + } + + /** + * test to create a new directory structure + * + * @test + */ + public function newSingleDirectory() + { + $foo = vfsStream::newDirectory('foo'); + $this->assertEquals('foo', $foo->getName()); + $this->assertEquals(0, count($foo->getChildren())); + $this->assertEquals(0777, $foo->getPermissions()); + } + + /** + * test to create a new directory structure with non-default permissions + * + * @test + * @group permissions + */ + public function newSingleDirectoryWithDifferentPermissions() + { + $foo = vfsStream::newDirectory('foo', 0755); + $this->assertEquals('foo', $foo->getName()); + $this->assertEquals(0, count($foo->getChildren())); + $this->assertEquals(0755, $foo->getPermissions()); + } + + /** + * test to create a new directory structure + * + * @test + */ + public function newDirectoryStructure() + { + $foo = vfsStream::newDirectory('foo/bar/baz'); + $this->assertEquals('foo', $foo->getName()); + $this->assertEquals(0777, $foo->getPermissions()); + $this->assertTrue($foo->hasChild('bar')); + $this->assertTrue($foo->hasChild('bar/baz')); + $this->assertFalse($foo->hasChild('baz')); + $bar = $foo->getChild('bar'); + $this->assertEquals('bar', $bar->getName()); + $this->assertEquals(0777, $bar->getPermissions()); + $this->assertTrue($bar->hasChild('baz')); + $baz1 = $bar->getChild('baz'); + $this->assertEquals('baz', $baz1->getName()); + $this->assertEquals(0777, $baz1->getPermissions()); + $baz2 = $foo->getChild('bar/baz'); + $this->assertSame($baz1, $baz2); + } + + /** + * test that correct directory structure is created + * + * @test + */ + public function newDirectoryWithSlashAtStart() + { + $foo = vfsStream::newDirectory('/foo/bar/baz', 0755); + $this->assertEquals('foo', $foo->getName()); + $this->assertEquals(0755, $foo->getPermissions()); + $this->assertTrue($foo->hasChild('bar')); + $this->assertTrue($foo->hasChild('bar/baz')); + $this->assertFalse($foo->hasChild('baz')); + $bar = $foo->getChild('bar'); + $this->assertEquals('bar', $bar->getName()); + $this->assertEquals(0755, $bar->getPermissions()); + $this->assertTrue($bar->hasChild('baz')); + $baz1 = $bar->getChild('baz'); + $this->assertEquals('baz', $baz1->getName()); + $this->assertEquals(0755, $baz1->getPermissions()); + $baz2 = $foo->getChild('bar/baz'); + $this->assertSame($baz1, $baz2); + } + + /** + * @test + * @group setup + * @since 0.7.0 + */ + public function setupRegistersStreamWrapperAndCreatesRootDirectoryWithDefaultNameAndPermissions() + { + $root = vfsStream::setup(); + $this->assertSame($root, vfsStreamWrapper::getRoot()); + $this->assertEquals('root', $root->getName()); + $this->assertEquals(0777, $root->getPermissions()); + } + + /** + * @test + * @group setup + * @since 0.7.0 + */ + public function setupRegistersStreamWrapperAndCreatesRootDirectoryWithGivenNameAndDefaultPermissions() + { + $root = vfsStream::setup('foo'); + $this->assertSame($root, vfsStreamWrapper::getRoot()); + $this->assertEquals('foo', $root->getName()); + $this->assertEquals(0777, $root->getPermissions()); + } + + /** + * @test + * @group setup + * @since 0.7.0 + */ + public function setupRegistersStreamWrapperAndCreatesRootDirectoryWithGivenNameAndPermissions() + { + $root = vfsStream::setup('foo', 0444); + $this->assertSame($root, vfsStreamWrapper::getRoot()); + $this->assertEquals('foo', $root->getName()); + $this->assertEquals(0444, $root->getPermissions()); + } + + /** + * @test + * @group issue_14 + * @group issue_20 + * @since 0.10.0 + */ + public function setupWithEmptyArrayIsEqualToSetup() + { + $root = vfsStream::setup('example', + 0755, + array() + ); + $this->assertEquals('example', $root->getName()); + $this->assertEquals(0755, $root->getPermissions()); + $this->assertFalse($root->hasChildren()); + } + + /** + * @test + * @group issue_14 + * @group issue_20 + * @since 0.10.0 + */ + public function setupArraysAreTurnedIntoSubdirectories() + { + $root = vfsStream::setup('root', + null, + array('test' => array()) + ); + $this->assertTrue($root->hasChildren()); + $this->assertTrue($root->hasChild('test')); + $this->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamDirectory', + $root->getChild('test') + ); + $this->assertFalse($root->getChild('test')->hasChildren()); + } + + /** + * @test + * @group issue_14 + * @group issue_20 + * @since 0.10.0 + */ + public function setupStringsAreTurnedIntoFilesWithContent() + { + $root = vfsStream::setup('root', + null, + array('test.txt' => 'some content') + ); + $this->assertTrue($root->hasChildren()); + $this->assertTrue($root->hasChild('test.txt')); + $this->assertVfsFile($root->getChild('test.txt'), 'some content'); + } + + /** + * @test + * @group issue_14 + * @group issue_20 + * @since 0.10.0 + */ + public function setupWorksRecursively() + { + $root = vfsStream::setup('root', + null, + array('test' => array('foo' => array('test.txt' => 'hello'), + 'baz.txt' => 'world' + ) + ) + ); + $this->assertTrue($root->hasChildren()); + $this->assertTrue($root->hasChild('test')); + $test = $root->getChild('test'); + $this->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamDirectory', $test); + $this->assertTrue($test->hasChildren()); + $this->assertTrue($test->hasChild('baz.txt')); + $this->assertVfsFile($test->getChild('baz.txt'), 'world'); + + $this->assertTrue($test->hasChild('foo')); + $foo = $test->getChild('foo'); + $this->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamDirectory', $foo); + $this->assertTrue($foo->hasChildren()); + $this->assertTrue($foo->hasChild('test.txt')); + $this->assertVfsFile($foo->getChild('test.txt'), 'hello'); + } + + /** + * @test + * @group issue_17 + * @group issue_20 + */ + public function setupCastsNumericDirectoriesToStrings() + { + $root = vfsStream::setup('root', + null, + array(2011 => array ('test.txt' => 'some content')) + ); + $this->assertTrue($root->hasChild('2011')); + + $directory = $root->getChild('2011'); + $this->assertVfsFile($directory->getChild('test.txt'), 'some content'); + + $this->assertTrue(file_exists('vfs://root/2011/test.txt')); + } + + /** + * @test + * @group issue_20 + * @since 0.11.0 + */ + public function createArraysAreTurnedIntoSubdirectories() + { + $baseDir = vfsStream::create(array('test' => array()), new vfsStreamDirectory('baseDir')); + $this->assertTrue($baseDir->hasChildren()); + $this->assertTrue($baseDir->hasChild('test')); + $this->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamDirectory', + $baseDir->getChild('test') + ); + $this->assertFalse($baseDir->getChild('test')->hasChildren()); + } + + /** + * @test + * @group issue_20 + * @since 0.11.0 + */ + public function createArraysAreTurnedIntoSubdirectoriesOfRoot() + { + $root = vfsStream::setup(); + $this->assertSame($root, vfsStream::create(array('test' => array()))); + $this->assertTrue($root->hasChildren()); + $this->assertTrue($root->hasChild('test')); + $this->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamDirectory', + $root->getChild('test') + ); + $this->assertFalse($root->getChild('test')->hasChildren()); + } + + /** + * @test + * @group issue_20 + * @expectedException \InvalidArgumentException + * @since 0.11.0 + */ + public function createThrowsExceptionIfNoBaseDirGivenAndNoRootSet() + { + vfsStream::create(array('test' => array())); + } + + /** + * @test + * @group issue_20 + * @since 0.11.0 + */ + public function createWorksRecursively() + { + $baseDir = vfsStream::create(array('test' => array('foo' => array('test.txt' => 'hello'), + 'baz.txt' => 'world' + ) + ), + new vfsStreamDirectory('baseDir') + ); + $this->assertTrue($baseDir->hasChildren()); + $this->assertTrue($baseDir->hasChild('test')); + $test = $baseDir->getChild('test'); + $this->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamDirectory', $test); + $this->assertTrue($test->hasChildren()); + $this->assertTrue($test->hasChild('baz.txt')); + $this->assertVfsFile($test->getChild('baz.txt'), 'world'); + + $this->assertTrue($test->hasChild('foo')); + $foo = $test->getChild('foo'); + $this->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamDirectory', $foo); + $this->assertTrue($foo->hasChildren()); + $this->assertTrue($foo->hasChild('test.txt')); + $this->assertVfsFile($foo->getChild('test.txt'), 'hello'); + } + + /** + * @test + * @group issue_20 + * @since 0.11.0 + */ + public function createWorksRecursivelyWithRoot() + { + $root = vfsStream::setup(); + $this->assertSame($root, + vfsStream::create(array('test' => array('foo' => array('test.txt' => 'hello'), + 'baz.txt' => 'world' + ) + ) + ) + ); + $this->assertTrue($root->hasChildren()); + $this->assertTrue($root->hasChild('test')); + $test = $root->getChild('test'); + $this->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamDirectory', $test); + $this->assertTrue($test->hasChildren()); + $this->assertTrue($test->hasChild('baz.txt')); + $this->assertVfsFile($test->getChild('baz.txt'), 'world'); + + $this->assertTrue($test->hasChild('foo')); + $foo = $test->getChild('foo'); + $this->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamDirectory', $foo); + $this->assertTrue($foo->hasChildren()); + $this->assertTrue($foo->hasChild('test.txt')); + $this->assertVfsFile($foo->getChild('test.txt'), 'hello'); + } + + /** + * @test + * @group issue_20 + * @since 0.10.0 + */ + public function createStringsAreTurnedIntoFilesWithContent() + { + $baseDir = vfsStream::create(array('test.txt' => 'some content'), new vfsStreamDirectory('baseDir')); + $this->assertTrue($baseDir->hasChildren()); + $this->assertTrue($baseDir->hasChild('test.txt')); + $this->assertVfsFile($baseDir->getChild('test.txt'), 'some content'); + } + + /** + * @test + * @group issue_20 + * @since 0.11.0 + */ + public function createStringsAreTurnedIntoFilesWithContentWithRoot() + { + $root = vfsStream::setup(); + $this->assertSame($root, + vfsStream::create(array('test.txt' => 'some content')) + ); + $this->assertTrue($root->hasChildren()); + $this->assertTrue($root->hasChild('test.txt')); + $this->assertVfsFile($root->getChild('test.txt'), 'some content'); + } + + /** + * @test + * @group issue_20 + * @since 0.11.0 + */ + public function createCastsNumericDirectoriesToStrings() + { + $baseDir = vfsStream::create(array(2011 => array ('test.txt' => 'some content')), new vfsStreamDirectory('baseDir')); + $this->assertTrue($baseDir->hasChild('2011')); + + $directory = $baseDir->getChild('2011'); + $this->assertVfsFile($directory->getChild('test.txt'), 'some content'); + } + + /** + * @test + * @group issue_20 + * @since 0.11.0 + */ + public function createCastsNumericDirectoriesToStringsWithRoot() + { + $root = vfsStream::setup(); + $this->assertSame($root, + vfsStream::create(array(2011 => array ('test.txt' => 'some content'))) + ); + $this->assertTrue($root->hasChild('2011')); + + $directory = $root->getChild('2011'); + $this->assertVfsFile($directory->getChild('test.txt'), 'some content'); + } + + /** + * helper function for assertions on vfsStreamFile + * + * @param vfsStreamFile $file + * @param string $content + */ + protected function assertVfsFile(vfsStreamFile $file, $content) + { + $this->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamFile', + $file + ); + $this->assertEquals($content, + $file->getContent() + ); + } + + /** + * @test + * @group issue_10 + * @since 0.10.0 + */ + public function inspectWithContentGivesContentToVisitor() + { + $mockContent = $this->getMock('org\\bovigo\\vfs\\vfsStreamContent'); + $mockVisitor = $this->getMock('org\\bovigo\\vfs\\visitor\\vfsStreamVisitor'); + $mockVisitor->expects($this->once()) + ->method('visit') + ->with($this->equalTo($mockContent)) + ->will($this->returnValue($mockVisitor)); + $this->assertSame($mockVisitor, vfsStream::inspect($mockVisitor, $mockContent)); + } + + /** + * @test + * @group issue_10 + * @since 0.10.0 + */ + public function inspectWithoutContentGivesRootToVisitor() + { + $root = vfsStream::setup(); + $mockVisitor = $this->getMock('org\\bovigo\\vfs\\visitor\\vfsStreamVisitor'); + $mockVisitor->expects($this->once()) + ->method('visitDirectory') + ->with($this->equalTo($root)) + ->will($this->returnValue($mockVisitor)); + $this->assertSame($mockVisitor, vfsStream::inspect($mockVisitor)); + } + + /** + * @test + * @group issue_10 + * @expectedException \InvalidArgumentException + * @since 0.10.0 + */ + public function inspectWithoutContentAndWithoutRootThrowsInvalidArgumentException() + { + $mockVisitor = $this->getMock('org\\bovigo\\vfs\\visitor\\vfsStreamVisitor'); + $mockVisitor->expects($this->never()) + ->method('visit'); + $mockVisitor->expects($this->never()) + ->method('visitDirectory'); + vfsStream::inspect($mockVisitor); + } + + /** + * returns path to file system copy resource directory + * + * @return string + */ + protected function getFileSystemCopyDir() + { + return realpath(dirname(__FILE__) . '/../../../../resources/filesystemcopy'); + } + + /** + * @test + * @group issue_4 + * @expectedException \InvalidArgumentException + * @since 0.11.0 + */ + public function copyFromFileSystemThrowsExceptionIfNoBaseDirGivenAndNoRootSet() + { + vfsStream::copyFromFileSystem($this->getFileSystemCopyDir()); + } + + /** + * @test + * @group issue_4 + * @since 0.11.0 + */ + public function copyFromEmptyFolder() + { + $baseDir = vfsStream::copyFromFileSystem($this->getFileSystemCopyDir() . '/emptyFolder', + vfsStream::newDirectory('test') + ); + $baseDir->removeChild('.gitignore'); + $this->assertFalse($baseDir->hasChildren()); + } + + /** + * @test + * @group issue_4 + * @since 0.11.0 + */ + public function copyFromEmptyFolderWithRoot() + { + $root = vfsStream::setup(); + $this->assertEquals($root, + vfsStream::copyFromFileSystem($this->getFileSystemCopyDir() . '/emptyFolder') + ); + $root->removeChild('.gitignore'); + $this->assertFalse($root->hasChildren()); + } + + /** + * @test + * @group issue_4 + * @since 0.11.0 + */ + public function copyFromWithSubFolders() + { + $baseDir = vfsStream::copyFromFileSystem($this->getFileSystemCopyDir(), + vfsStream::newDirectory('test'), + 3 + ); + $this->assertTrue($baseDir->hasChildren()); + $this->assertTrue($baseDir->hasChild('emptyFolder')); + $this->assertTrue($baseDir->hasChild('withSubfolders')); + $subfolderDir = $baseDir->getChild('withSubfolders'); + $this->assertTrue($subfolderDir->hasChild('subfolder1')); + $this->assertTrue($subfolderDir->getChild('subfolder1')->hasChild('file1.txt')); + $this->assertVfsFile($subfolderDir->getChild('subfolder1/file1.txt'), ' '); + $this->assertTrue($subfolderDir->hasChild('subfolder2')); + $this->assertTrue($subfolderDir->hasChild('aFile.txt')); + $this->assertVfsFile($subfolderDir->getChild('aFile.txt'), 'foo'); + } + + /** + * @test + * @group issue_4 + * @since 0.11.0 + */ + public function copyFromWithSubFoldersWithRoot() + { + $root = vfsStream::setup(); + $this->assertEquals($root, + vfsStream::copyFromFileSystem($this->getFileSystemCopyDir(), + null, + 3 + ) + ); + $this->assertTrue($root->hasChildren()); + $this->assertTrue($root->hasChild('emptyFolder')); + $this->assertTrue($root->hasChild('withSubfolders')); + $subfolderDir = $root->getChild('withSubfolders'); + $this->assertTrue($subfolderDir->hasChild('subfolder1')); + $this->assertTrue($subfolderDir->getChild('subfolder1')->hasChild('file1.txt')); + $this->assertVfsFile($subfolderDir->getChild('subfolder1/file1.txt'), ' '); + $this->assertTrue($subfolderDir->hasChild('subfolder2')); + $this->assertTrue($subfolderDir->hasChild('aFile.txt')); + $this->assertVfsFile($subfolderDir->getChild('aFile.txt'), 'foo'); + } + + /** + * @test + * @group issue_4 + * @group issue_29 + * @since 0.11.2 + */ + public function copyFromPreservesFilePermissions() + { + if (DIRECTORY_SEPARATOR !== '/') { + $this->markTestSkipped('Only applicable on Linux style systems.'); + } + + $copyDir = $this->getFileSystemCopyDir(); + $root = vfsStream::setup(); + $this->assertEquals($root, + vfsStream::copyFromFileSystem($copyDir, + null + ) + ); + $this->assertEquals(fileperms($copyDir . '/withSubfolders') - vfsStreamContent::TYPE_DIR, + $root->getChild('withSubfolders') + ->getPermissions() + ); + $this->assertEquals(fileperms($copyDir . '/withSubfolders/aFile.txt') - vfsStreamContent::TYPE_FILE, + $root->getChild('withSubfolders/aFile.txt') + ->getPermissions() + ); + } + + /** + * To test this the max file size is reduced to something reproduceable. + * + * @test + * @group issue_91 + * @since 1.5.0 + */ + public function copyFromFileSystemMocksLargeFiles() + { + if (DIRECTORY_SEPARATOR !== '/') { + $this->markTestSkipped('Only applicable on Linux style systems.'); + } + + $copyDir = $this->getFileSystemCopyDir(); + $root = vfsStream::setup(); + vfsStream::copyFromFileSystem($copyDir, $root, 3); + $this->assertEquals( + ' ', + $root->getChild('withSubfolders/subfolder1/file1.txt')->getContent() + ); + } +} diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamUmaskTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamUmaskTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..342af310b84909f3263235cb5163e0d59f5c799a --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamUmaskTestCase.php @@ -0,0 +1,195 @@ +assertEquals(vfsStream::umask(), + vfsStream::umask() + ); + $this->assertEquals(0000, + vfsStream::umask() + ); + } + + /** + * @test + */ + public function changingUmaskSettingReturnsOldUmaskSetting() + { + $this->assertEquals(0000, + vfsStream::umask(0022) + ); + $this->assertEquals(0022, + vfsStream::umask() + ); + } + + /** + * @test + */ + public function createFileWithDefaultUmaskSetting() + { + $file = new vfsStreamFile('foo'); + $this->assertEquals(0666, $file->getPermissions()); + } + + /** + * @test + */ + public function createFileWithDifferentUmaskSetting() + { + vfsStream::umask(0022); + $file = new vfsStreamFile('foo'); + $this->assertEquals(0644, $file->getPermissions()); + } + + /** + * @test + */ + public function createDirectoryWithDefaultUmaskSetting() + { + $directory = new vfsStreamDirectory('foo'); + $this->assertEquals(0777, $directory->getPermissions()); + } + + /** + * @test + */ + public function createDirectoryWithDifferentUmaskSetting() + { + vfsStream::umask(0022); + $directory = new vfsStreamDirectory('foo'); + $this->assertEquals(0755, $directory->getPermissions()); + } + + /** + * @test + */ + public function createFileUsingStreamWithDefaultUmaskSetting() + { + $root = vfsStream::setup(); + file_put_contents(vfsStream::url('root/newfile.txt'), 'file content'); + $this->assertEquals(0666, $root->getChild('newfile.txt')->getPermissions()); + } + + /** + * @test + */ + public function createFileUsingStreamWithDifferentUmaskSetting() + { + $root = vfsStream::setup(); + vfsStream::umask(0022); + file_put_contents(vfsStream::url('root/newfile.txt'), 'file content'); + $this->assertEquals(0644, $root->getChild('newfile.txt')->getPermissions()); + } + + /** + * @test + */ + public function createDirectoryUsingStreamWithDefaultUmaskSetting() + { + $root = vfsStream::setup(); + mkdir(vfsStream::url('root/newdir')); + $this->assertEquals(0777, $root->getChild('newdir')->getPermissions()); + } + + /** + * @test + */ + public function createDirectoryUsingStreamWithDifferentUmaskSetting() + { + $root = vfsStream::setup(); + vfsStream::umask(0022); + mkdir(vfsStream::url('root/newdir')); + $this->assertEquals(0755, $root->getChild('newdir')->getPermissions()); + } + + /** + * @test + */ + public function createDirectoryUsingStreamWithExplicit0() + { + $root = vfsStream::setup(); + vfsStream::umask(0022); + mkdir(vfsStream::url('root/newdir'), null); + $this->assertEquals(0000, $root->getChild('newdir')->getPermissions()); + } + + /** + * @test + * + */ + public function createDirectoryUsingStreamWithDifferentUmaskSettingButExplicit0777() + { + $root = vfsStream::setup(); + vfsStream::umask(0022); + mkdir(vfsStream::url('root/newdir'), 0777); + $this->assertEquals(0755, $root->getChild('newdir')->getPermissions()); + } + + /** + * @test + */ + public function createDirectoryUsingStreamWithDifferentUmaskSettingButExplicitModeRequestedByCall() + { + $root = vfsStream::setup(); + vfsStream::umask(0022); + mkdir(vfsStream::url('root/newdir'), 0700); + $this->assertEquals(0700, $root->getChild('newdir')->getPermissions()); + } + + /** + * @test + */ + public function defaultUmaskSettingDoesNotInfluenceSetup() + { + $root = vfsStream::setup(); + $this->assertEquals(0777, $root->getPermissions()); + } + + /** + * @test + */ + public function umaskSettingShouldBeRespectedBySetup() + { + vfsStream::umask(0022); + $root = vfsStream::setup(); + $this->assertEquals(0755, $root->getPermissions()); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperAlreadyRegisteredTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperAlreadyRegisteredTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..c7f78dcc800aa191af51d264649127b78a072672 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperAlreadyRegisteredTestCase.php @@ -0,0 +1,63 @@ +getMock('org\\bovigo\\vfs\\vfsStreamWrapper'); + stream_wrapper_register(vfsStream::SCHEME, get_class($mock)); + } + + /** + * clean up test environment + */ + public function tearDown() + { + TestvfsStreamWrapper::unregister(); + } + + /** + * registering the stream wrapper when another stream wrapper is already + * registered for the vfs scheme should throw an exception + * + * @test + * @expectedException org\bovigo\vfs\vfsStreamException + */ + public function registerOverAnotherStreamWrapper() + { + vfsStreamWrapper::register(); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperBaseTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperBaseTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..52ec40cf7eac43623c07c909b639e559cb64015d --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperBaseTestCase.php @@ -0,0 +1,99 @@ +fooURL = vfsStream::url('foo'); + $this->barURL = vfsStream::url('foo/bar'); + $this->baz1URL = vfsStream::url('foo/bar/baz1'); + $this->baz2URL = vfsStream::url('foo/baz2'); + $this->foo = new vfsStreamDirectory('foo'); + $this->bar = new vfsStreamDirectory('bar'); + $this->baz1 = vfsStream::newFile('baz1') + ->lastModified(300) + ->lastAccessed(300) + ->lastAttributeModified(300) + ->withContent('baz 1'); + $this->baz2 = vfsStream::newFile('baz2') + ->withContent('baz2') + ->lastModified(400) + ->lastAccessed(400) + ->lastAttributeModified(400); + $this->bar->addChild($this->baz1); + $this->foo->addChild($this->bar); + $this->foo->addChild($this->baz2); + $this->foo->lastModified(100) + ->lastAccessed(100) + ->lastAttributeModified(100); + $this->bar->lastModified(200) + ->lastAccessed(100) + ->lastAttributeModified(100); + vfsStreamWrapper::register(); + vfsStreamWrapper::setRoot($this->foo); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperDirSeparatorTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperDirSeparatorTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..1fd2a2d9c70cbd205560ab6ecb0a586d91889457 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperDirSeparatorTestCase.php @@ -0,0 +1,73 @@ +root = vfsStream::setup(); + } + + /** + * @test + */ + public function fileCanBeAccessedUsingWinDirSeparator() + { + vfsStream::newFile('foo/bar/baz.txt') + ->at($this->root) + ->withContent('test'); + $this->assertEquals('test', file_get_contents('vfs://root/foo\bar\baz.txt')); + } + + + /** + * @test + */ + public function directoryCanBeCreatedUsingWinDirSeparator() + { + mkdir('vfs://root/dir\bar\foo', true, 0777); + $this->assertTrue($this->root->hasChild('dir')); + $this->assertTrue($this->root->getChild('dir')->hasChild('bar')); + $this->assertTrue($this->root->getChild('dir/bar')->hasChild('foo')); + } + + /** + * @test + */ + public function directoryExitsTestUsingTrailingWinDirSeparator() + { + $structure = array( + 'dir' => array( + 'bar' => array( + ) + ) + ); + vfsStream::create($structure, $this->root); + + $this->assertTrue(file_exists(vfsStream::url('root/').'dir\\')); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperDirTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperDirTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..6e2f44ba38da87fff405bf93e34b95d8a615a9de --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperDirTestCase.php @@ -0,0 +1,488 @@ +assertFalse(mkdir(vfsStream::url('another'))); + $this->assertEquals(2, count($this->foo->getChildren())); + $this->assertSame($this->foo, vfsStreamWrapper::getRoot()); + } + + /** + * mkdir() should not overwrite existing root + * + * @test + */ + public function mkdirNoNewRootRecursively() + { + $this->assertFalse(mkdir(vfsStream::url('another/more'), 0777, true)); + $this->assertEquals(2, count($this->foo->getChildren())); + $this->assertSame($this->foo, vfsStreamWrapper::getRoot()); + } + + /** + * assert that mkdir() creates the correct directory structure + * + * @test + * @group permissions + */ + public function mkdirNonRecursively() + { + $this->assertFalse(mkdir($this->barURL . '/another/more')); + $this->assertEquals(2, count($this->foo->getChildren())); + $this->assertTrue(mkdir($this->fooURL . '/another')); + $this->assertEquals(3, count($this->foo->getChildren())); + $this->assertEquals(0777, $this->foo->getChild('another')->getPermissions()); + } + + /** + * assert that mkdir() creates the correct directory structure + * + * @test + * @group permissions + */ + public function mkdirRecursively() + { + $this->assertTrue(mkdir($this->fooURL . '/another/more', 0777, true)); + $this->assertEquals(3, count($this->foo->getChildren())); + $another = $this->foo->getChild('another'); + $this->assertTrue($another->hasChild('more')); + $this->assertEquals(0777, $this->foo->getChild('another')->getPermissions()); + $this->assertEquals(0777, $this->foo->getChild('another')->getChild('more')->getPermissions()); + } + + /** + * @test + * @group issue_9 + * @since 0.9.0 + */ + public function mkdirWithDots() + { + $this->assertTrue(mkdir($this->fooURL . '/another/../more/.', 0777, true)); + $this->assertEquals(3, count($this->foo->getChildren())); + $this->assertTrue($this->foo->hasChild('more')); + } + + /** + * no root > new directory becomes root + * + * @test + * @group permissions + */ + public function mkdirWithoutRootCreatesNewRoot() + { + vfsStreamWrapper::register(); + $this->assertTrue(@mkdir(vfsStream::url('foo'))); + $this->assertEquals(vfsStreamContent::TYPE_DIR, vfsStreamWrapper::getRoot()->getType()); + $this->assertEquals('foo', vfsStreamWrapper::getRoot()->getName()); + $this->assertEquals(0777, vfsStreamWrapper::getRoot()->getPermissions()); + } + + /** + * trying to create a subdirectory of a file should not work + * + * @test + */ + public function mkdirOnFileReturnsFalse() + { + $this->assertFalse(mkdir($this->baz1URL . '/another/more', 0777, true)); + } + + /** + * assert that mkdir() creates the correct directory structure + * + * @test + * @group permissions + */ + public function mkdirNonRecursivelyDifferentPermissions() + { + $this->assertTrue(mkdir($this->fooURL . '/another', 0755)); + $this->assertEquals(0755, $this->foo->getChild('another')->getPermissions()); + } + + /** + * assert that mkdir() creates the correct directory structure + * + * @test + * @group permissions + */ + public function mkdirRecursivelyDifferentPermissions() + { + $this->assertTrue(mkdir($this->fooURL . '/another/more', 0755, true)); + $this->assertEquals(3, count($this->foo->getChildren())); + $another = $this->foo->getChild('another'); + $this->assertTrue($another->hasChild('more')); + $this->assertEquals(0755, $this->foo->getChild('another')->getPermissions()); + $this->assertEquals(0755, $this->foo->getChild('another')->getChild('more')->getPermissions()); + } + + /** + * assert that mkdir() creates the correct directory structure + * + * @test + * @group permissions + */ + public function mkdirRecursivelyUsesDefaultPermissions() + { + $this->foo->chmod(0700); + $this->assertTrue(mkdir($this->fooURL . '/another/more', 0777, true)); + $this->assertEquals(3, count($this->foo->getChildren())); + $another = $this->foo->getChild('another'); + $this->assertTrue($another->hasChild('more')); + $this->assertEquals(0777, $this->foo->getChild('another')->getPermissions()); + $this->assertEquals(0777, $this->foo->getChild('another')->getChild('more')->getPermissions()); + } + + /** + * no root > new directory becomes root + * + * @test + * @group permissions + */ + public function mkdirWithoutRootCreatesNewRootDifferentPermissions() + { + vfsStreamWrapper::register(); + $this->assertTrue(@mkdir(vfsStream::url('foo'), 0755)); + $this->assertEquals(vfsStreamContent::TYPE_DIR, vfsStreamWrapper::getRoot()->getType()); + $this->assertEquals('foo', vfsStreamWrapper::getRoot()->getName()); + $this->assertEquals(0755, vfsStreamWrapper::getRoot()->getPermissions()); + } + + /** + * no root > new directory becomes root + * + * @test + * @group permissions + */ + public function mkdirWithoutRootCreatesNewRootWithDefaultPermissions() + { + vfsStreamWrapper::register(); + $this->assertTrue(@mkdir(vfsStream::url('foo'))); + $this->assertEquals(vfsStreamContent::TYPE_DIR, vfsStreamWrapper::getRoot()->getType()); + $this->assertEquals('foo', vfsStreamWrapper::getRoot()->getName()); + $this->assertEquals(0777, vfsStreamWrapper::getRoot()->getPermissions()); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function mkdirDirCanNotCreateNewDirInNonWritingDirectory() + { + vfsStreamWrapper::register(); + vfsStreamWrapper::setRoot(new vfsStreamDirectory('root')); + vfsStreamWrapper::getRoot()->addChild(new vfsStreamDirectory('restrictedFolder', 0000)); + $this->assertFalse(is_writable(vfsStream::url('root/restrictedFolder/'))); + $this->assertFalse(mkdir(vfsStream::url('root/restrictedFolder/newFolder'))); + $this->assertFalse(vfsStreamWrapper::getRoot()->hasChild('restrictedFolder/newFolder')); + } + + /** + * @test + * @group issue_28 + */ + public function mkDirShouldNotOverwriteExistingDirectories() + { + vfsStream::setup('root'); + $dir = vfsStream::url('root/dir'); + $this->assertTrue(mkdir($dir)); + $this->assertFalse(@mkdir($dir)); + } + + /** + * @test + * @group issue_28 + * @expectedException PHPUnit_Framework_Error + * @expectedExceptionMessage mkdir(): Path vfs://root/dir exists + */ + public function mkDirShouldNotOverwriteExistingDirectoriesAndTriggerE_USER_WARNING() + { + vfsStream::setup('root'); + $dir = vfsStream::url('root/dir'); + $this->assertTrue(mkdir($dir)); + $this->assertFalse(mkdir($dir)); + } + + /** + * @test + * @group issue_28 + */ + public function mkDirShouldNotOverwriteExistingFiles() + { + $root = vfsStream::setup('root'); + vfsStream::newFile('test.txt')->at($root); + $this->assertFalse(@mkdir(vfsStream::url('root/test.txt'))); + } + + /** + * @test + * @group issue_28 + * @expectedException PHPUnit_Framework_Error + * @expectedExceptionMessage mkdir(): Path vfs://root/test.txt exists + */ + public function mkDirShouldNotOverwriteExistingFilesAndTriggerE_USER_WARNING() + { + $root = vfsStream::setup('root'); + vfsStream::newFile('test.txt')->at($root); + $this->assertFalse(mkdir(vfsStream::url('root/test.txt'))); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function canNotIterateOverNonReadableDirectory() + { + vfsStreamWrapper::register(); + vfsStreamWrapper::setRoot(new vfsStreamDirectory('root', 0000)); + $this->assertFalse(@opendir(vfsStream::url('root'))); + $this->assertFalse(@dir(vfsStream::url('root'))); + } + + /** + * assert is_dir() returns correct result + * + * @test + */ + public function is_dir() + { + $this->assertTrue(is_dir($this->fooURL)); + $this->assertTrue(is_dir($this->fooURL . '/.')); + $this->assertTrue(is_dir($this->barURL)); + $this->assertTrue(is_dir($this->barURL . '/.')); + $this->assertFalse(is_dir($this->baz1URL)); + $this->assertFalse(is_dir($this->baz2URL)); + $this->assertFalse(is_dir($this->fooURL . '/another')); + $this->assertFalse(is_dir(vfsStream::url('another'))); + } + + /** + * can not unlink without root + * + * @test + */ + public function canNotUnlinkDirectoryWithoutRoot() + { + vfsStreamWrapper::register(); + $this->assertFalse(@rmdir(vfsStream::url('foo'))); + } + + /** + * rmdir() can not remove files + * + * @test + */ + public function rmdirCanNotRemoveFiles() + { + $this->assertFalse(rmdir($this->baz1URL)); + $this->assertFalse(rmdir($this->baz2URL)); + } + + /** + * rmdir() can not remove a non-existing directory + * + * @test + */ + public function rmdirCanNotRemoveNonExistingDirectory() + { + $this->assertFalse(rmdir($this->fooURL . '/another')); + } + + /** + * rmdir() can not remove non-empty directories + * + * @test + */ + public function rmdirCanNotRemoveNonEmptyDirectory() + { + $this->assertFalse(rmdir($this->fooURL)); + $this->assertFalse(rmdir($this->barURL)); + } + + /** + * @test + */ + public function rmdirCanRemoveEmptyDirectory() + { + vfsStream::newDirectory('empty')->at($this->foo); + $this->assertTrue($this->foo->hasChild('empty')); + $this->assertTrue(rmdir($this->fooURL . '/empty')); + $this->assertFalse($this->foo->hasChild('empty')); + } + + /** + * @test + */ + public function rmdirCanRemoveEmptyDirectoryWithDot() + { + vfsStream::newDirectory('empty')->at($this->foo); + $this->assertTrue($this->foo->hasChild('empty')); + $this->assertTrue(rmdir($this->fooURL . '/empty/.')); + $this->assertFalse($this->foo->hasChild('empty')); + } + + /** + * rmdir() can remove empty directories + * + * @test + */ + public function rmdirCanRemoveEmptyRoot() + { + $this->foo->removeChild('bar'); + $this->foo->removeChild('baz2'); + $this->assertTrue(rmdir($this->fooURL)); + $this->assertFalse(file_exists($this->fooURL)); // make sure statcache was cleared + $this->assertNull(vfsStreamWrapper::getRoot()); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function rmdirDirCanNotRemoveDirFromNonWritingDirectory() + { + vfsStreamWrapper::register(); + vfsStreamWrapper::setRoot(new vfsStreamDirectory('root', 0000)); + vfsStreamWrapper::getRoot()->addChild(new vfsStreamDirectory('nonRemovableFolder')); + $this->assertFalse(is_writable(vfsStream::url('root'))); + $this->assertFalse(rmdir(vfsStream::url('root/nonRemovableFolder'))); + $this->assertTrue(vfsStreamWrapper::getRoot()->hasChild('nonRemovableFolder')); + } + + /** + * @test + * @group permissions + * @group bug_17 + */ + public function issue17() + { + vfsStreamWrapper::register(); + vfsStreamWrapper::setRoot(new vfsStreamDirectory('root', 0770)); + vfsStreamWrapper::getRoot()->chgrp(vfsStream::GROUP_USER_1) + ->chown(vfsStream::OWNER_USER_1); + $this->assertFalse(mkdir(vfsStream::url('root/doesNotWork'))); + $this->assertFalse(vfsStreamWrapper::getRoot()->hasChild('doesNotWork')); + } + + /** + * @test + * @group bug_19 + */ + public function accessWithDoubleDotReturnsCorrectContent() + { + $this->assertEquals('baz2', + file_get_contents(vfsStream::url('foo/bar/../baz2')) + ); + } + + /** + * @test + * @group bug_115 + */ + public function accessWithExcessDoubleDotsReturnsCorrectContent() + { + $this->assertEquals('baz2', + file_get_contents(vfsStream::url('foo/../../../../bar/../baz2')) + ); + } + + /** + * @test + * @group bug_115 + */ + public function alwaysResolvesRootDirectoryAsOwnParentWithDoubleDot() + { + vfsStreamWrapper::getRoot()->chown(vfsStream::OWNER_USER_1); + + $this->assertTrue(is_dir(vfsStream::url('foo/..'))); + $stat = stat(vfsStream::url('foo/..')); + $this->assertEquals( + vfsStream::OWNER_USER_1, + $stat['uid'] + ); + } + + + /** + * @test + * @since 0.11.0 + * @group issue_23 + */ + public function unlinkCanNotRemoveNonEmptyDirectory() + { + try { + $this->assertFalse(unlink($this->barURL)); + } catch (\PHPUnit_Framework_Error $fe) { + $this->assertEquals('unlink(vfs://foo/bar): Operation not permitted', $fe->getMessage()); + } + + $this->assertTrue($this->foo->hasChild('bar')); + $this->assertFileExists($this->barURL); + } + + /** + * @test + * @since 0.11.0 + * @group issue_23 + */ + public function unlinkCanNotRemoveEmptyDirectory() + { + vfsStream::newDirectory('empty')->at($this->foo); + try { + $this->assertTrue(unlink($this->fooURL . '/empty')); + } catch (\PHPUnit_Framework_Error $fe) { + $this->assertEquals('unlink(vfs://foo/empty): Operation not permitted', $fe->getMessage()); + } + + $this->assertTrue($this->foo->hasChild('empty')); + $this->assertFileExists($this->fooURL . '/empty'); + } + + /** + * @test + * @group issue_32 + */ + public function canCreateFolderOfSameNameAsParentFolder() + { + $root = vfsStream::setup('testFolder'); + mkdir(vfsStream::url('testFolder') . '/testFolder/subTestFolder', 0777, true); + $this->assertTrue(file_exists(vfsStream::url('testFolder/testFolder/subTestFolder/.'))); + } + + /** + * @test + * @group issue_32 + */ + public function canRetrieveFolderOfSameNameAsParentFolder() + { + $root = vfsStream::setup('testFolder'); + mkdir(vfsStream::url('testFolder') . '/testFolder/subTestFolder', 0777, true); + $this->assertTrue($root->hasChild('testFolder')); + $this->assertNotNull($root->getChild('testFolder')); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperFileTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperFileTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..5bcb37adc750df63abcca2e2f262c8763c096fa9 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperFileTestCase.php @@ -0,0 +1,458 @@ +assertEquals('baz2', file_get_contents($this->baz2URL)); + $this->assertEquals('baz 1', file_get_contents($this->baz1URL)); + $this->assertFalse(@file_get_contents($this->barURL)); + $this->assertFalse(@file_get_contents($this->fooURL)); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function file_get_contentsNonReadableFile() + { + vfsStreamWrapper::register(); + vfsStreamWrapper::setRoot(new vfsStreamDirectory('root')); + vfsStream::newFile('new.txt', 0000)->at(vfsStreamWrapper::getRoot())->withContent('content'); + $this->assertEquals('', @file_get_contents(vfsStream::url('root/new.txt'))); + } + + /** + * assert that file_put_contents() delivers correct file contents + * + * @test + */ + public function file_put_contentsExistingFile() + { + $this->assertEquals(14, file_put_contents($this->baz2URL, 'baz is not bar')); + $this->assertEquals('baz is not bar', $this->baz2->getContent()); + $this->assertEquals(6, file_put_contents($this->baz1URL, 'foobar')); + $this->assertEquals('foobar', $this->baz1->getContent()); + $this->assertFalse(@file_put_contents($this->barURL, 'This does not work.')); + $this->assertFalse(@file_put_contents($this->fooURL, 'This does not work, too.')); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function file_put_contentsExistingFileNonWritableDirectory() + { + vfsStreamWrapper::register(); + vfsStreamWrapper::setRoot(new vfsStreamDirectory('root', 0000)); + vfsStream::newFile('new.txt')->at(vfsStreamWrapper::getRoot())->withContent('content'); + $this->assertEquals(15, @file_put_contents(vfsStream::url('root/new.txt'), 'This does work.')); + $this->assertEquals('This does work.', file_get_contents(vfsStream::url('root/new.txt'))); + + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function file_put_contentsExistingNonWritableFile() + { + vfsStreamWrapper::register(); + vfsStreamWrapper::setRoot(new vfsStreamDirectory('root')); + vfsStream::newFile('new.txt', 0400)->at(vfsStreamWrapper::getRoot())->withContent('content'); + $this->assertFalse(@file_put_contents(vfsStream::url('root/new.txt'), 'This does not work.')); + $this->assertEquals('content', file_get_contents(vfsStream::url('root/new.txt'))); + } + + /** + * assert that file_put_contents() delivers correct file contents + * + * @test + */ + public function file_put_contentsNonExistingFile() + { + $this->assertEquals(14, file_put_contents($this->fooURL . '/baznot.bar', 'baz is not bar')); + $this->assertEquals(3, count($this->foo->getChildren())); + $this->assertEquals(14, file_put_contents($this->barURL . '/baznot.bar', 'baz is not bar')); + $this->assertEquals(2, count($this->bar->getChildren())); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function file_put_contentsNonExistingFileNonWritableDirectory() + { + vfsStreamWrapper::register(); + vfsStreamWrapper::setRoot(new vfsStreamDirectory('root', 0000)); + $this->assertFalse(@file_put_contents(vfsStream::url('root/new.txt'), 'This does not work.')); + $this->assertFalse(file_exists(vfsStream::url('root/new.txt'))); + + } + + /** + * using a file pointer should work without any problems + * + * @test + */ + public function usingFilePointer() + { + $fp = fopen($this->baz1URL, 'r'); + $this->assertEquals(0, ftell($fp)); + $this->assertFalse(feof($fp)); + $this->assertEquals(0, fseek($fp, 2)); + $this->assertEquals(2, ftell($fp)); + $this->assertEquals(0, fseek($fp, 1, SEEK_CUR)); + $this->assertEquals(3, ftell($fp)); + $this->assertEquals(0, fseek($fp, 1, SEEK_END)); + $this->assertEquals(6, ftell($fp)); + $this->assertTrue(feof($fp)); + $this->assertEquals(0, fseek($fp, 2)); + $this->assertFalse(feof($fp)); + $this->assertEquals(2, ftell($fp)); + $this->assertEquals('z', fread($fp, 1)); + $this->assertEquals(3, ftell($fp)); + $this->assertEquals(' 1', fread($fp, 8092)); + $this->assertEquals(5, ftell($fp)); + $this->assertTrue(fclose($fp)); + } + + /** + * assert is_file() returns correct result + * + * @test + */ + public function is_file() + { + $this->assertFalse(is_file($this->fooURL)); + $this->assertFalse(is_file($this->barURL)); + $this->assertTrue(is_file($this->baz1URL)); + $this->assertTrue(is_file($this->baz2URL)); + $this->assertFalse(is_file($this->fooURL . '/another')); + $this->assertFalse(is_file(vfsStream::url('another'))); + } + + /** + * @test + * @group issue7 + * @group issue13 + */ + public function issue13CanNotOverwriteFiles() + { + $vfsFile = vfsStream::url('foo/overwrite.txt'); + file_put_contents($vfsFile, 'test'); + file_put_contents($vfsFile, 'd'); + $this->assertEquals('d', file_get_contents($vfsFile)); + } + + /** + * @test + * @group issue7 + * @group issue13 + */ + public function appendContentIfOpenedWithModeA() + { + $vfsFile = vfsStream::url('foo/overwrite.txt'); + file_put_contents($vfsFile, 'test'); + $fp = fopen($vfsFile, 'ab'); + fwrite($fp, 'd'); + fclose($fp); + $this->assertEquals('testd', file_get_contents($vfsFile)); + } + + /** + * @test + * @group issue7 + * @group issue13 + */ + public function canOverwriteNonExistingFileWithModeX() + { + $vfsFile = vfsStream::url('foo/overwrite.txt'); + $fp = fopen($vfsFile, 'xb'); + fwrite($fp, 'test'); + fclose($fp); + $this->assertEquals('test', file_get_contents($vfsFile)); + } + + /** + * @test + * @group issue7 + * @group issue13 + */ + public function canNotOverwriteExistingFileWithModeX() + { + $vfsFile = vfsStream::url('foo/overwrite.txt'); + file_put_contents($vfsFile, 'test'); + $this->assertFalse(@fopen($vfsFile, 'xb')); + $this->assertEquals('test', file_get_contents($vfsFile)); + } + + /** + * @test + * @group issue7 + * @group issue13 + */ + public function canNotOpenNonExistingFileReadonly() + { + $this->assertFalse(@fopen(vfsStream::url('foo/doesNotExist.txt'), 'rb')); + } + + /** + * @test + * @group issue7 + * @group issue13 + */ + public function canNotOpenNonExistingFileReadAndWrite() + { + $this->assertFalse(@fopen(vfsStream::url('foo/doesNotExist.txt'), 'rb+')); + } + + /** + * @test + * @group issue7 + * @group issue13 + */ + public function canNotOpenWithIllegalMode() + { + $this->assertFalse(@fopen($this->baz2URL, 'invalid')); + } + + /** + * @test + * @group issue7 + * @group issue13 + */ + public function canNotWriteToReadOnlyFile() + { + $fp = fopen($this->baz2URL, 'rb'); + $this->assertEquals('baz2', fread($fp, 4096)); + $this->assertEquals(0, fwrite($fp, 'foo')); + fclose($fp); + $this->assertEquals('baz2', file_get_contents($this->baz2URL)); + } + + /** + * @test + * @group issue7 + * @group issue13 + */ + public function canNotReadFromWriteOnlyFileWithModeW() + { + $fp = fopen($this->baz2URL, 'wb'); + $this->assertEquals('', fread($fp, 4096)); + $this->assertEquals(3, fwrite($fp, 'foo')); + fseek($fp, 0); + $this->assertEquals('', fread($fp, 4096)); + fclose($fp); + $this->assertEquals('foo', file_get_contents($this->baz2URL)); + } + + /** + * @test + * @group issue7 + * @group issue13 + */ + public function canNotReadFromWriteOnlyFileWithModeA() + { + $fp = fopen($this->baz2URL, 'ab'); + $this->assertEquals('', fread($fp, 4096)); + $this->assertEquals(3, fwrite($fp, 'foo')); + fseek($fp, 0); + $this->assertEquals('', fread($fp, 4096)); + fclose($fp); + $this->assertEquals('baz2foo', file_get_contents($this->baz2URL)); + } + + /** + * @test + * @group issue7 + * @group issue13 + */ + public function canNotReadFromWriteOnlyFileWithModeX() + { + $vfsFile = vfsStream::url('foo/modeXtest.txt'); + $fp = fopen($vfsFile, 'xb'); + $this->assertEquals('', fread($fp, 4096)); + $this->assertEquals(3, fwrite($fp, 'foo')); + fseek($fp, 0); + $this->assertEquals('', fread($fp, 4096)); + fclose($fp); + $this->assertEquals('foo', file_get_contents($vfsFile)); + } + + /** + * @test + * @group permissions + * @group bug_15 + */ + public function canNotRemoveFileFromDirectoryWithoutWritePermissions() + { + vfsStreamWrapper::register(); + vfsStreamWrapper::setRoot(new vfsStreamDirectory('root', 0000)); + vfsStream::newFile('new.txt')->at(vfsStreamWrapper::getRoot()); + $this->assertFalse(unlink(vfsStream::url('root/new.txt'))); + $this->assertTrue(file_exists(vfsStream::url('root/new.txt'))); + } + + /** + * @test + * @group issue_30 + */ + public function truncatesFileWhenOpenedWithModeW() + { + $vfsFile = vfsStream::url('foo/overwrite.txt'); + file_put_contents($vfsFile, 'test'); + $fp = fopen($vfsFile, 'wb'); + $this->assertEquals('', file_get_contents($vfsFile)); + fclose($fp); + } + + /** + * @test + * @group issue_30 + */ + public function createsNonExistingFileWhenOpenedWithModeC() + { + $vfsFile = vfsStream::url('foo/tobecreated.txt'); + $fp = fopen($vfsFile, 'cb'); + fwrite($fp, 'some content'); + $this->assertTrue($this->foo->hasChild('tobecreated.txt')); + fclose($fp); + $this->assertEquals('some content', file_get_contents($vfsFile)); + } + + /** + * @test + * @group issue_30 + */ + public function createsNonExistingFileWhenOpenedWithModeCplus() + { + $vfsFile = vfsStream::url('foo/tobecreated.txt'); + $fp = fopen($vfsFile, 'cb+'); + fwrite($fp, 'some content'); + $this->assertTrue($this->foo->hasChild('tobecreated.txt')); + fclose($fp); + $this->assertEquals('some content', file_get_contents($vfsFile)); + } + + /** + * @test + * @group issue_30 + */ + public function doesNotTruncateFileWhenOpenedWithModeC() + { + $vfsFile = vfsStream::url('foo/overwrite.txt'); + file_put_contents($vfsFile, 'test'); + $fp = fopen($vfsFile, 'cb'); + $this->assertEquals('test', file_get_contents($vfsFile)); + fclose($fp); + } + + /** + * @test + * @group issue_30 + */ + public function setsPointerToStartWhenOpenedWithModeC() + { + $vfsFile = vfsStream::url('foo/overwrite.txt'); + file_put_contents($vfsFile, 'test'); + $fp = fopen($vfsFile, 'cb'); + $this->assertEquals(0, ftell($fp)); + fclose($fp); + } + + /** + * @test + * @group issue_30 + */ + public function doesNotTruncateFileWhenOpenedWithModeCplus() + { + $vfsFile = vfsStream::url('foo/overwrite.txt'); + file_put_contents($vfsFile, 'test'); + $fp = fopen($vfsFile, 'cb+'); + $this->assertEquals('test', file_get_contents($vfsFile)); + fclose($fp); + } + + /** + * @test + * @group issue_30 + */ + public function setsPointerToStartWhenOpenedWithModeCplus() + { + $vfsFile = vfsStream::url('foo/overwrite.txt'); + file_put_contents($vfsFile, 'test'); + $fp = fopen($vfsFile, 'cb+'); + $this->assertEquals(0, ftell($fp)); + fclose($fp); + } + + /** + * @test + */ + public function cannotOpenExistingNonwritableFileWithModeA() + { + $this->baz1->chmod(0400); + $this->assertFalse(@fopen($this->baz1URL, 'a')); + } + + /** + * @test + */ + public function cannotOpenExistingNonwritableFileWithModeW() + { + $this->baz1->chmod(0400); + $this->assertFalse(@fopen($this->baz1URL, 'w')); + } + + /** + * @test + */ + public function cannotOpenNonReadableFileWithModeR() + { + $this->baz1->chmod(0); + $this->assertFalse(@fopen($this->baz1URL, 'r')); + } + + /** + * @test + */ + public function cannotRenameToNonWritableDir() + { + $this->bar->chmod(0); + $this->assertFalse(@rename($this->baz2URL, vfsStream::url('foo/bar/baz3'))); + } + + /** + * @test + * @group issue_38 + */ + public function cannotReadFileFromNonReadableDir() + { + $this->markTestSkipped("Issue #38."); + $this->bar->chmod(0); + $this->assertFalse(@file_get_contents($this->baz1URL)); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperFileTimesTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperFileTimesTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..ebe0a52cf1fa9b7c69062217321d4fb564f05ed0 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperFileTimesTestCase.php @@ -0,0 +1,315 @@ +lastModified(50) + ->lastAccessed(50) + ->lastAttributeModified(50); + $this->fooUrl = vfsStream::url('root/foo.txt'); + $this->barUrl = vfsStream::url('root/bar'); + $this->bazUrl = vfsStream::url('root/bar/baz.txt'); + } + + /** + * helper assertion for the tests + * + * @param string $url url to check + * @param vfsStreamContent $content content to compare + */ + protected function assertFileTimesEqualStreamTimes($url, vfsStreamContent $content) + { + $this->assertEquals(filemtime($url), $content->filemtime()); + $this->assertEquals(fileatime($url), $content->fileatime()); + $this->assertEquals(filectime($url), $content->filectime()); + } + + /** + * @test + * @group issue_7 + * @group issue_26 + */ + public function openFileChangesAttributeTimeOnly() + { + $file = vfsStream::newFile('foo.txt') + ->withContent('test') + ->at(vfsStreamWrapper::getRoot()) + ->lastModified(100) + ->lastAccessed(100) + ->lastAttributeModified(100); + fclose(fopen($this->fooUrl, 'rb')); + $this->assertGreaterThan(time() - 2, fileatime($this->fooUrl)); + $this->assertLessThanOrEqual(time(), fileatime($this->fooUrl)); + $this->assertLessThanOrEqual(100, filemtime($this->fooUrl)); + $this->assertEquals(100, filectime($this->fooUrl)); + $this->assertFileTimesEqualStreamTimes($this->fooUrl, $file); + } + + /** + * @test + * @group issue_7 + * @group issue_26 + */ + public function fileGetContentsChangesAttributeTimeOnly() + { + $file = vfsStream::newFile('foo.txt') + ->withContent('test') + ->at(vfsStreamWrapper::getRoot()) + ->lastModified(100) + ->lastAccessed(100) + ->lastAttributeModified(100); + file_get_contents($this->fooUrl); + $this->assertGreaterThan(time() - 2, fileatime($this->fooUrl)); + $this->assertLessThanOrEqual(time(), fileatime($this->fooUrl)); + $this->assertLessThanOrEqual(100, filemtime($this->fooUrl)); + $this->assertEquals(100, filectime($this->fooUrl)); + $this->assertFileTimesEqualStreamTimes($this->fooUrl, $file); + } + + /** + * @test + * @group issue_7 + * @group issue_26 + */ + public function openFileWithTruncateChangesAttributeAndModificationTime() + { + $file = vfsStream::newFile('foo.txt') + ->withContent('test') + ->at(vfsStreamWrapper::getRoot()) + ->lastModified(100) + ->lastAccessed(100) + ->lastAttributeModified(100); + fclose(fopen($this->fooUrl, 'wb')); + $this->assertGreaterThan(time() - 2, filemtime($this->fooUrl)); + $this->assertGreaterThan(time() - 2, fileatime($this->fooUrl)); + $this->assertLessThanOrEqual(time(), filemtime($this->fooUrl)); + $this->assertLessThanOrEqual(time(), fileatime($this->fooUrl)); + $this->assertEquals(100, filectime($this->fooUrl)); + $this->assertFileTimesEqualStreamTimes($this->fooUrl, $file); + } + + /** + * @test + * @group issue_7 + */ + public function readFileChangesAccessTime() + { + $file = vfsStream::newFile('foo.txt') + ->withContent('test') + ->at(vfsStreamWrapper::getRoot()) + ->lastModified(100) + ->lastAccessed(100) + ->lastAttributeModified(100); + $fp = fopen($this->fooUrl, 'rb'); + $openTime = time(); + sleep(2); + fread($fp, 1024); + fclose($fp); + $this->assertLessThanOrEqual($openTime, filemtime($this->fooUrl)); + $this->assertLessThanOrEqual($openTime + 3, fileatime($this->fooUrl)); + $this->assertEquals(100, filectime($this->fooUrl)); + $this->assertFileTimesEqualStreamTimes($this->fooUrl, $file); + } + + /** + * @test + * @group issue_7 + */ + public function writeFileChangesModificationTime() + { + $file = vfsStream::newFile('foo.txt') + ->at(vfsStreamWrapper::getRoot()) + ->lastModified(100) + ->lastAccessed(100) + ->lastAttributeModified(100); + $fp = fopen($this->fooUrl, 'wb'); + $openTime = time(); + sleep(2); + fwrite($fp, 'test'); + fclose($fp); + $this->assertLessThanOrEqual($openTime + 3, filemtime($this->fooUrl)); + $this->assertLessThanOrEqual($openTime, fileatime($this->fooUrl)); + $this->assertEquals(100, filectime($this->fooUrl)); + $this->assertFileTimesEqualStreamTimes($this->fooUrl, $file); + + } + + /** + * @test + * @group issue_7 + */ + public function createNewFileSetsAllTimesToCurrentTime() + { + file_put_contents($this->fooUrl, 'test'); + $this->assertLessThanOrEqual(time(), filemtime($this->fooUrl)); + $this->assertEquals(fileatime($this->fooUrl), filectime($this->fooUrl)); + $this->assertEquals(fileatime($this->fooUrl), filemtime($this->fooUrl)); + $this->assertFileTimesEqualStreamTimes($this->fooUrl, vfsStreamWrapper::getRoot()->getChild('foo.txt')); + } + + /** + * @test + * @group issue_7 + */ + public function createNewFileChangesAttributeAndModificationTimeOfContainingDirectory() + { + $dir = vfsStream::newDirectory('bar') + ->at(vfsStreamWrapper::getRoot()) + ->lastModified(100) + ->lastAccessed(100) + ->lastAttributeModified(100); + file_put_contents($this->bazUrl, 'test'); + $this->assertLessThanOrEqual(time(), filemtime($this->barUrl)); + $this->assertLessThanOrEqual(time(), filectime($this->barUrl)); + $this->assertEquals(100, fileatime($this->barUrl)); + $this->assertFileTimesEqualStreamTimes($this->barUrl, $dir); + } + + /** + * @test + * @group issue_7 + */ + public function addNewFileNameWithLinkFunctionChangesAttributeTimeOfOriginalFile() + { + $this->markTestSkipped('Links are currently not supported by vfsStream.'); + } + + /** + * @test + * @group issue_7 + */ + public function addNewFileNameWithLinkFunctionChangesAttributeAndModificationTimeOfDirectoryContainingLink() + { + $this->markTestSkipped('Links are currently not supported by vfsStream.'); + } + + /** + * @test + * @group issue_7 + */ + public function removeFileChangesAttributeAndModificationTimeOfContainingDirectory() + { + $dir = vfsStream::newDirectory('bar') + ->at(vfsStreamWrapper::getRoot()); + $file = vfsStream::newFile('baz.txt') + ->at($dir) + ->lastModified(100) + ->lastAccessed(100) + ->lastAttributeModified(100); + $dir->lastModified(100) + ->lastAccessed(100) + ->lastAttributeModified(100); + unlink($this->bazUrl); + $this->assertLessThanOrEqual(time(), filemtime($this->barUrl)); + $this->assertLessThanOrEqual(time(), filectime($this->barUrl)); + $this->assertEquals(100, fileatime($this->barUrl)); + $this->assertFileTimesEqualStreamTimes($this->barUrl, $dir); + } + + /** + * @test + * @group issue_7 + */ + public function renameFileChangesAttributeAndModificationTimeOfAffectedDirectories() + { + $target = vfsStream::newDirectory('target') + ->at(vfsStreamWrapper::getRoot()) + ->lastModified(200) + ->lastAccessed(200) + ->lastAttributeModified(200); + $source = vfsStream::newDirectory('bar') + ->at(vfsStreamWrapper::getRoot()); + $file = vfsStream::newFile('baz.txt') + ->at($source) + ->lastModified(300) + ->lastAccessed(300) + ->lastAttributeModified(300); + $source->lastModified(100) + ->lastAccessed(100) + ->lastAttributeModified(100); + rename($this->bazUrl, vfsStream::url('root/target/baz.txt')); + $this->assertLessThanOrEqual(time(), filemtime($this->barUrl)); + $this->assertLessThanOrEqual(time(), filectime($this->barUrl)); + $this->assertEquals(100, fileatime($this->barUrl)); + $this->assertFileTimesEqualStreamTimes($this->barUrl, $source); + $this->assertLessThanOrEqual(time(), filemtime(vfsStream::url('root/target'))); + $this->assertLessThanOrEqual(time(), filectime(vfsStream::url('root/target'))); + $this->assertEquals(200, fileatime(vfsStream::url('root/target'))); + $this->assertFileTimesEqualStreamTimes(vfsStream::url('root/target'), $target); + } + + /** + * @test + * @group issue_7 + */ + public function renameFileDoesNotChangeFileTimesOfFileItself() + { + $target = vfsStream::newDirectory('target') + ->at(vfsStreamWrapper::getRoot()) + ->lastModified(200) + ->lastAccessed(200) + ->lastAttributeModified(200); + $source = vfsStream::newDirectory('bar') + ->at(vfsStreamWrapper::getRoot()); + $file = vfsStream::newFile('baz.txt') + ->at($source) + ->lastModified(300) + ->lastAccessed(300) + ->lastAttributeModified(300); + $source->lastModified(100) + ->lastAccessed(100) + ->lastAttributeModified(100); + rename($this->bazUrl, vfsStream::url('root/target/baz.txt')); + $this->assertEquals(300, filemtime(vfsStream::url('root/target/baz.txt'))); + $this->assertEquals(300, filectime(vfsStream::url('root/target/baz.txt'))); + $this->assertEquals(300, fileatime(vfsStream::url('root/target/baz.txt'))); + $this->assertFileTimesEqualStreamTimes(vfsStream::url('root/target/baz.txt'), $file); + } + + /** + * @test + * @group issue_7 + */ + public function changeFileAttributesChangesAttributeTimeOfFileItself() + { + $this->markTestSkipped('Changing file attributes via stream wrapper for self-defined streams is not supported by PHP.'); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperFlockTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperFlockTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..1b329dc50793e2a54d21402a7fc5d9977b9bb52e --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperFlockTestCase.php @@ -0,0 +1,440 @@ +root = vfsStream::setup(); + } + + /** + * @test + */ + public function fileIsNotLockedByDefault() + { + $this->assertFalse(vfsStream::newFile('foo.txt')->isLocked()); + } + + /** + * @test + */ + public function streamIsNotLockedByDefault() + { + file_put_contents(vfsStream::url('root/foo.txt'), 'content'); + $this->assertFalse($this->root->getChild('foo.txt')->isLocked()); + } + + /** + * @test + */ + public function canAquireSharedLock() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $this->assertTrue(flock($fp, LOCK_SH)); + $this->assertTrue($file->isLocked()); + $this->assertTrue($file->hasSharedLock()); + $this->assertFalse($file->hasExclusiveLock()); + fclose($fp); + + } + + /** + * @test + */ + public function canAquireSharedLockWithNonBlockingFlockCall() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $this->assertTrue(flock($fp, LOCK_SH | LOCK_NB)); + $this->assertTrue($file->isLocked()); + $this->assertTrue($file->hasSharedLock()); + $this->assertFalse($file->hasExclusiveLock()); + fclose($fp); + + } + + /** + * @test + */ + public function canAquireEclusiveLock() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $this->assertTrue(flock($fp, LOCK_EX)); + $this->assertTrue($file->isLocked()); + $this->assertFalse($file->hasSharedLock()); + $this->assertTrue($file->hasExclusiveLock()); + fclose($fp); + } + + /** + * @test + */ + public function canAquireEclusiveLockWithNonBlockingFlockCall() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $this->assertTrue(flock($fp, LOCK_EX | LOCK_NB)); + $this->assertTrue($file->isLocked()); + $this->assertFalse($file->hasSharedLock()); + $this->assertTrue($file->hasExclusiveLock()); + fclose($fp); + } + + /** + * @test + */ + public function canRemoveLock() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $file->lock($fp, LOCK_EX); + $this->assertTrue(flock($fp, LOCK_UN)); + $this->assertFalse($file->isLocked()); + $this->assertFalse($file->hasSharedLock()); + $this->assertFalse($file->hasExclusiveLock()); + fclose($fp); + } + + /** + * @see https://github.com/mikey179/vfsStream/issues/40 + * @test + * @group issue_40 + */ + public function canRemoveLockWhenNotLocked() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $this->assertTrue(flock($fp, LOCK_UN)); + $this->assertFalse($file->isLocked()); + $this->assertFalse($file->hasSharedLock()); + $this->assertFalse($file->hasSharedLock($fp)); + $this->assertFalse($file->hasExclusiveLock()); + $this->assertFalse($file->hasExclusiveLock($fp)); + fclose($fp); + } + + /** + * @see https://github.com/mikey179/vfsStream/issues/40 + * @test + * @group issue_40 + */ + public function canRemoveSharedLockWithoutRemovingSharedLockOnOtherFileHandler() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp1 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $fp2 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $file->lock($fp1, LOCK_SH); + $file->lock($fp2, LOCK_SH); + $this->assertTrue(flock($fp1, LOCK_UN)); + $this->assertTrue($file->hasSharedLock()); + $this->assertFalse($file->hasSharedLock($fp1)); + $this->assertTrue($file->hasSharedLock($fp2)); + fclose($fp1); + fclose($fp2); + } + + /** + * @see https://github.com/mikey179/vfsStream/issues/40 + * @test + * @group issue_40 + */ + public function canNotRemoveSharedLockAcquiredOnOtherFileHandler() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp1 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $fp2 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $file->lock($fp1, LOCK_SH); + $this->assertTrue(flock($fp2, LOCK_UN)); + $this->assertTrue($file->isLocked()); + $this->assertTrue($file->hasSharedLock()); + $this->assertFalse($file->hasExclusiveLock()); + fclose($fp1); + fclose($fp2); + } + + /** + * @see https://github.com/mikey179/vfsStream/issues/40 + * @test + * @group issue_40 + */ + public function canNotRemoveExlusiveLockAcquiredOnOtherFileHandler() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp1 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $fp2 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $file->lock($fp1, LOCK_EX); + $this->assertTrue(flock($fp2, LOCK_UN)); + $this->assertTrue($file->isLocked()); + $this->assertFalse($file->hasSharedLock()); + $this->assertTrue($file->hasExclusiveLock()); + fclose($fp1); + fclose($fp2); + } + + /** + * @test + */ + public function canRemoveLockWithNonBlockingFlockCall() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $file->lock($fp, LOCK_EX); + $this->assertTrue(flock($fp, LOCK_UN | LOCK_NB)); + $this->assertFalse($file->isLocked()); + $this->assertFalse($file->hasSharedLock()); + $this->assertFalse($file->hasExclusiveLock()); + fclose($fp); + } + + /** + * @see https://github.com/mikey179/vfsStream/issues/40 + * @test + * @group issue_40 + */ + public function canNotAquireExclusiveLockIfAlreadyExclusivelyLockedOnOtherFileHandler() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp1 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $fp2 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $file->lock($fp1, LOCK_EX); + $this->assertFalse(flock($fp2, LOCK_EX + LOCK_NB)); + $this->assertTrue($file->isLocked()); + $this->assertFalse($file->hasSharedLock()); + $this->assertTrue($file->hasExclusiveLock()); + $this->assertTrue($file->hasExclusiveLock($fp1)); + $this->assertFalse($file->hasExclusiveLock($fp2)); + fclose($fp1); + fclose($fp2); + } + + /** + * @see https://github.com/mikey179/vfsStream/issues/40 + * @test + * @group issue_40 + */ + public function canAquireExclusiveLockIfAlreadySelfExclusivelyLocked() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $file->lock($fp, LOCK_EX); + $this->assertTrue(flock($fp, LOCK_EX + LOCK_NB)); + $this->assertTrue($file->isLocked()); + $this->assertFalse($file->hasSharedLock()); + $this->assertTrue($file->hasExclusiveLock()); + fclose($fp); + } + + /** + * @see https://github.com/mikey179/vfsStream/issues/40 + * @test + * @group issue_40 + */ + public function canNotAquireExclusiveLockIfAlreadySharedLockedOnOtherFileHandler() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp1 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $fp2 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $file->lock($fp1, LOCK_SH); + $this->assertFalse(flock($fp2, LOCK_EX)); + $this->assertTrue($file->isLocked()); + $this->assertTrue($file->hasSharedLock()); + $this->assertFalse($file->hasExclusiveLock()); + fclose($fp1); + fclose($fp2); + } + + /** + * @see https://github.com/mikey179/vfsStream/issues/40 + * @test + * @group issue_40 + */ + public function canAquireExclusiveLockIfAlreadySelfSharedLocked() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $file->lock($fp, LOCK_SH); + $this->assertTrue(flock($fp, LOCK_EX)); + $this->assertTrue($file->isLocked()); + $this->assertFalse($file->hasSharedLock()); + $this->assertTrue($file->hasExclusiveLock()); + fclose($fp); + } + + /** + * @see https://github.com/mikey179/vfsStream/issues/40 + * @test + * @group issue_40 + */ + public function canNotAquireSharedLockIfAlreadyExclusivelyLockedOnOtherFileHandler() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp1 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $fp2 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $file->lock($fp1, LOCK_EX); + $this->assertFalse(flock($fp2, LOCK_SH + LOCK_NB)); + $this->assertTrue($file->isLocked()); + $this->assertFalse($file->hasSharedLock()); + $this->assertTrue($file->hasExclusiveLock()); + fclose($fp1); + fclose($fp2); + } + + /** + * @see https://github.com/mikey179/vfsStream/issues/40 + * @test + * @group issue_40 + */ + public function canAquireSharedLockIfAlreadySelfExclusivelyLocked() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $file->lock($fp, LOCK_EX); + $this->assertTrue(flock($fp, LOCK_SH + LOCK_NB)); + $this->assertTrue($file->isLocked()); + $this->assertTrue($file->hasSharedLock()); + $this->assertFalse($file->hasExclusiveLock()); + fclose($fp); + } + + /** + * @see https://github.com/mikey179/vfsStream/issues/40 + * @test + * @group issue_40 + */ + public function canAquireSharedLockIfAlreadySelfSharedLocked() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $file->lock($fp, LOCK_SH); + $this->assertTrue(flock($fp, LOCK_SH)); + $this->assertTrue($file->isLocked()); + $this->assertTrue($file->hasSharedLock()); + $this->assertFalse($file->hasExclusiveLock()); + fclose($fp); + } + + /** + * @see https://github.com/mikey179/vfsStream/issues/40 + * @test + * @group issue_40 + */ + public function canAquireSharedLockIfAlreadySharedLockedOnOtherFileHandler() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp1 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $fp2 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $file->lock($fp1, LOCK_SH); + $this->assertTrue(flock($fp2, LOCK_SH)); + $this->assertTrue($file->isLocked()); + $this->assertTrue($file->hasSharedLock()); + $this->assertTrue($file->hasSharedLock($fp1)); + $this->assertTrue($file->hasSharedLock($fp2)); + $this->assertFalse($file->hasExclusiveLock()); + fclose($fp1); + fclose($fp2); + } + + /** + * @see https://github.com/mikey179/vfsStream/issues/31 + * @see https://github.com/mikey179/vfsStream/issues/40 + * @test + * @group issue_31 + * @group issue_40 + */ + public function removesExclusiveLockOnStreamClose() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $file->lock($fp, LOCK_EX); + fclose($fp); + $this->assertFalse($file->isLocked()); + $this->assertFalse($file->hasSharedLock()); + $this->assertFalse($file->hasExclusiveLock()); + } + + /** + * @see https://github.com/mikey179/vfsStream/issues/31 + * @see https://github.com/mikey179/vfsStream/issues/40 + * @test + * @group issue_31 + * @group issue_40 + */ + public function removesSharedLockOnStreamClose() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $file->lock($fp, LOCK_SH); + fclose($fp); + $this->assertFalse($file->isLocked()); + $this->assertFalse($file->hasSharedLock()); + $this->assertFalse($file->hasExclusiveLock()); + } + + /** + * @see https://github.com/mikey179/vfsStream/issues/40 + * @test + * @group issue_40 + */ + public function notRemovesExclusiveLockOnStreamCloseIfExclusiveLockAcquiredOnOtherFileHandler() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp1 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $fp2 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $file->lock($fp2, LOCK_EX); + fclose($fp1); + $this->assertTrue($file->isLocked()); + $this->assertFalse($file->hasSharedLock()); + $this->assertTrue($file->hasExclusiveLock()); + $this->assertTrue($file->hasExclusiveLock($fp2)); + fclose($fp2); + } + + /** + * @see https://github.com/mikey179/vfsStream/issues/40 + * @test + * @group issue_40 + */ + public function notRemovesSharedLockOnStreamCloseIfSharedLockAcquiredOnOtherFileHandler() + { + $file = vfsStream::newFile('foo.txt')->at($this->root); + $fp1 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $fp2 = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $file->lock($fp2, LOCK_SH); + fclose($fp1); + $this->assertTrue($file->isLocked()); + $this->assertTrue($file->hasSharedLock()); + $this->assertTrue($file->hasSharedLock($fp2)); + $this->assertFalse($file->hasExclusiveLock()); + fclose($fp2); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperLargeFileTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperLargeFileTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..ca1a3f51c3a6688bd84e04cf58ff0cde8d801d42 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperLargeFileTestCase.php @@ -0,0 +1,77 @@ +largeFile = vfsStream::newFile('large.txt') + ->withContent(LargeFileContent::withGigabytes(100)) + ->at($root); + } + + /** + * @test + */ + public function hasLargeFileSize() + { + $this->assertEquals( + 100 * 1024 * 1024 * 1024, + filesize($this->largeFile->url()) + ); + } + + /** + * @test + */ + public function canReadFromLargeFile() + { + $fp = fopen($this->largeFile->url(), 'rb'); + $data = fread($fp, 15); + fclose($fp); + $this->assertEquals(str_repeat(' ', 15), $data); + } + + /** + * @test + */ + public function canWriteIntoLargeFile() + { + $fp = fopen($this->largeFile->url(), 'rb+'); + fseek($fp, 100 * 1024 * 1024, SEEK_SET); + fwrite($fp, 'foobarbaz'); + fclose($fp); + $this->largeFile->seek((100 * 1024 * 1024) - 3, SEEK_SET); + $this->assertEquals( + ' foobarbaz ', + $this->largeFile->read(15) + ); + } +} diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperQuotaTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperQuotaTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..afaeb47199c248b2d32a367aef3cc650467d1bd8 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperQuotaTestCase.php @@ -0,0 +1,224 @@ +root = vfsStream::setup(); + vfsStream::setQuota(10); + } + + /** + * @test + */ + public function writeLessThanQuotaWritesEverything() + { + $this->assertEquals(9, file_put_contents(vfsStream::url('root/file.txt'), '123456789')); + $this->assertEquals('123456789', $this->root->getChild('file.txt')->getContent()); + } + + /** + * @test + */ + public function writeUpToQotaWritesEverything() + { + $this->assertEquals(10, file_put_contents(vfsStream::url('root/file.txt'), '1234567890')); + $this->assertEquals('1234567890', $this->root->getChild('file.txt')->getContent()); + } + + /** + * @test + */ + public function writeMoreThanQotaWritesOnlyUpToQuota() + { + try { + file_put_contents(vfsStream::url('root/file.txt'), '12345678901'); + } catch (\PHPUnit_Framework_Error $e) { + $this->assertEquals('file_put_contents(): Only 10 of 11 bytes written, possibly out of free disk space', + $e->getMessage() + ); + } + + $this->assertEquals('1234567890', $this->root->getChild('file.txt')->getContent()); + } + + /** + * @test + */ + public function considersAllFilesForQuota() + { + vfsStream::newFile('foo.txt') + ->withContent('foo') + ->at(vfsStream::newDirectory('bar') + ->at($this->root) + ); + try { + file_put_contents(vfsStream::url('root/file.txt'), '12345678901'); + } catch (\PHPUnit_Framework_Error $e) { + $this->assertEquals('file_put_contents(): Only 7 of 11 bytes written, possibly out of free disk space', + $e->getMessage() + ); + } + + $this->assertEquals('1234567', $this->root->getChild('file.txt')->getContent()); + } + + /** + * @test + * @group issue_33 + */ + public function truncateToLessThanQuotaWritesEverything() + { + if (version_compare(PHP_VERSION, '5.4.0', '<')) { + $this->markTestSkipped('Requires PHP 5.4'); + } + + if (strstr(PHP_VERSION, 'hiphop') !== false) { + $this->markTestSkipped('Not supported on hhvm'); + } + + $fp = fopen(vfsStream::url('root/file.txt'), 'w+'); + $this->assertTrue(ftruncate($fp, 9)); + fclose($fp); + $this->assertEquals(9, + $this->root->getChild('file.txt')->size() + ); + $this->assertEquals("\0\0\0\0\0\0\0\0\0", + $this->root->getChild('file.txt')->getContent() + ); + } + + /** + * @test + * @group issue_33 + */ + public function truncateUpToQotaWritesEverything() + { + if (version_compare(PHP_VERSION, '5.4.0', '<')) { + $this->markTestSkipped('Requires PHP 5.4'); + } + + if (strstr(PHP_VERSION, 'hiphop') !== false) { + $this->markTestSkipped('Not supported on hhvm'); + } + + $fp = fopen(vfsStream::url('root/file.txt'), 'w+'); + $this->assertTrue(ftruncate($fp, 10)); + fclose($fp); + $this->assertEquals(10, + $this->root->getChild('file.txt')->size() + ); + $this->assertEquals("\0\0\0\0\0\0\0\0\0\0", + $this->root->getChild('file.txt')->getContent() + ); + } + + /** + * @test + * @group issue_33 + */ + public function truncateToMoreThanQotaWritesOnlyUpToQuota() + { + if (version_compare(PHP_VERSION, '5.4.0', '<')) { + $this->markTestSkipped('Requires PHP 5.4'); + } + + if (strstr(PHP_VERSION, 'hiphop') !== false) { + $this->markTestSkipped('Not supported on hhvm'); + } + + $fp = fopen(vfsStream::url('root/file.txt'), 'w+'); + $this->assertTrue(ftruncate($fp, 11)); + fclose($fp); + $this->assertEquals(10, + $this->root->getChild('file.txt')->size() + ); + $this->assertEquals("\0\0\0\0\0\0\0\0\0\0", + $this->root->getChild('file.txt')->getContent() + ); + } + + /** + * @test + * @group issue_33 + */ + public function truncateConsidersAllFilesForQuota() + { + if (version_compare(PHP_VERSION, '5.4.0', '<')) { + $this->markTestSkipped('Requires PHP 5.4'); + } + + if (strstr(PHP_VERSION, 'hiphop') !== false) { + $this->markTestSkipped('Not supported on hhvm'); + } + + vfsStream::newFile('bar.txt') + ->withContent('bar') + ->at(vfsStream::newDirectory('bar') + ->at($this->root) + ); + $fp = fopen(vfsStream::url('root/file.txt'), 'w+'); + $this->assertTrue(ftruncate($fp, 11)); + fclose($fp); + $this->assertEquals(7, + $this->root->getChild('file.txt')->size() + ); + $this->assertEquals("\0\0\0\0\0\0\0", + $this->root->getChild('file.txt')->getContent() + ); + } + + /** + * @test + * @group issue_33 + */ + public function canNotTruncateToGreaterLengthWhenDiscQuotaReached() + { + if (version_compare(PHP_VERSION, '5.4.0', '<')) { + $this->markTestSkipped('Requires PHP 5.4'); + } + + if (strstr(PHP_VERSION, 'hiphop') !== false) { + $this->markTestSkipped('Not supported on hhvm'); + } + + vfsStream::newFile('bar.txt') + ->withContent('1234567890') + ->at(vfsStream::newDirectory('bar') + ->at($this->root) + ); + $fp = fopen(vfsStream::url('root/file.txt'), 'w+'); + $this->assertFalse(ftruncate($fp, 11)); + fclose($fp); + $this->assertEquals(0, + $this->root->getChild('file.txt')->size() + ); + $this->assertEquals('', + $this->root->getChild('file.txt')->getContent() + ); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperSetOptionTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperSetOptionTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..aa86bd343a19685df7908b3ee7a2635f21688f29 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperSetOptionTestCase.php @@ -0,0 +1,76 @@ +root = vfsStream::setup(); + vfsStream::newFile('foo.txt')->at($this->root); + } + + /** + * @test + */ + public function setBlockingDoesNotWork() + { + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $this->assertFalse(stream_set_blocking($fp, 1)); + fclose($fp); + } + + /** + * @test + */ + public function removeBlockingDoesNotWork() + { + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $this->assertFalse(stream_set_blocking($fp, 0)); + fclose($fp); + } + + /** + * @test + */ + public function setTimeoutDoesNotWork() + { + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $this->assertFalse(stream_set_timeout($fp, 1)); + fclose($fp); + } + + /** + * @test + */ + public function setWriteBufferDoesNotWork() + { + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $this->assertEquals(-1, stream_set_write_buffer($fp, 512)); + fclose($fp); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperStreamSelectTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperStreamSelectTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..c2aec99713aad08a5aab91c0e1be27138c5c70c9 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperStreamSelectTestCase.php @@ -0,0 +1,35 @@ +at($root)->withContent('testContent'); + + $fp = fopen(vfsStream::url('root/foo.txt'), 'rb'); + $readarray = array($fp); + $writearray = array(); + $exceptarray = array(); + stream_select($readarray, $writearray, $exceptarray, 1); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..3dd4e517ca3edf174e283eb0e25a33c6520977c5 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperTestCase.php @@ -0,0 +1,770 @@ +assertSame($this->foo, vfsStreamWrapper::getRoot()); + vfsStreamWrapper::register(); + $this->assertNull(vfsStreamWrapper::getRoot()); + } + + /** + * @test + * @since 0.11.0 + */ + public function setRootReturnsRoot() + { + vfsStreamWrapper::register(); + $root = vfsStream::newDirectory('root'); + $this->assertSame($root, vfsStreamWrapper::setRoot($root)); + } + + /** + * assure that filesize is returned correct + * + * @test + */ + public function filesize() + { + $this->assertEquals(0, filesize($this->fooURL)); + $this->assertEquals(0, filesize($this->fooURL . '/.')); + $this->assertEquals(0, filesize($this->barURL)); + $this->assertEquals(0, filesize($this->barURL . '/.')); + $this->assertEquals(4, filesize($this->baz2URL)); + $this->assertEquals(5, filesize($this->baz1URL)); + } + + /** + * assert that file_exists() delivers correct result + * + * @test + */ + public function file_exists() + { + $this->assertTrue(file_exists($this->fooURL)); + $this->assertTrue(file_exists($this->fooURL . '/.')); + $this->assertTrue(file_exists($this->barURL)); + $this->assertTrue(file_exists($this->barURL . '/.')); + $this->assertTrue(file_exists($this->baz1URL)); + $this->assertTrue(file_exists($this->baz2URL)); + $this->assertFalse(file_exists($this->fooURL . '/another')); + $this->assertFalse(file_exists(vfsStream::url('another'))); + } + + /** + * assert that filemtime() delivers correct result + * + * @test + */ + public function filemtime() + { + $this->assertEquals(100, filemtime($this->fooURL)); + $this->assertEquals(100, filemtime($this->fooURL . '/.')); + $this->assertEquals(200, filemtime($this->barURL)); + $this->assertEquals(200, filemtime($this->barURL . '/.')); + $this->assertEquals(300, filemtime($this->baz1URL)); + $this->assertEquals(400, filemtime($this->baz2URL)); + } + + /** + * @test + * @group issue_23 + */ + public function unlinkRemovesFilesOnly() + { + $this->assertTrue(unlink($this->baz2URL)); + $this->assertFalse(file_exists($this->baz2URL)); // make sure statcache was cleared + $this->assertEquals(array($this->bar), $this->foo->getChildren()); + $this->assertFalse(@unlink($this->fooURL . '/another')); + $this->assertFalse(@unlink(vfsStream::url('another'))); + $this->assertEquals(array($this->bar), $this->foo->getChildren()); + } + + /** + * @test + * @group issue_49 + */ + public function unlinkReturnsFalseWhenFileDoesNotExist() + { + vfsStream::setup()->addChild(vfsStream::newFile('foo.blubb')); + $this->assertFalse(@unlink(vfsStream::url('foo.blubb2'))); + } + + /** + * @test + * @group issue_49 + */ + public function unlinkReturnsFalseWhenFileDoesNotExistAndFileWithSameNameExistsInRoot() + { + vfsStream::setup()->addChild(vfsStream::newFile('foo.blubb')); + $this->assertFalse(@unlink(vfsStream::url('foo.blubb'))); + } + + /** + * assert dirname() returns correct directory name + * + * @test + */ + public function dirname() + { + $this->assertEquals($this->fooURL, dirname($this->barURL)); + $this->assertEquals($this->barURL, dirname($this->baz1URL)); + # returns "vfs:" instead of "." + # however this seems not to be fixable because dirname() does not + # call the stream wrapper + #$this->assertEquals(dirname(vfsStream::url('doesNotExist')), '.'); + } + + /** + * assert basename() returns correct file name + * + * @test + */ + public function basename() + { + $this->assertEquals('bar', basename($this->barURL)); + $this->assertEquals('baz1', basename($this->baz1URL)); + $this->assertEquals('doesNotExist', basename(vfsStream::url('doesNotExist'))); + } + + /** + * assert is_readable() works correct + * + * @test + */ + public function is_readable() + { + $this->assertTrue(is_readable($this->fooURL)); + $this->assertTrue(is_readable($this->fooURL . '/.')); + $this->assertTrue(is_readable($this->barURL)); + $this->assertTrue(is_readable($this->barURL . '/.')); + $this->assertTrue(is_readable($this->baz1URL)); + $this->assertTrue(is_readable($this->baz2URL)); + $this->assertFalse(is_readable($this->fooURL . '/another')); + $this->assertFalse(is_readable(vfsStream::url('another'))); + + $this->foo->chmod(0222); + $this->assertFalse(is_readable($this->fooURL)); + + $this->baz1->chmod(0222); + $this->assertFalse(is_readable($this->baz1URL)); + } + + /** + * assert is_writable() works correct + * + * @test + */ + public function is_writable() + { + $this->assertTrue(is_writable($this->fooURL)); + $this->assertTrue(is_writable($this->fooURL . '/.')); + $this->assertTrue(is_writable($this->barURL)); + $this->assertTrue(is_writable($this->barURL . '/.')); + $this->assertTrue(is_writable($this->baz1URL)); + $this->assertTrue(is_writable($this->baz2URL)); + $this->assertFalse(is_writable($this->fooURL . '/another')); + $this->assertFalse(is_writable(vfsStream::url('another'))); + + $this->foo->chmod(0444); + $this->assertFalse(is_writable($this->fooURL)); + + $this->baz1->chmod(0444); + $this->assertFalse(is_writable($this->baz1URL)); + } + + /** + * assert is_executable() works correct + * + * @test + */ + public function is_executable() + { + $this->assertFalse(is_executable($this->baz1URL)); + $this->baz1->chmod(0766); + $this->assertTrue(is_executable($this->baz1URL)); + $this->assertFalse(is_executable($this->baz2URL)); + } + + /** + * assert is_executable() works correct + * + * @test + */ + public function directoriesAndNonExistingFilesAreNeverExecutable() + { + $this->assertFalse(is_executable($this->fooURL)); + $this->assertFalse(is_executable($this->fooURL . '/.')); + $this->assertFalse(is_executable($this->barURL)); + $this->assertFalse(is_executable($this->barURL . '/.')); + $this->assertFalse(is_executable($this->fooURL . '/another')); + $this->assertFalse(is_executable(vfsStream::url('another'))); + } + + /** + * file permissions + * + * @test + * @group permissions + */ + public function chmod() + { + $this->assertEquals(40777, decoct(fileperms($this->fooURL))); + $this->assertEquals(40777, decoct(fileperms($this->fooURL . '/.'))); + $this->assertEquals(40777, decoct(fileperms($this->barURL))); + $this->assertEquals(40777, decoct(fileperms($this->barURL . '/.'))); + $this->assertEquals(100666, decoct(fileperms($this->baz1URL))); + $this->assertEquals(100666, decoct(fileperms($this->baz2URL))); + + $this->foo->chmod(0755); + $this->bar->chmod(0700); + $this->baz1->chmod(0644); + $this->baz2->chmod(0600); + $this->assertEquals(40755, decoct(fileperms($this->fooURL))); + $this->assertEquals(40755, decoct(fileperms($this->fooURL . '/.'))); + $this->assertEquals(40700, decoct(fileperms($this->barURL))); + $this->assertEquals(40700, decoct(fileperms($this->barURL . '/.'))); + $this->assertEquals(100644, decoct(fileperms($this->baz1URL))); + $this->assertEquals(100600, decoct(fileperms($this->baz2URL))); + } + + /** + * @test + * @group issue_11 + * @group permissions + */ + public function chmodModifiesPermissions() + { + if (version_compare(phpversion(), '5.4.0', '<')) { + $this->assertFalse(@chmod($this->fooURL, 0755)); + $this->assertFalse(@chmod($this->barURL, 0711)); + $this->assertFalse(@chmod($this->baz1URL, 0644)); + $this->assertFalse(@chmod($this->baz2URL, 0664)); + $this->assertEquals(40777, decoct(fileperms($this->fooURL))); + $this->assertEquals(40777, decoct(fileperms($this->barURL))); + $this->assertEquals(100666, decoct(fileperms($this->baz1URL))); + $this->assertEquals(100666, decoct(fileperms($this->baz2URL))); + } else { + $this->assertTrue(chmod($this->fooURL, 0755)); + $this->assertTrue(chmod($this->barURL, 0711)); + $this->assertTrue(chmod($this->baz1URL, 0644)); + $this->assertTrue(chmod($this->baz2URL, 0664)); + $this->assertEquals(40755, decoct(fileperms($this->fooURL))); + $this->assertEquals(40711, decoct(fileperms($this->barURL))); + $this->assertEquals(100644, decoct(fileperms($this->baz1URL))); + $this->assertEquals(100664, decoct(fileperms($this->baz2URL))); + } + } + + /** + * @test + * @group permissions + */ + public function fileownerIsCurrentUserByDefault() + { + $this->assertEquals(vfsStream::getCurrentUser(), fileowner($this->fooURL)); + $this->assertEquals(vfsStream::getCurrentUser(), fileowner($this->fooURL . '/.')); + $this->assertEquals(vfsStream::getCurrentUser(), fileowner($this->barURL)); + $this->assertEquals(vfsStream::getCurrentUser(), fileowner($this->barURL . '/.')); + $this->assertEquals(vfsStream::getCurrentUser(), fileowner($this->baz1URL)); + $this->assertEquals(vfsStream::getCurrentUser(), fileowner($this->baz2URL)); + } + + /** + * @test + * @group issue_11 + * @group permissions + */ + public function chownChangesUser() + { + if (version_compare(phpversion(), '5.4.0', '<')) { + $this->foo->chown(vfsStream::OWNER_USER_1); + $this->bar->chown(vfsStream::OWNER_USER_1); + $this->baz1->chown(vfsStream::OWNER_USER_2); + $this->baz2->chown(vfsStream::OWNER_USER_2); + } else { + chown($this->fooURL, vfsStream::OWNER_USER_1); + chown($this->barURL, vfsStream::OWNER_USER_1); + chown($this->baz1URL, vfsStream::OWNER_USER_2); + chown($this->baz2URL, vfsStream::OWNER_USER_2); + } + + $this->assertEquals(vfsStream::OWNER_USER_1, fileowner($this->fooURL)); + $this->assertEquals(vfsStream::OWNER_USER_1, fileowner($this->fooURL . '/.')); + $this->assertEquals(vfsStream::OWNER_USER_1, fileowner($this->barURL)); + $this->assertEquals(vfsStream::OWNER_USER_1, fileowner($this->barURL . '/.')); + $this->assertEquals(vfsStream::OWNER_USER_2, fileowner($this->baz1URL)); + $this->assertEquals(vfsStream::OWNER_USER_2, fileowner($this->baz2URL)); + } + + /** + * @test + * @group issue_11 + * @group permissions + */ + public function chownDoesNotWorkOnVfsStreamUrls() + { + if (version_compare(phpversion(), '5.4.0', '<')) { + $this->assertFalse(@chown($this->fooURL, vfsStream::OWNER_USER_2)); + $this->assertEquals(vfsStream::getCurrentUser(), fileowner($this->fooURL)); + } + } + + /** + * @test + * @group issue_11 + * @group permissions + */ + public function groupIsCurrentGroupByDefault() + { + $this->assertEquals(vfsStream::getCurrentGroup(), filegroup($this->fooURL)); + $this->assertEquals(vfsStream::getCurrentGroup(), filegroup($this->fooURL . '/.')); + $this->assertEquals(vfsStream::getCurrentGroup(), filegroup($this->barURL)); + $this->assertEquals(vfsStream::getCurrentGroup(), filegroup($this->barURL . '/.')); + $this->assertEquals(vfsStream::getCurrentGroup(), filegroup($this->baz1URL)); + $this->assertEquals(vfsStream::getCurrentGroup(), filegroup($this->baz2URL)); + } + + /** + * @test + * @group issue_11 + * @group permissions + */ + public function chgrp() + { + if (version_compare(phpversion(), '5.4.0', '<')) { + $this->foo->chgrp(vfsStream::GROUP_USER_1); + $this->bar->chgrp(vfsStream::GROUP_USER_1); + $this->baz1->chgrp(vfsStream::GROUP_USER_2); + $this->baz2->chgrp(vfsStream::GROUP_USER_2); + } else { + chgrp($this->fooURL, vfsStream::GROUP_USER_1); + chgrp($this->barURL, vfsStream::GROUP_USER_1); + chgrp($this->baz1URL, vfsStream::GROUP_USER_2); + chgrp($this->baz2URL, vfsStream::GROUP_USER_2); + } + + $this->assertEquals(vfsStream::GROUP_USER_1, filegroup($this->fooURL)); + $this->assertEquals(vfsStream::GROUP_USER_1, filegroup($this->fooURL . '/.')); + $this->assertEquals(vfsStream::GROUP_USER_1, filegroup($this->barURL)); + $this->assertEquals(vfsStream::GROUP_USER_1, filegroup($this->barURL . '/.')); + $this->assertEquals(vfsStream::GROUP_USER_2, filegroup($this->baz1URL)); + $this->assertEquals(vfsStream::GROUP_USER_2, filegroup($this->baz2URL)); + } + + /** + * @test + * @group issue_11 + * @group permissions + */ + public function chgrpDoesNotWorkOnVfsStreamUrls() + { + if (version_compare(phpversion(), '5.4.0', '<')) { + $this->assertFalse(@chgrp($this->fooURL, vfsStream::GROUP_USER_2)); + $this->assertEquals(vfsStream::getCurrentGroup(), filegroup($this->fooURL)); + } + } + + /** + * @test + * @author Benoit Aubuchon + */ + public function renameDirectory() + { + // move foo/bar to foo/baz3 + $baz3URL = vfsStream::url('foo/baz3'); + $this->assertTrue(rename($this->barURL, $baz3URL)); + $this->assertFileExists($baz3URL); + $this->assertFileNotExists($this->barURL); + } + + /** + * @test + */ + public function renameDirectoryWithDots() + { + // move foo/bar to foo/baz3 + $baz3URL = vfsStream::url('foo/baz3'); + $this->assertTrue(rename($this->barURL . '/.', $baz3URL)); + $this->assertFileExists($baz3URL); + $this->assertFileNotExists($this->barURL); + } + + /** + * @test + * @group issue_9 + * @since 0.9.0 + */ + public function renameDirectoryWithDotsInTarget() + { + // move foo/bar to foo/baz3 + $baz3URL = vfsStream::url('foo/../baz3/.'); + $this->assertTrue(rename($this->barURL . '/.', $baz3URL)); + $this->assertFileExists($baz3URL); + $this->assertFileNotExists($this->barURL); + } + + /** + * @test + * @author Benoit Aubuchon + */ + public function renameDirectoryOverwritingExistingFile() + { + // move foo/bar to foo/baz2 + $this->assertTrue(rename($this->barURL, $this->baz2URL)); + $this->assertFileExists(vfsStream::url('foo/baz2/baz1')); + $this->assertFileNotExists($this->barURL); + } + + /** + * @test + * @expectedException PHPUnit_Framework_Error + */ + public function renameFileIntoFile() + { + // foo/baz2 is a file, so it can not be turned into a directory + $baz3URL = vfsStream::url('foo/baz2/baz3'); + $this->assertTrue(rename($this->baz1URL, $baz3URL)); + $this->assertFileExists($baz3URL); + $this->assertFileNotExists($this->baz1URL); + } + + /** + * @test + * @author Benoit Aubuchon + */ + public function renameFileToDirectory() + { + // move foo/bar/baz1 to foo/baz3 + $baz3URL = vfsStream::url('foo/baz3'); + $this->assertTrue(rename($this->baz1URL, $baz3URL)); + $this->assertFileExists($this->barURL); + $this->assertFileExists($baz3URL); + $this->assertFileNotExists($this->baz1URL); + } + + /** + * assert that trying to rename from a non existing file trigger a warning + * + * @expectedException PHPUnit_Framework_Error + * @test + */ + public function renameOnSourceFileNotFound() + { + rename(vfsStream::url('notfound'), $this->baz1URL); + } + /** + * assert that trying to rename to a directory that is not found trigger a warning + + * @expectedException PHPUnit_Framework_Error + * @test + */ + public function renameOnDestinationDirectoryFileNotFound() + { + rename($this->baz1URL, vfsStream::url('foo/notfound/file2')); + } + /** + * stat() and fstat() should return the same result + * + * @test + */ + public function statAndFstatReturnSameResult() + { + $fp = fopen($this->baz2URL, 'r'); + $this->assertEquals(stat($this->baz2URL), + fstat($fp) + ); + fclose($fp); + } + + /** + * stat() returns full data + * + * @test + */ + public function statReturnsFullDataForFiles() + { + $this->assertEquals(array(0 => 0, + 1 => 0, + 2 => 0100666, + 3 => 0, + 4 => vfsStream::getCurrentUser(), + 5 => vfsStream::getCurrentGroup(), + 6 => 0, + 7 => 4, + 8 => 400, + 9 => 400, + 10 => 400, + 11 => -1, + 12 => -1, + 'dev' => 0, + 'ino' => 0, + 'mode' => 0100666, + 'nlink' => 0, + 'uid' => vfsStream::getCurrentUser(), + 'gid' => vfsStream::getCurrentGroup(), + 'rdev' => 0, + 'size' => 4, + 'atime' => 400, + 'mtime' => 400, + 'ctime' => 400, + 'blksize' => -1, + 'blocks' => -1 + ), + stat($this->baz2URL) + ); + } + + /** + * @test + */ + public function statReturnsFullDataForDirectories() + { + $this->assertEquals(array(0 => 0, + 1 => 0, + 2 => 0040777, + 3 => 0, + 4 => vfsStream::getCurrentUser(), + 5 => vfsStream::getCurrentGroup(), + 6 => 0, + 7 => 0, + 8 => 100, + 9 => 100, + 10 => 100, + 11 => -1, + 12 => -1, + 'dev' => 0, + 'ino' => 0, + 'mode' => 0040777, + 'nlink' => 0, + 'uid' => vfsStream::getCurrentUser(), + 'gid' => vfsStream::getCurrentGroup(), + 'rdev' => 0, + 'size' => 0, + 'atime' => 100, + 'mtime' => 100, + 'ctime' => 100, + 'blksize' => -1, + 'blocks' => -1 + ), + stat($this->fooURL) + ); + } + + /** + * @test + */ + public function statReturnsFullDataForDirectoriesWithDot() + { + $this->assertEquals(array(0 => 0, + 1 => 0, + 2 => 0040777, + 3 => 0, + 4 => vfsStream::getCurrentUser(), + 5 => vfsStream::getCurrentGroup(), + 6 => 0, + 7 => 0, + 8 => 100, + 9 => 100, + 10 => 100, + 11 => -1, + 12 => -1, + 'dev' => 0, + 'ino' => 0, + 'mode' => 0040777, + 'nlink' => 0, + 'uid' => vfsStream::getCurrentUser(), + 'gid' => vfsStream::getCurrentGroup(), + 'rdev' => 0, + 'size' => 0, + 'atime' => 100, + 'mtime' => 100, + 'ctime' => 100, + 'blksize' => -1, + 'blocks' => -1 + ), + stat($this->fooURL . '/.') + ); + } + + /** + * @test + * @expectedException PHPUnit_Framework_Error + */ + public function openFileWithoutDirectory() + { + vfsStreamWrapper::register(); + $this->assertFalse(file_get_contents(vfsStream::url('file.txt'))); + } + + /** + * @test + * @group issue_33 + * @since 1.1.0 + * @requires PHP 5.4.0 + */ + public function truncateRemovesSuperflouosContent() + { + if (strstr(PHP_VERSION, 'hiphop') !== false) { + $this->markTestSkipped('Not supported on hhvm'); + } + + $handle = fopen($this->baz1URL, "r+"); + $this->assertTrue(ftruncate($handle, 0)); + $this->assertEquals(0, filesize($this->baz1URL)); + $this->assertEquals('', file_get_contents($this->baz1URL)); + fclose($handle); + } + + /** + * @test + * @group issue_33 + * @since 1.1.0 + * @requires PHP 5.4.0 + */ + public function truncateToGreaterSizeAddsZeroBytes() + { + if (strstr(PHP_VERSION, 'hiphop') !== false) { + $this->markTestSkipped('Not supported on hhvm'); + } + + $handle = fopen($this->baz1URL, "r+"); + $this->assertTrue(ftruncate($handle, 25)); + $this->assertEquals(25, filesize($this->baz1URL)); + $this->assertEquals("baz 1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", + file_get_contents($this->baz1URL)); + fclose($handle); + } + + /** + * @test + * @group issue_11 + * @requires PHP 5.4.0 + */ + public function touchCreatesNonExistingFile() + { + $this->assertTrue(touch($this->fooURL . '/new.txt')); + $this->assertTrue($this->foo->hasChild('new.txt')); + } + + /** + * @test + * @group issue_11 + * @requires PHP 5.4.0 + */ + public function touchChangesAccessAndModificationTimeForFile() + { + $this->assertTrue(touch($this->baz1URL, 303, 313)); + $this->assertEquals(303, $this->baz1->filemtime()); + $this->assertEquals(313, $this->baz1->fileatime()); + } + + /** + * @test + * @group issue_11 + * @group issue_80 + * @requires PHP 5.4.0 + */ + public function touchChangesTimesToCurrentTimestampWhenNoTimesGiven() + { + $this->assertTrue(touch($this->baz1URL)); + $this->assertEquals(time(), $this->baz1->filemtime(), '', 1); + $this->assertEquals(time(), $this->baz1->fileatime(), '', 1); + } + + /** + * @test + * @group issue_11 + * @requires PHP 5.4.0 + */ + public function touchWithModifiedTimeChangesAccessAndModifiedTime() + { + $this->assertTrue(touch($this->baz1URL, 303)); + $this->assertEquals(303, $this->baz1->filemtime()); + $this->assertEquals(303, $this->baz1->fileatime()); + } + + /** + * @test + * @group issue_11 + * @requires PHP 5.4.0 + */ + public function touchChangesAccessAndModificationTimeForDirectory() + { + $this->assertTrue(touch($this->fooURL, 303, 313)); + $this->assertEquals(303, $this->foo->filemtime()); + $this->assertEquals(313, $this->foo->fileatime()); + } + + /** + * @test + * @group issue_34 + * @since 1.2.0 + */ + public function pathesAreCorrectlySet() + { + $this->assertEquals(vfsStream::path($this->fooURL), $this->foo->path()); + $this->assertEquals(vfsStream::path($this->barURL), $this->bar->path()); + $this->assertEquals(vfsStream::path($this->baz1URL), $this->baz1->path()); + $this->assertEquals(vfsStream::path($this->baz2URL), $this->baz2->path()); + } + + /** + * @test + * @group issue_34 + * @since 1.2.0 + */ + public function urlsAreCorrectlySet() + { + $this->assertEquals($this->fooURL, $this->foo->url()); + $this->assertEquals($this->barURL, $this->bar->url()); + $this->assertEquals($this->baz1URL, $this->baz1->url()); + $this->assertEquals($this->baz2URL, $this->baz2->url()); + } + + /** + * @test + * @group issue_34 + * @since 1.2.0 + */ + public function pathIsUpdatedAfterMove() + { + // move foo/bar/baz1 to foo/baz3 + $baz3URL = vfsStream::url('foo/baz3'); + $this->assertTrue(rename($this->baz1URL, $baz3URL)); + $this->assertEquals(vfsStream::path($baz3URL), $this->baz1->path()); + } + + /** + * @test + * @group issue_34 + * @since 1.2.0 + */ + public function urlIsUpdatedAfterMove() + { + // move foo/bar/baz1 to foo/baz3 + $baz3URL = vfsStream::url('foo/baz3'); + $this->assertTrue(rename($this->baz1URL, $baz3URL)); + $this->assertEquals($baz3URL, $this->baz1->url()); + } +} diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperUnregisterTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperUnregisterTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..2457304eb3d1f16880ba5cd9787c5e4a39b0c0ab --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperUnregisterTestCase.php @@ -0,0 +1,75 @@ +assertNotContains(vfsStream::SCHEME, stream_get_wrappers()); + } + + /** + * Unregistering a third party wrapper for vfs:// fails. + * + * @test + * @expectedException org\bovigo\vfs\vfsStreamException + * @runInSeparateProcess + */ + public function unregisterThirdPartyVfsScheme() + { + // Unregister possible registered URL wrapper. + vfsStreamWrapper::unregister(); + + $mock = $this->getMock('org\\bovigo\\vfs\\vfsStreamWrapper'); + stream_wrapper_register(vfsStream::SCHEME, get_class($mock)); + + vfsStreamWrapper::unregister(); + } + + /** + * Unregistering when not in registered state will fail. + * + * @test + * @expectedException org\bovigo\vfs\vfsStreamException + * @runInSeparateProcess + */ + public function unregisterWhenNotInRegisteredState() + { + vfsStreamWrapper::register(); + stream_wrapper_unregister(vfsStream::SCHEME); + vfsStreamWrapper::unregister(); + } + + /** + * Unregistering while not registers won't fail. + * + * @test + */ + public function unregisterWhenNotRegistered() + { + // Unregister possible registered URL wrapper. + vfsStreamWrapper::unregister(); + + $this->assertNotContains(vfsStream::SCHEME, stream_get_wrappers()); + vfsStreamWrapper::unregister(); + } +} diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperWithoutRootTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperWithoutRootTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..fab0c1311cbfe61a3d6d21238a60a429b8c3c51f --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperWithoutRootTestCase.php @@ -0,0 +1,64 @@ + no directory to open + * + * @test + */ + public function canNotOpenDirectory() + { + $this->assertFalse(@dir(vfsStream::url('foo'))); + } + + /** + * can not unlink without root + * + * @test + */ + public function canNotUnlink() + { + $this->assertFalse(@unlink(vfsStream::url('foo'))); + } + + /** + * can not open a file without root + * + * @test + */ + public function canNotOpen() + { + $this->assertFalse(@fopen(vfsStream::url('foo'), 'r')); + } + + /** + * can not rename a file without root + * + * @test + */ + public function canNotRename() + { + $this->assertFalse(@rename(vfsStream::url('foo'), vfsStream::url('bar'))); + } +} +?> diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamZipTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamZipTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..6aedcecd9220243df4ee45e7f66e805bec0b0457 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamZipTestCase.php @@ -0,0 +1,53 @@ +markTestSkipped('No ext/zip installed, skipping test.'); + } + + $this->markTestSkipped('Zip extension can not work with vfsStream urls.'); + + vfsStreamWrapper::register(); + vfsStreamWrapper::setRoot(vfsStream::newDirectory('root')); + + } + + /** + * @test + */ + public function createZipArchive() + { + $zip = new ZipArchive(); + $this->assertTrue($zip->open(vfsStream::url('root/test.zip'), ZipArchive::CREATE)); + $this->assertTrue($zip->addFromString("testfile1.txt", "#1 This is a test string added as testfile1.txt.\n")); + $this->assertTrue($zip->addFromString("testfile2.txt", "#2 This is a test string added as testfile2.txt.\n")); + $zip->setArchiveComment('a test'); + var_dump($zip); + $this->assertTrue($zip->close()); + var_dump($zip->getStatusString()); + var_dump($zip->close()); + var_dump($zip->getStatusString()); + var_dump($zip); + var_dump(file_exists(vfsStream::url('root/test.zip'))); + } +} +?> \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitorTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitorTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..d7bb49e91f022078236dce70fdaf318506f30872 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitorTestCase.php @@ -0,0 +1,99 @@ +abstractVisitor = $this->getMock('org\\bovigo\\vfs\\visitor\\vfsStreamAbstractVisitor', + array('visitFile', 'visitDirectory') + ); + } + + /** + * @test + * @expectedException \InvalidArgumentException + */ + public function visitThrowsInvalidArgumentExceptionOnUnknownContentType() + { + $mockContent = $this->getMock('org\\bovigo\\vfs\\vfsStreamContent'); + $mockContent->expects($this->any()) + ->method('getType') + ->will($this->returnValue('invalid')); + $this->assertSame($this->abstractVisitor, + $this->abstractVisitor->visit($mockContent) + ); + } + + /** + * @test + */ + public function visitWithFileCallsVisitFile() + { + $file = new vfsStreamFile('foo.txt'); + $this->abstractVisitor->expects($this->once()) + ->method('visitFile') + ->with($this->equalTo($file)); + $this->assertSame($this->abstractVisitor, + $this->abstractVisitor->visit($file) + ); + } + + /** + * tests that a block device eventually calls out to visit file + * + * @test + */ + public function visitWithBlockCallsVisitFile() + { + $block = new vfsStreamBlock('foo'); + $this->abstractVisitor->expects($this->once()) + ->method('visitFile') + ->with($this->equalTo($block)); + $this->assertSame($this->abstractVisitor, + $this->abstractVisitor->visit($block) + ); + } + + /** + * @test + */ + public function visitWithDirectoryCallsVisitDirectory() + { + $dir = new vfsStreamDirectory('bar'); + $this->abstractVisitor->expects($this->once()) + ->method('visitDirectory') + ->with($this->equalTo($dir)); + $this->assertSame($this->abstractVisitor, + $this->abstractVisitor->visit($dir) + ); + } +} +?> diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/visitor/vfsStreamPrintVisitorTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/visitor/vfsStreamPrintVisitorTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..05a11ac2261bd3e09faea1fec23b98e5604989b6 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/visitor/vfsStreamPrintVisitorTestCase.php @@ -0,0 +1,103 @@ +at(vfsStream::setup()); + $printVisitor = new vfsStreamPrintVisitor(fopen('vfs://root/foo.txt', 'wb')); + $this->assertSame($printVisitor, + $printVisitor->visitFile(vfsStream::newFile('bar.txt')) + ); + $this->assertEquals("- bar.txt\n", $output->getContent()); + } + + /** + * @test + */ + public function visitFileWritesBlockDeviceToStream() + { + $output = vfsStream::newFile('foo.txt') + ->at(vfsStream::setup()); + $printVisitor = new vfsStreamPrintVisitor(fopen('vfs://root/foo.txt', 'wb')); + $this->assertSame($printVisitor, + $printVisitor->visitBlockDevice(vfsStream::newBlock('bar')) + ); + $this->assertEquals("- [bar]\n", $output->getContent()); + } + + /** + * @test + */ + public function visitDirectoryWritesDirectoryNameToStream() + { + $output = vfsStream::newFile('foo.txt') + ->at(vfsStream::setup()); + $printVisitor = new vfsStreamPrintVisitor(fopen('vfs://root/foo.txt', 'wb')); + $this->assertSame($printVisitor, + $printVisitor->visitDirectory(vfsStream::newDirectory('baz')) + ); + $this->assertEquals("- baz\n", $output->getContent()); + } + + /** + * @test + */ + public function visitRecursiveDirectoryStructure() + { + $root = vfsStream::setup('root', + null, + array('test' => array('foo' => array('test.txt' => 'hello'), + 'baz.txt' => 'world' + ), + 'foo.txt' => '' + ) + ); + $printVisitor = new vfsStreamPrintVisitor(fopen('vfs://root/foo.txt', 'wb')); + $this->assertSame($printVisitor, + $printVisitor->visitDirectory($root) + ); + $this->assertEquals("- root\n - test\n - foo\n - test.txt\n - baz.txt\n - foo.txt\n", file_get_contents('vfs://root/foo.txt')); + } +} +?> diff --git a/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/visitor/vfsStreamStructureVisitorTestCase.php b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/visitor/vfsStreamStructureVisitorTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..ad93a2c0996c15f68188ccbbde108addadaa3f5a --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/visitor/vfsStreamStructureVisitorTestCase.php @@ -0,0 +1,86 @@ +assertEquals(array('foo.txt' => 'test'), + $structureVisitor->visitFile(vfsStream::newFile('foo.txt') + ->withContent('test') + ) + ->getStructure() + ); + } + + /** + * @test + */ + public function visitFileCreatesStructureForBlock() + { + $structureVisitor = new vfsStreamStructureVisitor(); + $this->assertEquals(array('[foo]' => 'test'), + $structureVisitor->visitBlockDevice(vfsStream::newBlock('foo') + ->withContent('test') + ) + ->getStructure() + ); + } + + /** + * @test + */ + public function visitDirectoryCreatesStructureForDirectory() + { + $structureVisitor = new vfsStreamStructureVisitor(); + $this->assertEquals(array('baz' => array()), + $structureVisitor->visitDirectory(vfsStream::newDirectory('baz')) + ->getStructure() + ); + } + + /** + * @test + */ + public function visitRecursiveDirectoryStructure() + { + $root = vfsStream::setup('root', + null, + array('test' => array('foo' => array('test.txt' => 'hello'), + 'baz.txt' => 'world' + ), + 'foo.txt' => '' + ) + ); + $structureVisitor = new vfsStreamStructureVisitor(); + $this->assertEquals(array('root' => array('test' => array('foo' => array('test.txt' => 'hello'), + 'baz.txt' => 'world' + ), + 'foo.txt' => '' + ), + ), + $structureVisitor->visitDirectory($root) + ->getStructure() + ); + } +} +?> diff --git a/vendor/mikey179/vfsStream/src/test/resources/filesystemcopy/withSubfolders/aFile.txt b/vendor/mikey179/vfsStream/src/test/resources/filesystemcopy/withSubfolders/aFile.txt new file mode 100644 index 0000000000000000000000000000000000000000..19102815663d23f8b75a47e7a01965dcdc96468c --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/resources/filesystemcopy/withSubfolders/aFile.txt @@ -0,0 +1 @@ +foo \ No newline at end of file diff --git a/vendor/mikey179/vfsStream/src/test/resources/filesystemcopy/withSubfolders/subfolder1/file1.txt b/vendor/mikey179/vfsStream/src/test/resources/filesystemcopy/withSubfolders/subfolder1/file1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6ea0495187600e7b2288c8ac19c5886383a4632 --- /dev/null +++ b/vendor/mikey179/vfsStream/src/test/resources/filesystemcopy/withSubfolders/subfolder1/file1.txt @@ -0,0 +1 @@ +foobar \ No newline at end of file diff --git a/vendor/phpunit/php-code-coverage/ChangeLog-2.2.md b/vendor/phpunit/php-code-coverage/ChangeLog-2.2.md index 115e46e39f18fb7bc92fc0d3fe49dd107a13a179..353b6f650050053e364ca1bc6da2f5953175bd63 100644 --- a/vendor/phpunit/php-code-coverage/ChangeLog-2.2.md +++ b/vendor/phpunit/php-code-coverage/ChangeLog-2.2.md @@ -2,6 +2,12 @@ All notable changes of the PHP_CodeCoverage 2.2 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. +## [2.2.4] - 2015-10-06 + +### Fixed + +* Fixed [#391](https://github.com/sebastianbergmann/php-code-coverage/pull/391): Missing `` tag + ## [2.2.3] - 2015-09-14 ### Fixed @@ -42,7 +48,8 @@ All notable changes of the PHP_CodeCoverage 2.2 release series are documented in * The dedicated driver for HHVM, `PHP_CodeCoverage_Driver_HHVM` has been removed -[2.2.3]: https://github.com/sebastianbergmann/php-code-coverage/compare/2.2.3...2.2.3 +[2.2.4]: https://github.com/sebastianbergmann/php-code-coverage/compare/2.2.3...2.2.4 +[2.2.3]: https://github.com/sebastianbergmann/php-code-coverage/compare/2.2.2...2.2.3 [2.2.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/2.2.1...2.2.2 [2.2.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/2.2.0...2.2.1 [2.2.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/2.1...2.2.0 diff --git a/vendor/phpunit/php-code-coverage/src/CodeCoverage/Report/HTML/Renderer.php b/vendor/phpunit/php-code-coverage/src/CodeCoverage/Report/HTML/Renderer.php index aacac889ba16303b7bf190a008f88b299c15fbfe..51aa15e63ce5bd44633904eafd0e709749b76f90 100644 --- a/vendor/phpunit/php-code-coverage/src/CodeCoverage/Report/HTML/Renderer.php +++ b/vendor/phpunit/php-code-coverage/src/CodeCoverage/Report/HTML/Renderer.php @@ -58,7 +58,7 @@ abstract class PHP_CodeCoverage_Report_HTML_Renderer */ public function __construct($templatePath, $generator, $date, $lowUpperBound, $highLowerBound) { - $version = new SebastianBergmann\Version('2.2.3', dirname(dirname(dirname(dirname(__DIR__))))); + $version = new SebastianBergmann\Version('2.2.4', dirname(dirname(dirname(dirname(__DIR__))))); $this->templatePath = $templatePath; $this->generator = $generator; diff --git a/vendor/phpunit/php-code-coverage/src/CodeCoverage/Report/HTML/Renderer/Dashboard.php b/vendor/phpunit/php-code-coverage/src/CodeCoverage/Report/HTML/Renderer/Dashboard.php index a29b7f3d798908cf5417dc964884f696f31954cc..f648097db01f55246b225d54b5ea2c6802f3809f 100644 --- a/vendor/phpunit/php-code-coverage/src/CodeCoverage/Report/HTML/Renderer/Dashboard.php +++ b/vendor/phpunit/php-code-coverage/src/CodeCoverage/Report/HTML/Renderer/Dashboard.php @@ -213,7 +213,7 @@ protected function insufficientCoverage(array $classes, $baseLink) list($class, $method) = explode('::', $methodName); $result['method'] .= sprintf( - ' %s%d%%' . "\n", + ' %s%d%%' . "\n", str_replace($baseLink, '', $classes[$class]['methods'][$method]['link']), $methodName, $method, diff --git a/vendor/phpunit/phpunit/ChangeLog-4.8.md b/vendor/phpunit/phpunit/ChangeLog-4.8.md index 9752eb76a7f68207bf8cdfcc789716efd329045b..9fc58455053f7f5e1b4d9239c4aef1c71cacaaf3 100644 --- a/vendor/phpunit/phpunit/ChangeLog-4.8.md +++ b/vendor/phpunit/phpunit/ChangeLog-4.8.md @@ -2,6 +2,16 @@ All notable changes of the PHPUnit 4.8 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. +## [4.8.11] - 2015-10-07 + +### Fixed + +* Merged [#1885](https://github.com/sebastianbergmann/phpunit/issues/1885): Fixed handling of PHP configuration settings for process isolation +* Fixed [#1857](https://github.com/sebastianbergmann/phpunit/issues/1857): `@covers` and `@uses` should only take a single word +* Fixed [#1879](https://github.com/sebastianbergmann/phpunit/issues/1879): `assertEqualXMLStructure()` cannot compare nodes with an ID +* Fixed [#1898](https://github.com/sebastianbergmann/phpunit/issues/1898): `@covers` and `@uses` cannot be used for namespaced functions +* Fixed [#1901](https://github.com/sebastianbergmann/phpunit/issues/1901): `--self-update` updates to PHPUnit 5, even on PHP < 5.6 + ## [4.8.10] - 2015-10-01 ### Fixed @@ -75,6 +85,7 @@ New PHAR release due to updated dependencies * Made the argument check of `assertContains()` and `assertNotContains()` more strict to prevent undefined behavior such as [#1808](https://github.com/sebastianbergmann/phpunit/issues/1808) * Changed the name of the default group from `__nogroup__` to `default` +[4.8.11]: https://github.com/sebastianbergmann/phpunit/compare/4.8.10...4.8.11 [4.8.10]: https://github.com/sebastianbergmann/phpunit/compare/4.8.9...4.8.10 [4.8.9]: https://github.com/sebastianbergmann/phpunit/compare/4.8.8...4.8.9 [4.8.8]: https://github.com/sebastianbergmann/phpunit/compare/4.8.7...4.8.8 diff --git a/vendor/phpunit/phpunit/src/Framework/Assert.php b/vendor/phpunit/phpunit/src/Framework/Assert.php index 948a599301ed0695ccfd1b2daeca7b2a1ec379fa..4da7cff104174c77002e727e358a677d0fca528c 100644 --- a/vendor/phpunit/phpunit/src/Framework/Assert.php +++ b/vendor/phpunit/phpunit/src/Framework/Assert.php @@ -1795,8 +1795,13 @@ public static function assertXmlStringNotEqualsXmlString($expectedXml, $actualXm */ public static function assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, $checkAttributes = false, $message = '') { - $expectedElement = clone $expectedElement; - $actualElement = clone $actualElement; + $tmp = new DOMDocument; + $expectedElement = $tmp->importNode($expectedElement, true); + + $tmp = new DOMDocument; + $actualElement= $tmp->importNode($actualElement, true); + + unset($tmp); self::assertEquals( $expectedElement->tagName, diff --git a/vendor/phpunit/phpunit/src/Framework/TestCase.php b/vendor/phpunit/phpunit/src/Framework/TestCase.php index 22f344a7575e21c0b67c1d88e1237c76c963c39c..ea65fbc8aa28de6d968639bcbb2a15fb56752870 100644 --- a/vendor/phpunit/phpunit/src/Framework/TestCase.php +++ b/vendor/phpunit/phpunit/src/Framework/TestCase.php @@ -670,6 +670,8 @@ public function run(PHPUnit_Framework_TestResult $result = null) $includePath = "'." . $includePath . ".'"; $codeCoverageFilter = "'." . $codeCoverageFilter . ".'"; + $configurationFilePath = (isset($GLOBALS['__PHPUNIT_CONFIGURATION_FILE']) ? $GLOBALS['__PHPUNIT_CONFIGURATION_FILE'] : ''); + $template->setVar( array( 'composerAutoload' => $composerAutoload, @@ -690,7 +692,8 @@ public function run(PHPUnit_Framework_TestResult $result = null) 'isStrictAboutOutputDuringTests' => $isStrictAboutOutputDuringTests, 'isStrictAboutTestSize' => $isStrictAboutTestSize, 'isStrictAboutTodoAnnotatedTests' => $isStrictAboutTodoAnnotatedTests, - 'codeCoverageFilter' => $codeCoverageFilter + 'codeCoverageFilter' => $codeCoverageFilter, + 'configurationFilePath' => $configurationFilePath ) ); diff --git a/vendor/phpunit/phpunit/src/Runner/Version.php b/vendor/phpunit/phpunit/src/Runner/Version.php index 884dd5b66d00c2af7f7124e487025be9ccb0d93d..58e339048d23c587aaf896da63a7f1d3cb086e24 100644 --- a/vendor/phpunit/phpunit/src/Runner/Version.php +++ b/vendor/phpunit/phpunit/src/Runner/Version.php @@ -30,7 +30,7 @@ public static function id() } if (self::$version === null) { - $version = new SebastianBergmann\Version('4.8.10', dirname(dirname(__DIR__))); + $version = new SebastianBergmann\Version('4.8.11', dirname(dirname(__DIR__))); self::$version = $version->getVersion(); } diff --git a/vendor/phpunit/phpunit/src/TextUI/Command.php b/vendor/phpunit/phpunit/src/TextUI/Command.php index bad02889c63bb36c10ce3c8add6614e7c14d4aea..6a7340987443bc15cfc8687fc8db2cfe8ede339f 100644 --- a/vendor/phpunit/phpunit/src/TextUI/Command.php +++ b/vendor/phpunit/phpunit/src/TextUI/Command.php @@ -786,10 +786,11 @@ protected function handleSelfUpdate() exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT); } - $remoteFilename = sprintf( - 'https://phar.phpunit.de/phpunit%s.phar', - PHPUnit_Runner_Version::getReleaseChannel() - ); + if (PHP_VERSION_ID < 50600) { + $remoteFilename = sprintf('https://phar.phpunit.de/phpunit-old.phar'); + } else { + $remoteFilename = sprintf('https://phar.phpunit.de/phpunit.phar'); + } $tempFilename = tempnam(sys_get_temp_dir(), 'phpunit') . '.phar'; diff --git a/vendor/phpunit/phpunit/src/TextUI/TestRunner.php b/vendor/phpunit/phpunit/src/TextUI/TestRunner.php index 66df075847ee412e7e602a600eab20cff6e7e3a4..94909d98366ffeca9de74a5afb6505adfa5f2751 100644 --- a/vendor/phpunit/phpunit/src/TextUI/TestRunner.php +++ b/vendor/phpunit/phpunit/src/TextUI/TestRunner.php @@ -142,6 +142,10 @@ private function processSuiteFilters(PHPUnit_Framework_TestSuite $suite, array $ */ public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array()) { + if (isset($arguments['configuration'])) { + $GLOBALS['__PHPUNIT_CONFIGURATION_FILE'] = $arguments['configuration']; + } + $this->handleConfiguration($arguments); $this->processSuiteFilters($suite, $arguments); diff --git a/vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseMethod.tpl.dist b/vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseMethod.tpl.dist index ed90c9c24f83e11c89b671755545d52331eec598..e595099439aa17976b7ff4402af0355258b3695f 100644 --- a/vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseMethod.tpl.dist +++ b/vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseMethod.tpl.dist @@ -70,6 +70,13 @@ function __phpunit_run_isolated_test() ); } +$configurationFilePath = '{configurationFilePath}'; + +if ('' !== $configurationFilePath) { + $configuration = PHPUnit_Util_Configuration::getInstance($configurationFilePath); + $configuration->handlePHPConfiguration(); +} + {constants} {included_files} {globals} diff --git a/vendor/phpunit/phpunit/src/Util/Test.php b/vendor/phpunit/phpunit/src/Util/Test.php index 0912ce02cc2dcb94a1f6cab59c3f9f3cbe73f9cd..583bab9e1448fabd3ba83efc5217180b9caad903 100644 --- a/vendor/phpunit/phpunit/src/Util/Test.php +++ b/vendor/phpunit/phpunit/src/Util/Test.php @@ -147,6 +147,8 @@ private static function getLinesToBeCoveredOrUsed($className, $methodName, $mode } $element = preg_replace('/[\s()]+$/', '', $element); + $element = explode(' ', $element); + $element = $element[0]; $codeList = array_merge( $codeList, @@ -846,7 +848,9 @@ private static function resolveElementToReflectionObjects($element) { $codeToCoverList = array(); - if (strpos($element, '::') !== false) { + if (strpos($element, '\\') !== false && function_exists($element)) { + $codeToCoverList[] = new ReflectionFunction($element); + } else if (strpos($element, '::') !== false) { list($className, $methodName) = explode('::', $element); if (isset($methodName[0]) && $methodName[0] == '<') { diff --git a/vendor/phpunit/phpunit/src/Util/XML.php b/vendor/phpunit/phpunit/src/Util/XML.php index 16c4c0e6b589e2dd7f993f31e21f8a1b2517d769..552efe2aee719c1fc3fbe1c7329f27a7bb6208a9 100644 --- a/vendor/phpunit/phpunit/src/Util/XML.php +++ b/vendor/phpunit/phpunit/src/Util/XML.php @@ -100,7 +100,7 @@ public static function load($actual, $isHtml = false, $filename = '', $xinclude @chdir(dirname($filename)); } - $document = new DOMDocument; + $document = new DOMDocument; $document->preserveWhiteSpace = false; $internal = libxml_use_internal_errors(true); diff --git a/vendor/phpunit/phpunit/tests/Util/TestTest.php b/vendor/phpunit/phpunit/tests/Util/TestTest.php index 1ea947b80c64552493723f547e2b1bfa61a34ee6..0eb13faae2e276b4cfec7cea9a9d067afdf1118e 100644 --- a/vendor/phpunit/phpunit/tests/Util/TestTest.php +++ b/vendor/phpunit/phpunit/tests/Util/TestTest.php @@ -16,6 +16,9 @@ ); } +require TEST_FILES_PATH . 'CoverageNamespacedFunctionTest.php'; +require TEST_FILES_PATH . 'NamespaceCoveredFunction.php'; + /** * @since Class available since Release 3.3.6 */ @@ -545,6 +548,23 @@ public function testMethodParenthesesAreAllowedWithWhitespace() ); } + /** + * @covers PHPUnit_Util_Test::getLinesToBeCovered + * @covers PHPUnit_Util_Test::getLinesToBeCoveredOrUsed + */ + public function testNamespacedFunctionCanBeCoveredOrUsed() + { + $this->assertEquals( + array( + TEST_FILES_PATH . 'NamespaceCoveredFunction.php' => range(4, 7) + ), + PHPUnit_Util_Test::getLinesToBeCovered( + 'CoverageNamespacedFunctionTest', + 'testFunc' + ) + ); + } + public function getLinesToBeCoveredProvider() { return array( diff --git a/vendor/phpunit/phpunit/tests/_files/CoverageNamespacedFunctionTest.php b/vendor/phpunit/phpunit/tests/_files/CoverageNamespacedFunctionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..9fc056fa3700ed98a56e27e12671e8b460d1dece --- /dev/null +++ b/vendor/phpunit/phpunit/tests/_files/CoverageNamespacedFunctionTest.php @@ -0,0 +1,11 @@ + ### Note: testing versions prior to 2.4 +> +> This component originates with Zend Framework 2. During the lifetime of ZF2, +> testing infrastructure migrated from PHPUnit 3 to PHPUnit 4. In most cases, no +> changes were necessary. However, due to the migration, tests may not run on +> versions < 2.4. As such, you may need to change the PHPUnit dependency if +> attempting a fix on such a version. + +To run tests: + +- Clone the repository: + + ```console + $ git clone git@github.com:zendframework/zend-hydrator.git + $ cd + ``` + +- Install dependencies via composer: + + ```console + $ curl -sS https://getcomposer.org/installer | php -- + $ ./composer.phar install + ``` + + If you don't have `curl` installed, you can also download `composer.phar` from https://getcomposer.org/ + +- Run the tests via `phpunit` and the provided PHPUnit config, like in this example: + + ```console + $ ./vendor/bin/phpunit + ``` + +You can turn on conditional tests with the phpunit.xml file. +To do so: + + - Copy `phpunit.xml.dist` file to `phpunit.xml` + - Edit `phpunit.xml` to enable any specific functionality you + want to test, as well as to provide test values to utilize. + +## Running Coding Standards Checks + +This component uses [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) for coding +standards checks, and provides configuration for our selected checks. +`phpcs` is installed by default via Composer. + +To run checks only: + +```console +$ ./vendor/bin/phpcs +``` + +`phpcs` also provides a tool that can automatically fix many CS issues, +`phpcbf`: + +```console +$ ./vendor/bin/phpcbf +``` + +If you allow `phpcbf` to fix CS issues, please re-run the tests to ensure +they pass, and make sure you add and commit the changes after verification. + +## Recommended Workflow for Contributions + +Your first step is to establish a public repository from which we can +pull your work into the master repository. We recommend using +[GitHub](https://github.com), as that is where the component is already hosted. + +1. Setup a [GitHub account](http://github.com/), if you haven't yet +2. Fork the repository (http://github.com/zendframework/zend-hydrator) +3. Clone the canonical repository locally and enter it. + + ```console + $ git clone git://github.com:zendframework/zend-hydrator.git + $ cd zend-hydrator + ``` + +4. Add a remote to your fork; substitute your GitHub username in the command + below. + + ```console + $ git remote add {username} git@github.com:{username}/zend-hydrator.git + $ git fetch {username} + ``` + +### Keeping Up-to-Date + +Periodically, you should update your fork or personal repository to +match the canonical ZF repository. Assuming you have setup your local repository +per the instructions above, you can do the following: + + +```console +$ git checkout master +$ git fetch origin +$ git rebase origin/master +# OPTIONALLY, to keep your remote up-to-date - +$ git push {username} master:master +``` + +If you're tracking other branches -- for example, the "develop" branch, where +new feature development occurs -- you'll want to do the same operations for that +branch; simply substitute "develop" for "master". + +### Working on a patch + +We recommend you do each new feature or bugfix in a new branch. This simplifies +the task of code review as well as the task of merging your changes into the +canonical repository. + +A typical workflow will then consist of the following: + +1. Create a new local branch based off either your master or develop branch. +2. Switch to your new local branch. (This step can be combined with the + previous step with the use of `git checkout -b`.) +3. Do some work, commit, repeat as necessary. +4. Push the local branch to your remote repository. +5. Send a pull request. + +The mechanics of this process are actually quite trivial. Below, we will +create a branch for fixing an issue in the tracker. + +```console +$ git checkout -b hotfix/9295 +Switched to a new branch 'hotfix/9295' +``` + +... do some work ... + + +```console +$ git commit +``` + +... write your log message ... + + +```console +$ git push {username} hotfix/9295:hotfix/9295 +Counting objects: 38, done. +Delta compression using up to 2 threads. +Compression objects: 100% (18/18), done. +Writing objects: 100% (20/20), 8.19KiB, done. +Total 20 (delta 12), reused 0 (delta 0) +To ssh://git@github.com/{username}/zend-hydrator.git + b5583aa..4f51698 HEAD -> master +``` + +To send a pull request, you have two options. + +If using GitHub, you can do the pull request from there. Navigate to +your repository, select the branch you just created, and then select the +"Pull Request" button in the upper right. Select the user/organization +"zendframework" as the recipient. + +If using your own repository - or even if using GitHub - you can use `git +format-patch` to create a patchset for us to apply; in fact, this is +**recommended** for security-related patches. If you use `format-patch`, please +send the patches as attachments to: + +- zf-devteam@zend.com for patches without security implications +- zf-security@zend.com for security patches + +#### What branch to issue the pull request against? + +Which branch should you issue a pull request against? + +- For fixes against the stable release, issue the pull request against the + "master" branch. +- For new features, or fixes that introduce new elements to the public API (such + as new public methods or properties), issue the pull request against the + "develop" branch. + +### Branch Cleanup + +As you might imagine, if you are a frequent contributor, you'll start to +get a ton of branches both locally and on your remote. + +Once you know that your changes have been accepted to the master +repository, we suggest doing some cleanup of these branches. + +- Local branch cleanup + + ```console + $ git branch -d + ``` + +- Remote branch removal + + ```console + $ git push {username} : + ``` diff --git a/vendor/zendframework/zend-hydrator/LICENSE.md b/vendor/zendframework/zend-hydrator/LICENSE.md new file mode 100644 index 0000000000000000000000000000000000000000..dbb1b49c01421e18478507a9ef40b8087317c306 --- /dev/null +++ b/vendor/zendframework/zend-hydrator/LICENSE.md @@ -0,0 +1,28 @@ +Copyright (c) 2005-2015, Zend Technologies USA, Inc. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +- Neither the name of Zend Technologies USA, Inc. nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/zendframework/zend-hydrator/README.md b/vendor/zendframework/zend-hydrator/README.md new file mode 100644 index 0000000000000000000000000000000000000000..76083347b56e83332d052f72d0bf840e31fc48de --- /dev/null +++ b/vendor/zendframework/zend-hydrator/README.md @@ -0,0 +1,11 @@ +# zend-hydrator + +[![Build Status](https://secure.travis-ci.org/zendframework/zend-hydrator.svg?branch=master)](https://secure.travis-ci.org/zendframework/zend-hydrator) +[![Coverage Status](https://coveralls.io/repos/zendframework/zend-hydrator/badge.svg?branch=master)](https://coveralls.io/r/zendframework/zend-hydrator?branch=master) + +`Zend\Hydrator` provides utilities for mapping arrays to objects, and vice +versa, including facilities for filtering which data is mapped as well as +providing mechanisms for mapping nested structures. + +- File issues at https://github.com/zendframework/zend-hydrator/issues +- Documentation is at http://framework.zend.com/manual/current/en/index.html#zend-stdlib diff --git a/vendor/zendframework/zend-hydrator/composer.json b/vendor/zendframework/zend-hydrator/composer.json new file mode 100644 index 0000000000000000000000000000000000000000..21b4afe016515f3f5d80113d8cb50ad6efc841a3 --- /dev/null +++ b/vendor/zendframework/zend-hydrator/composer.json @@ -0,0 +1,47 @@ +{ + "name": "zendframework/zend-hydrator", + "description": " ", + "license": "BSD-3-Clause", + "keywords": [ + "zf2", + "hydrator" + ], + "homepage": "https://github.com/zendframework/zend-hydrator", + "autoload": { + "psr-4": { + "Zend\\Hydrator\\": "src/" + } + }, + "require": { + "php": ">=5.5", + "zendframework/zend-stdlib": "^2.5.1" + }, + "require-dev": { + "zendframework/zend-eventmanager": "^2.5.1", + "zendframework/zend-inputfilter": "^2.5.1", + "zendframework/zend-serializer": "^2.5.1", + "zendframework/zend-servicemanager": "^2.5.1", + "zendframework/zend-filter": "^2.5.1", + "phpunit/PHPUnit": "~4.0", + "squizlabs/php_codesniffer": "^2.0@dev" + }, + "suggest": { + "zendframework/zend-eventmanager": "^2.5.1, to support aggregate hydrator usage", + "zendframework/zend-serializer": "^2.5.1, to use the SerializableStrategy", + "zendframework/zend-servicemanager": "^2.5.1, to support hydrator plugin manager usage", + "zendframework/zend-filter": "^2.5.1, to support naming strategy hydrator usage" + }, + "minimum-stability": "dev", + "prefer-stable": true, + "extra": { + "branch-alias": { + "dev-master": "1.0-dev", + "dev-develop": "1.1-dev" + } + }, + "autoload-dev": { + "psr-4": { + "ZendTest\\Hydrator\\": "test/" + } + } +} diff --git a/vendor/zendframework/zend-hydrator/phpcs.xml b/vendor/zendframework/zend-hydrator/phpcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..e994eae100881b24d867459bc9b582c1cd7051a0 --- /dev/null +++ b/vendor/zendframework/zend-hydrator/phpcs.xml @@ -0,0 +1,21 @@ + + + Zend Framework coding standard + + + + + + + + + + + + + + + + src + test + diff --git a/vendor/zendframework/zend-hydrator/src/AbstractHydrator.php b/vendor/zendframework/zend-hydrator/src/AbstractHydrator.php new file mode 100644 index 0000000000000000000000000000000000000000..6f3f0a904066f624f1616e172f666d991bbb883f --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/AbstractHydrator.php @@ -0,0 +1,283 @@ +strategies = new ArrayObject(); + $this->filterComposite = new Filter\FilterComposite(); + } + + /** + * Gets the strategy with the given name. + * + * @param string $name The name of the strategy to get. + * + * @throws Exception\InvalidArgumentException + * @return Strategy\StrategyInterface + */ + public function getStrategy($name) + { + if (isset($this->strategies[$name])) { + return $this->strategies[$name]; + } + + if (!isset($this->strategies['*'])) { + throw new Exception\InvalidArgumentException(sprintf( + '%s: no strategy by name of "%s", and no wildcard strategy present', + __METHOD__, + $name + )); + } + + return $this->strategies['*']; + } + + /** + * Checks if the strategy with the given name exists. + * + * @param string $name The name of the strategy to check for. + * @return bool + */ + public function hasStrategy($name) + { + return array_key_exists($name, $this->strategies) + || array_key_exists('*', $this->strategies); + } + + /** + * Adds the given strategy under the given name. + * + * @param string $name The name of the strategy to register. + * @param Strategy\StrategyInterface $strategy The strategy to register. + * @return HydratorInterface + */ + public function addStrategy($name, Strategy\StrategyInterface $strategy) + { + $this->strategies[$name] = $strategy; + return $this; + } + + /** + * Removes the strategy with the given name. + * + * @param string $name The name of the strategy to remove. + * @return HydratorInterface + */ + public function removeStrategy($name) + { + unset($this->strategies[$name]); + return $this; + } + + /** + * Converts a value for extraction. If no strategy exists the plain value is returned. + * + * @param string $name The name of the strategy to use. + * @param mixed $value The value that should be converted. + * @param mixed $object The object is optionally provided as context. + * @return mixed + */ + public function extractValue($name, $value, $object = null) + { + if ($this->hasStrategy($name)) { + $strategy = $this->getStrategy($name); + $value = $strategy->extract($value, $object); + } + return $value; + } + + /** + * Converts a value for hydration. If no strategy exists the plain value is returned. + * + * @param string $name The name of the strategy to use. + * @param mixed $value The value that should be converted. + * @param array $data The whole data is optionally provided as context. + * @return mixed + */ + public function hydrateValue($name, $value, $data = null) + { + if ($this->hasStrategy($name)) { + $strategy = $this->getStrategy($name); + $value = $strategy->hydrate($value, $data); + } + return $value; + } + + /** + * Convert a name for extraction. If no naming strategy exists, the plain value is returned. + * + * @param string $name The name to convert. + * @param null $object The object is optionally provided as context. + * @return mixed + */ + public function extractName($name, $object = null) + { + if ($this->hasNamingStrategy()) { + $name = $this->getNamingStrategy()->extract($name, $object); + } + return $name; + } + + /** + * Converts a value for hydration. If no naming strategy exists, the plain value is returned. + * + * @param string $name The name to convert. + * @param array $data The whole data is optionally provided as context. + * @return mixed + */ + public function hydrateName($name, $data = null) + { + if ($this->hasNamingStrategy()) { + $name = $this->getNamingStrategy()->hydrate($name, $data); + } + return $name; + } + + /** + * Get the filter instance + * + * @return Filter\FilterComposite + */ + public function getFilter() + { + return $this->filterComposite; + } + + /** + * Add a new filter to take care of what needs to be hydrated. + * To exclude e.g. the method getServiceLocator: + * + * + * $composite->addFilter("servicelocator", + * function ($property) { + * list($class, $method) = explode('::', $property); + * if ($method === 'getServiceLocator') { + * return false; + * } + * return true; + * }, FilterComposite::CONDITION_AND + * ); + * + * + * @param string $name Index in the composite + * @param callable|Filter\FilterInterface $filter + * @param int $condition + * @return Filter\FilterComposite + */ + public function addFilter($name, $filter, $condition = Filter\FilterComposite::CONDITION_OR) + { + return $this->filterComposite->addFilter($name, $filter, $condition); + } + + /** + * Check whether a specific filter exists at key $name or not + * + * @param string $name Index in the composite + * @return bool + */ + public function hasFilter($name) + { + return $this->filterComposite->hasFilter($name); + } + + /** + * Remove a filter from the composition. + * To not extract "has" methods, you simply need to unregister it + * + * + * $filterComposite->removeFilter('has'); + * + * + * @param $name + * @return Filter\FilterComposite + */ + public function removeFilter($name) + { + return $this->filterComposite->removeFilter($name); + } + + /** + * Adds the given naming strategy + * + * @param NamingStrategy\NamingStrategyInterface $strategy The naming to register. + * @return self + */ + public function setNamingStrategy(NamingStrategy\NamingStrategyInterface $strategy) + { + $this->namingStrategy = $strategy; + + return $this; + } + + /** + * Gets the naming strategy. + * + * @return NamingStrategy\NamingStrategyInterface + */ + public function getNamingStrategy() + { + return $this->namingStrategy; + } + + /** + * Checks if a naming strategy exists. + * + * @return bool + */ + public function hasNamingStrategy() + { + return isset($this->namingStrategy); + } + + /** + * Removes the naming strategy + * + * @return self + */ + public function removeNamingStrategy() + { + $this->namingStrategy = null; + + return $this; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/Aggregate/AggregateHydrator.php b/vendor/zendframework/zend-hydrator/src/Aggregate/AggregateHydrator.php new file mode 100644 index 0000000000000000000000000000000000000000..fa384adbda0c38793ecf9f6869fefe73ddb83479 --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/Aggregate/AggregateHydrator.php @@ -0,0 +1,85 @@ +getEventManager()->attachAggregate(new HydratorListener($hydrator), $priority); + } + + /** + * {@inheritDoc} + */ + public function extract($object) + { + $event = new ExtractEvent($this, $object); + + $this->getEventManager()->trigger($event); + + return $event->getExtractedData(); + } + + /** + * {@inheritDoc} + */ + public function hydrate(array $data, $object) + { + $event = new HydrateEvent($this, $object, $data); + + $this->getEventManager()->trigger($event); + + return $event->getHydratedObject(); + } + + /** + * {@inheritDoc} + */ + public function setEventManager(EventManagerInterface $eventManager) + { + $eventManager->setIdentifiers([__CLASS__, get_class($this)]); + + $this->eventManager = $eventManager; + } + + /** + * {@inheritDoc} + */ + public function getEventManager() + { + if (null === $this->eventManager) { + $this->setEventManager(new EventManager()); + } + + return $this->eventManager; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/Aggregate/ExtractEvent.php b/vendor/zendframework/zend-hydrator/src/Aggregate/ExtractEvent.php new file mode 100644 index 0000000000000000000000000000000000000000..13959175a86137270a64076d5ccab9c119e4f0ee --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/Aggregate/ExtractEvent.php @@ -0,0 +1,98 @@ +target = $target; + $this->extractionObject = $extractionObject; + } + + /** + * Retrieves the object from which data is extracted + * + * @return object + */ + public function getExtractionObject() + { + return $this->extractionObject; + } + + /** + * @param object $extractionObject + * + * @return void + */ + public function setExtractionObject($extractionObject) + { + $this->extractionObject = $extractionObject; + } + + /** + * Retrieves the data that has been extracted + * + * @return array + */ + public function getExtractedData() + { + return $this->extractedData; + } + + /** + * @param array $extractedData + * + * @return void + */ + public function setExtractedData(array $extractedData) + { + $this->extractedData = $extractedData; + } + + /** + * Merge provided data with the extracted data + * + * @param array $additionalData + * + * @return void + */ + public function mergeExtractedData(array $additionalData) + { + $this->extractedData = array_merge($this->extractedData, $additionalData); + } +} diff --git a/vendor/zendframework/zend-hydrator/src/Aggregate/HydrateEvent.php b/vendor/zendframework/zend-hydrator/src/Aggregate/HydrateEvent.php new file mode 100644 index 0000000000000000000000000000000000000000..7865964d701fb01234cd97920b069d22bfdf1ee2 --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/Aggregate/HydrateEvent.php @@ -0,0 +1,84 @@ +target = $target; + $this->hydratedObject = $hydratedObject; + $this->hydrationData = $hydrationData; + } + + /** + * Retrieves the object that is being hydrated + * + * @return object + */ + public function getHydratedObject() + { + return $this->hydratedObject; + } + + /** + * @param object $hydratedObject + */ + public function setHydratedObject($hydratedObject) + { + $this->hydratedObject = $hydratedObject; + } + + /** + * Retrieves the data that is being used for hydration + * + * @return array + */ + public function getHydrationData() + { + return $this->hydrationData; + } + + /** + * @param array $hydrationData + */ + public function setHydrationData(array $hydrationData) + { + $this->hydrationData = $hydrationData; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/Aggregate/HydratorListener.php b/vendor/zendframework/zend-hydrator/src/Aggregate/HydratorListener.php new file mode 100644 index 0000000000000000000000000000000000000000..c8260a43c5489d11b878eba5b2e2c8f9e82b3337 --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/Aggregate/HydratorListener.php @@ -0,0 +1,72 @@ +hydrator = $hydrator; + } + + /** + * {@inheritDoc} + */ + public function attach(EventManagerInterface $events, $priority = 1) + { + $this->listeners[] = $events->attach(HydrateEvent::EVENT_HYDRATE, [$this, 'onHydrate'], $priority); + $this->listeners[] = $events->attach(ExtractEvent::EVENT_EXTRACT, [$this, 'onExtract'], $priority); + } + + /** + * Callback to be used when {@see HydrateEvent::EVENT_HYDRATE} is triggered + * + * @param HydrateEvent $event + * @return object + * @internal + */ + public function onHydrate(HydrateEvent $event) + { + $object = $this->hydrator->hydrate($event->getHydrationData(), $event->getHydratedObject()); + $event->setHydratedObject($object); + return $object; + } + + /** + * Callback to be used when {@see ExtractEvent::EVENT_EXTRACT} is triggered + * + * @param ExtractEvent $event + * @return array + * @internal + */ + public function onExtract(ExtractEvent $event) + { + $data = $this->hydrator->extract($event->getExtractionObject()); + $event->mergeExtractedData($data); + return $data; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/ArraySerializable.php b/vendor/zendframework/zend-hydrator/src/ArraySerializable.php new file mode 100644 index 0000000000000000000000000000000000000000..24edee5c2ed71cdde699428967eb469dc955a6db --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/ArraySerializable.php @@ -0,0 +1,81 @@ +getArrayCopy(); + $filter = $this->getFilter(); + + foreach ($data as $name => $value) { + if (!$filter->filter($name)) { + unset($data[$name]); + continue; + } + $extractedName = $this->extractName($name, $object); + // replace the original key with extracted, if differ + if ($extractedName !== $name) { + unset($data[$name]); + $name = $extractedName; + } + $data[$name] = $this->extractValue($name, $value, $object); + } + + return $data; + } + + /** + * Hydrate an object + * + * Hydrates an object by passing $data to either its exchangeArray() or + * populate() method. + * + * @param array $data + * @param object $object + * @return object + * @throws Exception\BadMethodCallException for an $object not implementing exchangeArray() or populate() + */ + public function hydrate(array $data, $object) + { + $replacement = []; + foreach ($data as $key => $value) { + $name = $this->hydrateName($key, $data); + $replacement[$name] = $this->hydrateValue($name, $value, $data); + } + + if (is_callable([$object, 'exchangeArray'])) { + $object->exchangeArray($replacement); + } elseif (is_callable([$object, 'populate'])) { + $object->populate($replacement); + } else { + throw new Exception\BadMethodCallException( + sprintf('%s expects the provided object to implement exchangeArray() or populate()', __METHOD__) + ); + } + return $object; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/ClassMethods.php b/vendor/zendframework/zend-hydrator/src/ClassMethods.php new file mode 100644 index 0000000000000000000000000000000000000000..80cce848284ddc249899360e86b87f09251d664c --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/ClassMethods.php @@ -0,0 +1,268 @@ +setUnderscoreSeparatedKeys($underscoreSeparatedKeys); + + $this->callableMethodFilter = new Filter\OptionalParametersFilter(); + + $this->filterComposite->addFilter('is', new Filter\IsFilter()); + $this->filterComposite->addFilter('has', new Filter\HasFilter()); + $this->filterComposite->addFilter('get', new Filter\GetFilter()); + $this->filterComposite->addFilter( + 'parameter', + new Filter\OptionalParametersFilter(), + Filter\FilterComposite::CONDITION_AND + ); + } + + /** + * @param array|Traversable $options + * @return ClassMethods + * @throws Exception\InvalidArgumentException + */ + public function setOptions($options) + { + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } elseif (!is_array($options)) { + throw new Exception\InvalidArgumentException( + 'The options parameter must be an array or a Traversable' + ); + } + if (isset($options['underscoreSeparatedKeys'])) { + $this->setUnderscoreSeparatedKeys($options['underscoreSeparatedKeys']); + } + + return $this; + } + + /** + * @param bool $underscoreSeparatedKeys + * @return ClassMethods + */ + public function setUnderscoreSeparatedKeys($underscoreSeparatedKeys) + { + $this->underscoreSeparatedKeys = (bool) $underscoreSeparatedKeys; + + if ($this->underscoreSeparatedKeys) { + $this->setNamingStrategy(new NamingStrategy\UnderscoreNamingStrategy); + } elseif ($this->getNamingStrategy() instanceof NamingStrategy\UnderscoreNamingStrategy) { + $this->removeNamingStrategy(); + } + + return $this; + } + + /** + * @return bool + */ + public function getUnderscoreSeparatedKeys() + { + return $this->underscoreSeparatedKeys; + } + + /** + * Extract values from an object with class methods + * + * Extracts the getter/setter of the given $object. + * + * @param object $object + * @return array + * @throws Exception\BadMethodCallException for a non-object $object + */ + public function extract($object) + { + if (!is_object($object)) { + throw new Exception\BadMethodCallException(sprintf( + '%s expects the provided $object to be a PHP object)', + __METHOD__ + )); + } + + $objectClass = get_class($object); + + // reset the hydrator's hydrator's cache for this object, as the filter may be per-instance + if ($object instanceof Filter\FilterProviderInterface) { + $this->extractionMethodsCache[$objectClass] = null; + } + + // pass 1 - finding out which properties can be extracted, with which methods (populate hydration cache) + if (! isset($this->extractionMethodsCache[$objectClass])) { + $this->extractionMethodsCache[$objectClass] = []; + $filter = $this->filterComposite; + $methods = get_class_methods($object); + + if ($object instanceof Filter\FilterProviderInterface) { + $filter = new Filter\FilterComposite( + [$object->getFilter()], + [new Filter\MethodMatchFilter('getFilter')] + ); + } + + foreach ($methods as $method) { + $methodFqn = $objectClass . '::' . $method; + + if (! ($filter->filter($methodFqn) && $this->callableMethodFilter->filter($methodFqn))) { + continue; + } + + $attribute = $method; + + if (strpos($method, 'get') === 0) { + $attribute = substr($method, 3); + if (!property_exists($object, $attribute)) { + $attribute = lcfirst($attribute); + } + } + + $this->extractionMethodsCache[$objectClass][$method] = $attribute; + } + } + + $values = []; + + // pass 2 - actually extract data + foreach ($this->extractionMethodsCache[$objectClass] as $methodName => $attributeName) { + $realAttributeName = $this->extractName($attributeName, $object); + $values[$realAttributeName] = $this->extractValue($realAttributeName, $object->$methodName(), $object); + } + + return $values; + } + + /** + * Hydrate an object by populating getter/setter methods + * + * Hydrates an object by getter/setter methods of the object. + * + * @param array $data + * @param object $object + * @return object + * @throws Exception\BadMethodCallException for a non-object $object + */ + public function hydrate(array $data, $object) + { + if (!is_object($object)) { + throw new Exception\BadMethodCallException(sprintf( + '%s expects the provided $object to be a PHP object)', + __METHOD__ + )); + } + + $objectClass = get_class($object); + + foreach ($data as $property => $value) { + $propertyFqn = $objectClass . '::$' . $property; + + if (! isset($this->hydrationMethodsCache[$propertyFqn])) { + $setterName = 'set' . ucfirst($this->hydrateName($property, $data)); + + $this->hydrationMethodsCache[$propertyFqn] = is_callable([$object, $setterName]) + ? $setterName + : false; + } + + if ($this->hydrationMethodsCache[$propertyFqn]) { + $object->{$this->hydrationMethodsCache[$propertyFqn]}($this->hydrateValue($property, $value, $data)); + } + } + + return $object; + } + + /** + * {@inheritDoc} + */ + public function addFilter($name, $filter, $condition = Filter\FilterComposite::CONDITION_OR) + { + $this->resetCaches(); + + return parent::addFilter($name, $filter, $condition); + } + + /** + * {@inheritDoc} + */ + public function removeFilter($name) + { + $this->resetCaches(); + + return parent::removeFilter($name); + } + + /** + * {@inheritDoc} + */ + public function setNamingStrategy(NamingStrategy\NamingStrategyInterface $strategy) + { + $this->resetCaches(); + + return parent::setNamingStrategy($strategy); + } + + /** + * {@inheritDoc} + */ + public function removeNamingStrategy() + { + $this->resetCaches(); + + return parent::removeNamingStrategy(); + } + + /** + * Reset all local hydration/extraction caches + */ + private function resetCaches() + { + $this->hydrationMethodsCache = $this->extractionMethodsCache = []; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/DelegatingHydrator.php b/vendor/zendframework/zend-hydrator/src/DelegatingHydrator.php new file mode 100644 index 0000000000000000000000000000000000000000..a6f3f9472f8d8016d72e3480cd905ff20b421432 --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/DelegatingHydrator.php @@ -0,0 +1,57 @@ +hydrators = $hydrators; + } + + /** + * {@inheritdoc} + */ + public function hydrate(array $data, $object) + { + return $this->getHydrator($object)->hydrate($data, $object); + } + + /** + * {@inheritdoc} + */ + public function extract($object) + { + return $this->getHydrator($object)->extract($object); + } + + /** + * Gets hydrator of an object + * + * @param object $object + * @return HydratorInterface + */ + protected function getHydrator($object) + { + return $this->hydrators->get(get_class($object)); + } +} diff --git a/vendor/zendframework/zend-hydrator/src/DelegatingHydratorFactory.php b/vendor/zendframework/zend-hydrator/src/DelegatingHydratorFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..89f284179b7a33935531bcc97d6b26cb69abc14d --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/DelegatingHydratorFactory.php @@ -0,0 +1,29 @@ +orFilter = new ArrayObject($orFilter); + $this->andFilter = new ArrayObject($andFilter); + } + + /** + * Add a filter to the composite. Has to be indexed with $name in + * order to identify a specific filter. + * + * This example will exclude all methods from the hydration, that starts with 'getService' + * + * $composite->addFilter('exclude', + * function ($method) { + * if (preg_match('/^getService/', $method) { + * return false; + * } + * return true; + * }, FilterComposite::CONDITION_AND + * ); + * + * + * @param string $name + * @param callable|FilterInterface $filter + * @param int $condition Can be either + * FilterComposite::CONDITION_OR or FilterComposite::CONDITION_AND + * @throws InvalidArgumentException + * @return FilterComposite + */ + public function addFilter($name, $filter, $condition = self::CONDITION_OR) + { + if (!is_callable($filter) && !($filter instanceof FilterInterface)) { + throw new InvalidArgumentException( + 'The value of ' . $name . ' should be either a callable or ' . + 'an instance of Zend\Stdlib\Hydrator\Filter\FilterInterface' + ); + } + + if ($condition === self::CONDITION_OR) { + $this->orFilter[$name] = $filter; + } elseif ($condition === self::CONDITION_AND) { + $this->andFilter[$name] = $filter; + } + + return $this; + } + + /** + * Remove a filter from the composition + * + * @param $name string Identifier for the filter + * @return FilterComposite + */ + public function removeFilter($name) + { + if (isset($this->orFilter[$name])) { + unset($this->orFilter[$name]); + } + + if (isset($this->andFilter[$name])) { + unset($this->andFilter[$name]); + } + + return $this; + } + + /** + * Check if $name has a filter registered + * + * @param $name string Identifier for the filter + * @return bool + */ + public function hasFilter($name) + { + return isset($this->orFilter[$name]) || isset($this->andFilter[$name]); + } + + /** + * Filter the composite based on the AND and OR condition + * Will return true if one from the "or conditions" and all from + * the "and condition" returns true. Otherwise false + * + * @param $property string Parameter will be e.g. Parent\Namespace\Class::method + * @return bool + */ + public function filter($property) + { + $andCount = count($this->andFilter); + $orCount = count($this->orFilter); + // return true if no filters are registered + if ($orCount === 0 && $andCount === 0) { + return true; + } elseif ($orCount === 0 && $andCount !== 0) { + $returnValue = true; + } else { + $returnValue = false; + } + + // Check if 1 from the or filters return true + foreach ($this->orFilter as $filter) { + if (is_callable($filter)) { + if ($filter($property) === true) { + $returnValue = true; + break; + } + continue; + } else { + if ($filter->filter($property) === true) { + $returnValue = true; + break; + } + } + } + + // Check if all of the and condition return true + foreach ($this->andFilter as $filter) { + if (is_callable($filter)) { + if ($filter($property) === false) { + return false; + } + continue; + } else { + if ($filter->filter($property) === false) { + return false; + } + } + } + + return $returnValue; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/Filter/FilterInterface.php b/vendor/zendframework/zend-hydrator/src/Filter/FilterInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..fb49918f27274e28f95c289b2ebb8fcaf069d47d --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/Filter/FilterInterface.php @@ -0,0 +1,22 @@ +method = $method; + $this->exclude = $exclude; + } + + public function filter($property) + { + $pos = strpos($property, '::'); + if ($pos !== false) { + $pos += 2; + } else { + $pos = 0; + } + if (substr($property, $pos) === $this->method) { + return !$this->exclude; + } + return $this->exclude; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/Filter/NumberOfParameterFilter.php b/vendor/zendframework/zend-hydrator/src/Filter/NumberOfParameterFilter.php new file mode 100644 index 0000000000000000000000000000000000000000..abd8ee67c0e024e3a5a51b49e3bcb68cb91b98e1 --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/Filter/NumberOfParameterFilter.php @@ -0,0 +1,49 @@ +numberOfParameters = (int) $numberOfParameters; + } + + /** + * @param string $property the name of the property + * @return bool + * @throws InvalidArgumentException + */ + public function filter($property) + { + try { + $reflectionMethod = new ReflectionMethod($property); + } catch (ReflectionException $exception) { + throw new InvalidArgumentException( + "Method $property doesn't exist" + ); + } + + return $reflectionMethod->getNumberOfParameters() === $this->numberOfParameters; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/Filter/OptionalParametersFilter.php b/vendor/zendframework/zend-hydrator/src/Filter/OptionalParametersFilter.php new file mode 100644 index 0000000000000000000000000000000000000000..25775d7e58c42bf90533e0b8d1c70a3fefb63a09 --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/Filter/OptionalParametersFilter.php @@ -0,0 +1,55 @@ +getParameters(), + function (ReflectionParameter $parameter) { + return ! $parameter->isOptional(); + } + ); + + return static::$propertiesCache[$property] = empty($mandatoryParameters); + } +} diff --git a/vendor/zendframework/zend-hydrator/src/FilterEnabledInterface.php b/vendor/zendframework/zend-hydrator/src/FilterEnabledInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..f95f8b4b91e4b329da827b30d9d6501059189567 --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/FilterEnabledInterface.php @@ -0,0 +1,59 @@ + + * $composite->addFilter( + * "servicelocator", + * function ($property) { + * list($class, $method) = explode('::', $property); + * if ($method === 'getServiceLocator') { + * return false; + * } + * return true; + * }, + * FilterComposite::CONDITION_AND + * ); + * + * + * @param string $name Index in the composite + * @param callable|Filter\FilterInterface $filter + * @param int $condition + * @return Filter\FilterComposite + */ + public function addFilter($name, $filter, $condition = Filter\FilterComposite::CONDITION_OR); + + /** + * Check whether a specific filter exists at key $name or not + * + * @param string $name Index in the composite + * @return bool + */ + public function hasFilter($name); + + /** + * Remove a filter from the composition. + * To not extract "has" methods, you simply need to unregister it + * + * + * $filterComposite->removeFilter('has'); + * + * + * @param $name + * @return Filter\FilterComposite + */ + public function removeFilter($name); +} diff --git a/vendor/zendframework/zend-hydrator/src/HydrationInterface.php b/vendor/zendframework/zend-hydrator/src/HydrationInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..ca28983483f7b382802fee23d2b94965c9db2aba --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/HydrationInterface.php @@ -0,0 +1,22 @@ +hydrator = $hydrator; + + return $this; + } + + /** + * Retrieve hydrator + * + * @param void + * @return null|HydratorInterface + * @access public + */ + public function getHydrator() + { + return $this->hydrator; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/HydratorInterface.php b/vendor/zendframework/zend-hydrator/src/HydratorInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..a48effa8cc8e29fdcb9e03dcd8fcc4b3607e9bac --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/HydratorInterface.php @@ -0,0 +1,14 @@ + 'Zend\Hydrator\DelegatingHydrator', + ]; + + /** + * Default set of adapters + * + * @var array + */ + protected $invokableClasses = [ + 'arrayserializable' => 'Zend\Hydrator\ArraySerializable', + 'classmethods' => 'Zend\Hydrator\ClassMethods', + 'objectproperty' => 'Zend\Hydrator\ObjectProperty', + 'reflection' => 'Zend\Hydrator\Reflection' + ]; + + /** + * Default factory-based adapters + * + * @var array + */ + protected $factories = [ + 'Zend\Hydrator\DelegatingHydrator' => 'Zend\Hydrator\DelegatingHydratorFactory', + ]; + + /** + * {@inheritDoc} + */ + public function validatePlugin($plugin) + { + if ($plugin instanceof HydratorInterface) { + // we're okay + return; + } + + throw new Exception\RuntimeException(sprintf( + 'Plugin of type %s is invalid; must implement Zend\Hydrator\HydratorInterface', + (is_object($plugin) ? get_class($plugin) : gettype($plugin)) + )); + } +} diff --git a/vendor/zendframework/zend-hydrator/src/Iterator/HydratingArrayIterator.php b/vendor/zendframework/zend-hydrator/src/Iterator/HydratingArrayIterator.php new file mode 100644 index 0000000000000000000000000000000000000000..8e14f035f067b312fa8ae4158724d00fc19c1dd3 --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/Iterator/HydratingArrayIterator.php @@ -0,0 +1,36 @@ +setHydrator($hydrator); + $this->setPrototype($prototype); + parent::__construct($data); + } + + /** + * @inheritdoc + */ + public function setPrototype($prototype) + { + if (is_object($prototype)) { + $this->prototype = $prototype; + return; + } + + if (!class_exists($prototype)) { + throw new InvalidArgumentException( + sprintf('Method %s was passed an invalid class name: %s', __METHOD__, $prototype) + ); + } + + $this->prototype = new $prototype; + } + + /** + * @inheritdoc + */ + public function setHydrator(HydratorInterface $hydrator) + { + $this->hydrator = $hydrator; + } + + /** + * @return object Returns hydrated clone of $prototype + */ + public function current() + { + $currentValue = parent::current(); + $object = clone $this->prototype; + $this->hydrator->hydrate($currentValue, $object); + return $object; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/NamingStrategy/ArrayMapNamingStrategy.php b/vendor/zendframework/zend-hydrator/src/NamingStrategy/ArrayMapNamingStrategy.php new file mode 100644 index 0000000000000000000000000000000000000000..c6333e2dcc614e11049b85d8449314bfb16b06ed --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/NamingStrategy/ArrayMapNamingStrategy.php @@ -0,0 +1,51 @@ +extractionMap = $extractionMap; + $this->hydrationMap = array_flip($extractionMap); + } + + /** + * {@inheritDoc} + */ + public function hydrate($name) + { + return isset($this->hydrationMap[$name]) ? $this->hydrationMap[$name] : $name; + } + + /** + * {@inheritDoc} + */ + public function extract($name) + { + return isset($this->extractionMap[$name]) ? $this->extractionMap[$name] : $name; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/NamingStrategy/CompositeNamingStrategy.php b/vendor/zendframework/zend-hydrator/src/NamingStrategy/CompositeNamingStrategy.php new file mode 100644 index 0000000000000000000000000000000000000000..c2bae8c29fe3a975d0f48fab753c1961ef8799c5 --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/NamingStrategy/CompositeNamingStrategy.php @@ -0,0 +1,64 @@ +namingStrategies = array_map( + function (NamingStrategyInterface $strategy) { + // this callback is here only to ensure type-safety + return $strategy; + }, + $strategies + ); + + $this->defaultNamingStrategy = $defaultNamingStrategy ?: new IdentityNamingStrategy(); + } + + /** + * {@inheritDoc} + */ + public function extract($name) + { + $strategy = isset($this->namingStrategies[$name]) + ? $this->namingStrategies[$name] + : $this->defaultNamingStrategy; + + return $strategy->extract($name); + } + + /** + * {@inheritDoc} + */ + public function hydrate($name) + { + $strategy = isset($this->namingStrategies[$name]) + ? $this->namingStrategies[$name] + : $this->defaultNamingStrategy; + + return $strategy->hydrate($name); + } +} diff --git a/vendor/zendframework/zend-hydrator/src/NamingStrategy/IdentityNamingStrategy.php b/vendor/zendframework/zend-hydrator/src/NamingStrategy/IdentityNamingStrategy.php new file mode 100644 index 0000000000000000000000000000000000000000..59e3feda5f76a66632e6b6d6e3d2ea3883ac4a3c --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/NamingStrategy/IdentityNamingStrategy.php @@ -0,0 +1,29 @@ +mapping = $mapping; + $this->reverse = $reverse ?: $this->flipMapping($mapping); + } + + /** + * Safelly flip mapping array. + * + * @param array $array Array to flip + * @return array Flipped array + * @throws InvalidArgumentException + */ + protected function flipMapping(array $array) + { + array_walk($array, function ($value) { + if (!is_string($value) && !is_int($value)) { + throw new InvalidArgumentException('Mapping array can\'t be flipped because of invalid value'); + } + }); + + return array_flip($array); + } + + /** + * Converts the given name so that it can be extracted by the hydrator. + * + * @param string $name The original name + * @return mixed The hydrated name + */ + public function hydrate($name) + { + if (array_key_exists($name, $this->mapping)) { + return $this->mapping[$name]; + } + + return $name; + } + + /** + * Converts the given name so that it can be hydrated by the hydrator. + * + * @param string $name The original name + * @return mixed The extracted name + */ + public function extract($name) + { + if (array_key_exists($name, $this->reverse)) { + return $this->reverse[$name]; + } + + return $name; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/NamingStrategy/NamingStrategyInterface.php b/vendor/zendframework/zend-hydrator/src/NamingStrategy/NamingStrategyInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..cb7ca94ef2d8ebce7520872a92de6ca2aede4e7b --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/NamingStrategy/NamingStrategyInterface.php @@ -0,0 +1,34 @@ +getUnderscoreToStudlyCaseFilter()->filter($name); + } + + /** + * Remove capitalized letters and prepend underscores. + * + * @param string $name + * @return string + */ + public function extract($name) + { + return $this->getCamelCaseToUnderscoreFilter()->filter($name); + } + + /** + * @return FilterChain + */ + protected function getUnderscoreToStudlyCaseFilter() + { + if (static::$underscoreToStudlyCaseFilter instanceof FilterChain) { + return static::$underscoreToStudlyCaseFilter; + } + + $filter = new FilterChain(); + + $filter->attachByName('WordUnderscoreToStudlyCase'); + + return static::$underscoreToStudlyCaseFilter = $filter; + } + + /** + * @return FilterChain + */ + protected function getCamelCaseToUnderscoreFilter() + { + if (static::$camelCaseToUnderscoreFilter instanceof FilterChain) { + return static::$camelCaseToUnderscoreFilter; + } + + $filter = new FilterChain(); + + $filter->attachByName('WordCamelCaseToUnderscore'); + $filter->attachByName('StringToLower'); + + return static::$camelCaseToUnderscoreFilter = $filter; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/NamingStrategyEnabledInterface.php b/vendor/zendframework/zend-hydrator/src/NamingStrategyEnabledInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..c01a5272f5916e359362eb8c3096f064945e9792 --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/NamingStrategyEnabledInterface.php @@ -0,0 +1,42 @@ +getFilter(); + + foreach ($data as $name => $value) { + // Filter keys, removing any we don't want + if (! $filter->filter($name)) { + unset($data[$name]); + continue; + } + + // Replace name if extracted differ + $extracted = $this->extractName($name, $object); + + if ($extracted !== $name) { + unset($data[$name]); + $name = $extracted; + } + + $data[$name] = $this->extractValue($name, $value, $object); + } + + return $data; + } + + /** + * {@inheritDoc} + * + * Hydrate an object by populating public properties + * + * Hydrates an object by setting public properties of the object. + * + * @throws Exception\BadMethodCallException for a non-object $object + */ + public function hydrate(array $data, $object) + { + if (!is_object($object)) { + throw new Exception\BadMethodCallException( + sprintf('%s expects the provided $object to be a PHP object)', __METHOD__) + ); + } + + $properties = & self::$skippedPropertiesCache[get_class($object)]; + + if (! isset($properties)) { + $reflection = new ReflectionClass($object); + $properties = array_fill_keys( + array_map( + function (ReflectionProperty $property) { + return $property->getName(); + }, + $reflection->getProperties( + ReflectionProperty::IS_PRIVATE + + ReflectionProperty::IS_PROTECTED + + ReflectionProperty::IS_STATIC + ) + ), + true + ); + } + + foreach ($data as $name => $value) { + $property = $this->hydrateName($name, $data); + + if (isset($properties[$property])) { + continue; + } + + $object->$property = $this->hydrateValue($property, $value, $data); + } + + return $object; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/Reflection.php b/vendor/zendframework/zend-hydrator/src/Reflection.php new file mode 100644 index 0000000000000000000000000000000000000000..019748b1f4fa0b56b722c0d4b89908752b1ad6de --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/Reflection.php @@ -0,0 +1,95 @@ +extractName($property->getName(), $object); + if (!$this->filterComposite->filter($propertyName)) { + continue; + } + + $value = $property->getValue($object); + $result[$propertyName] = $this->extractValue($propertyName, $value, $object); + } + + return $result; + } + + /** + * Hydrate $object with the provided $data. + * + * @param array $data + * @param object $object + * @return object + */ + public function hydrate(array $data, $object) + { + $reflProperties = self::getReflProperties($object); + foreach ($data as $key => $value) { + $name = $this->hydrateName($key, $data); + if (isset($reflProperties[$name])) { + $reflProperties[$name]->setValue($object, $this->hydrateValue($name, $value, $data)); + } + } + return $object; + } + + /** + * Get a reflection properties from in-memory cache and lazy-load if + * class has not been loaded. + * + * @param string|object $input + * @throws Exception\InvalidArgumentException + * @return ReflectionProperty[] + */ + protected static function getReflProperties($input) + { + if (is_object($input)) { + $input = get_class($input); + } elseif (!is_string($input)) { + throw new Exception\InvalidArgumentException('Input must be a string or an object.'); + } + + if (isset(static::$reflProperties[$input])) { + return static::$reflProperties[$input]; + } + + static::$reflProperties[$input] = []; + $reflClass = new ReflectionClass($input); + $reflProperties = $reflClass->getProperties(); + + foreach ($reflProperties as $property) { + $property->setAccessible(true); + static::$reflProperties[$input][$property->getName()] = $property; + } + + return static::$reflProperties[$input]; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/Strategy/BooleanStrategy.php b/vendor/zendframework/zend-hydrator/src/Strategy/BooleanStrategy.php new file mode 100644 index 0000000000000000000000000000000000000000..dcb3a429caf2168bec54210469ff94def7ec0f4e --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/Strategy/BooleanStrategy.php @@ -0,0 +1,104 @@ +trueValue = $trueValue; + $this->falseValue = $falseValue; + } + + /** + * Converts the given value so that it can be extracted by the hydrator. + * + * @param bool $value The original value. + * @throws InvalidArgumentException + * @return int|string Returns the value that should be extracted. + */ + public function extract($value) + { + if (!is_bool($value)) { + throw new InvalidArgumentException(sprintf( + 'Unable to extract. Expected bool. %s was given.', + is_object($value) ? get_class($value) : gettype($value) + )); + } + + return $value === true ? $this->trueValue : $this->falseValue; + } + + /** + * Converts the given value so that it can be hydrated by the hydrator. + * + * @param int|string $value The original value. + * @throws InvalidArgumentException + * @return bool Returns the value that should be hydrated. + */ + public function hydrate($value) + { + if (!is_string($value) && !is_int($value)) { + throw new InvalidArgumentException(sprintf( + 'Unable to hydrate. Expected string or int. %s was given.', + is_object($value) ? get_class($value) : gettype($value) + )); + } + + if ($value === $this->trueValue) { + return true; + } + + if ($value === $this->falseValue) { + return false; + } + + throw new InvalidArgumentException(sprintf( + 'Unexpected value %s can\'t be hydrated. Expect %s or %s as Value.', + $value, + $this->trueValue, + $this->falseValue + )); + } +} diff --git a/vendor/zendframework/zend-hydrator/src/Strategy/ClosureStrategy.php b/vendor/zendframework/zend-hydrator/src/Strategy/ClosureStrategy.php new file mode 100644 index 0000000000000000000000000000000000000000..1f6526de39f58c2732c1b2ac8ac3286731bc9b53 --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/Strategy/ClosureStrategy.php @@ -0,0 +1,113 @@ + + * function ($value) { + * return $value; + * }; + * + * + * @var callable + */ + protected $extractFunc = null; + + /** + * Function, used in hydrate method, default: + * + * + * function ($value) { + * return $value; + * }; + * + * + * @var callable + */ + protected $hydrateFunc = null; + + /** + * You can describe how your values will extract and hydrate, like this: + * + * + * $hydrator->addStrategy('category', new ClosureStrategy( + * function (Category $value) { + * return (int) $value->id; + * }, + * function ($value) { + * return new Category((int) $value); + * } + * )); + * + * + * @param callable $extractFunc - anonymous function, that extract values + * from object + * @param callable $hydrateFunc - anonymous function, that hydrate values + * into object + */ + public function __construct($extractFunc = null, $hydrateFunc = null) + { + if (isset($extractFunc)) { + if (!is_callable($extractFunc)) { + throw new \Exception('$extractFunc must be callable'); + } + + $this->extractFunc = $extractFunc; + } else { + $this->extractFunc = function ($value) { + return $value; + }; + } + + if (isset($hydrateFunc)) { + if (!is_callable($hydrateFunc)) { + throw new \Exception('$hydrateFunc must be callable'); + } + + $this->hydrateFunc = $hydrateFunc; + } else { + $this->hydrateFunc = function ($value) { + return $value; + }; + } + } + + /** + * Converts the given value so that it can be extracted by the hydrator. + * + * @param mixed $value The original value. + * @param array $object The object is optionally provided as context. + * @return mixed Returns the value that should be extracted. + */ + public function extract($value, $object = null) + { + $func = $this->extractFunc; + + return $func($value, $object); + } + + /** + * Converts the given value so that it can be hydrated by the hydrator. + * + * @param mixed $value The original value. + * @param array $data The whole data is optionally provided as context. + * @return mixed Returns the value that should be hydrated. + */ + public function hydrate($value, $data = null) + { + $func = $this->hydrateFunc; + + return $func($value, $data); + } +} diff --git a/vendor/zendframework/zend-hydrator/src/Strategy/DateTimeFormatterStrategy.php b/vendor/zendframework/zend-hydrator/src/Strategy/DateTimeFormatterStrategy.php new file mode 100644 index 0000000000000000000000000000000000000000..62dda714817d56f8f0c71b9eeb3ed740944a7cd8 --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/Strategy/DateTimeFormatterStrategy.php @@ -0,0 +1,80 @@ +format = (string) $format; + $this->timezone = $timezone; + } + + /** + * {@inheritDoc} + * + * Converts to date time string + * + * @param mixed|DateTime $value + * + * @return mixed|string + */ + public function extract($value) + { + if ($value instanceof DateTime) { + return $value->format($this->format); + } + + return $value; + } + + /** + * Converts date time string to DateTime instance for injecting to object + * + * {@inheritDoc} + * + * @param mixed|string $value + * + * @return mixed|DateTime + */ + public function hydrate($value) + { + if ($value === '' || $value === null) { + return; + } + + if ($this->timezone) { + $hydrated = DateTime::createFromFormat($this->format, $value, $this->timezone); + } else { + $hydrated = DateTime::createFromFormat($this->format, $value); + } + + return $hydrated ?: $value; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/Strategy/DefaultStrategy.php b/vendor/zendframework/zend-hydrator/src/Strategy/DefaultStrategy.php new file mode 100644 index 0000000000000000000000000000000000000000..6fb8f4588ff397d475ffe5694b3e3951dbd855f9 --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/Strategy/DefaultStrategy.php @@ -0,0 +1,35 @@ +setValueDelimiter($delimiter); + + $this->explodeLimit = ($explodeLimit === null) ? null : (int) $explodeLimit; + } + + /** + * Sets the delimiter string that the values will be split upon + * + * @param string $delimiter + * @return self + */ + private function setValueDelimiter($delimiter) + { + if (!is_string($delimiter)) { + throw new Exception\InvalidArgumentException(sprintf( + '%s expects Delimiter to be string, %s provided instead', + __METHOD__, + is_object($delimiter) ? get_class($delimiter) : gettype($delimiter) + )); + } + + if (empty($delimiter)) { + throw new Exception\InvalidArgumentException('Delimiter cannot be empty.'); + } + + $this->valueDelimiter = $delimiter; + } + + /** + * {@inheritDoc} + * + * Split a string by delimiter + * + * @param string|null $value + * + * @return string[] + * + * @throws Exception\InvalidArgumentException + */ + public function hydrate($value) + { + if (null === $value) { + return []; + } + + if (!(is_string($value) || is_numeric($value))) { + throw new Exception\InvalidArgumentException(sprintf( + '%s expects argument 1 to be string, %s provided instead', + __METHOD__, + is_object($value) ? get_class($value) : gettype($value) + )); + } + + if ($this->explodeLimit !== null) { + return explode($this->valueDelimiter, $value, $this->explodeLimit); + } + + return explode($this->valueDelimiter, $value); + } + + /** + * {@inheritDoc} + * + * Join array elements with delimiter + * + * @param string[] $value The original value. + * + * @return string|null + */ + public function extract($value) + { + if (!is_array($value)) { + throw new Exception\InvalidArgumentException(sprintf( + '%s expects argument 1 to be array, %s provided instead', + __METHOD__, + is_object($value) ? get_class($value) : gettype($value) + )); + } + + return empty($value) ? null : implode($this->valueDelimiter, $value); + } +} diff --git a/vendor/zendframework/zend-hydrator/src/Strategy/SerializableStrategy.php b/vendor/zendframework/zend-hydrator/src/Strategy/SerializableStrategy.php new file mode 100644 index 0000000000000000000000000000000000000000..bc49e7b206b2f324ac91c5a6aed32bdea43f9236 --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/Strategy/SerializableStrategy.php @@ -0,0 +1,123 @@ +setSerializer($serializer); + if ($serializerOptions) { + $this->setSerializerOptions($serializerOptions); + } + } + + /** + * Serialize the given value so that it can be extracted by the hydrator. + * + * @param mixed $value The original value. + * @return mixed Returns the value that should be extracted. + */ + public function extract($value) + { + $serializer = $this->getSerializer(); + return $serializer->serialize($value); + } + + /** + * Unserialize the given value so that it can be hydrated by the hydrator. + * + * @param mixed $value The original value. + * @return mixed Returns the value that should be hydrated. + */ + public function hydrate($value) + { + $serializer = $this->getSerializer(); + return $serializer->unserialize($value); + } + + /** + * Set serializer + * + * @param string|SerializerAdapter $serializer + * @return SerializableStrategy + */ + public function setSerializer($serializer) + { + if (!is_string($serializer) && !$serializer instanceof SerializerAdapter) { + throw new InvalidArgumentException(sprintf( + '%s expects either a string serializer name or Zend\Serializer\Adapter\AdapterInterface instance; ' + . 'received "%s"', + __METHOD__, + (is_object($serializer) ? get_class($serializer) : gettype($serializer)) + )); + } + $this->serializer = $serializer; + return $this; + } + + /** + * Get serializer + * + * @return SerializerAdapter + */ + public function getSerializer() + { + if (is_string($this->serializer)) { + $options = $this->getSerializerOptions(); + $this->setSerializer(SerializerFactory::factory($this->serializer, $options)); + } elseif (null === $this->serializer) { + $this->setSerializer(SerializerFactory::getDefaultAdapter()); + } + + return $this->serializer; + } + + /** + * Set configuration options for instantiating a serializer adapter + * + * @param mixed $serializerOptions + * @return SerializableStrategy + */ + public function setSerializerOptions($serializerOptions) + { + $this->serializerOptions = $serializerOptions; + return $this; + } + + /** + * Get configuration options for instantiating a serializer adapter + * + * @return mixed + */ + public function getSerializerOptions() + { + return $this->serializerOptions; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/Strategy/StrategyChain.php b/vendor/zendframework/zend-hydrator/src/Strategy/StrategyChain.php new file mode 100644 index 0000000000000000000000000000000000000000..49d514d30f0f753719a4896123c3ca690124096f --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/Strategy/StrategyChain.php @@ -0,0 +1,73 @@ +extractionStrategies = array_map( + function (StrategyInterface $strategy) { + // this callback is here only to ensure type-safety + return $strategy; + }, + $extractionStrategies + ); + + $this->hydrationStrategies = array_reverse($extractionStrategies); + } + + /** + * {@inheritDoc} + */ + public function extract($value) + { + foreach ($this->extractionStrategies as $strategy) { + $value = $strategy->extract($value); + } + + return $value; + } + + /** + * {@inheritDoc} + */ + public function hydrate($value) + { + foreach ($this->hydrationStrategies as $strategy) { + $value = $strategy->hydrate($value); + } + + return $value; + } +} diff --git a/vendor/zendframework/zend-hydrator/src/Strategy/StrategyInterface.php b/vendor/zendframework/zend-hydrator/src/Strategy/StrategyInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..a70559338a8e5d21c4f27c6fc643e91cd4f9128a --- /dev/null +++ b/vendor/zendframework/zend-hydrator/src/Strategy/StrategyInterface.php @@ -0,0 +1,34 @@ +splPriorityQueue = new SplPriorityQueue(); + $this->fastPriorityQueue = new FastPriorityQueue(); + $this->priorityQueue = new PriorityQueue(); + + for ($i = 0; $i < 5000; $i += 1) { + $priority = rand(1, 100); + $this->splPriorityQueue->insert('foo', $priority); + $this->fastPriorityQueue->insert('foo', $priority); + $this->priorityQueue->insert('foo', $priority); + } + } + + /** + * @iterations 5000 + */ + public function extractSplPriorityQueue() + { + $this->splPriorityQueue->extract(); + } + + /** + * @iterations 5000 + */ + public function extractPriorityQueue() + { + $this->priorityQueue->extract(); + } + + /** + * @iterations 5000 + */ + public function extractFastPriorityQueue() + { + $this->fastPriorityQueue->extract(); + } +} diff --git a/vendor/zendframework/zend-stdlib/benchmark/InsertPriorityQueue.php b/vendor/zendframework/zend-stdlib/benchmark/InsertPriorityQueue.php new file mode 100644 index 0000000000000000000000000000000000000000..561c53597566b07d829432485298ced58f5f25ee --- /dev/null +++ b/vendor/zendframework/zend-stdlib/benchmark/InsertPriorityQueue.php @@ -0,0 +1,49 @@ +splPriorityQueue = new SplPriorityQueue(); + $this->fastPriorityQueue = new FastPriorityQueue(); + $this->priorityQueue = new PriorityQueue(); + } + + /** + * @iterations 5000 + */ + public function insertSplPriorityQueue() + { + $this->splPriorityQueue->insert('foo', rand(1, 100)); + } + + /** + * @iterations 5000 + */ + public function insertPriorityQueue() + { + $this->priorityQueue->insert('foo', rand(1, 100)); + } + + /** + * @iterations 5000 + */ + public function insertFastPriorityQueue() + { + $this->fastPriorityQueue->insert('foo', rand(1, 100)); + } +} diff --git a/vendor/zendframework/zend-stdlib/benchmark/RemovePriorityQueue.php b/vendor/zendframework/zend-stdlib/benchmark/RemovePriorityQueue.php new file mode 100644 index 0000000000000000000000000000000000000000..1cfd35b74f94b949e331e681242f86c746309b61 --- /dev/null +++ b/vendor/zendframework/zend-stdlib/benchmark/RemovePriorityQueue.php @@ -0,0 +1,45 @@ +fastPriorityQueue = new FastPriorityQueue(); + $this->priorityQueue = new PriorityQueue(); + + for ($i = 0; $i < 1000; $i += 1) { + $priority = rand(1, 100); + $this->fastPriorityQueue->insert('foo', $priority); + $this->priorityQueue->insert('foo', $priority); + } + } + + /** + * @iterations 1000 + */ + public function removePriorityQueue() + { + $this->priorityQueue->remove('foo'); + } + + /** + * @iterations 1000 + */ + public function removeFastPriorityQueue() + { + $this->fastPriorityQueue->remove('foo'); + } +} diff --git a/vendor/zendframework/zend-stdlib/composer.json b/vendor/zendframework/zend-stdlib/composer.json index 056ce3f596dc8f622054e1f9fc62eaf1d60d1e19..4a5ecd55d3a878ab78076395a6fb54419cb7ab8a 100644 --- a/vendor/zendframework/zend-stdlib/composer.json +++ b/vendor/zendframework/zend-stdlib/composer.json @@ -13,7 +13,8 @@ } }, "require": { - "php": ">=5.5" + "php": ">=5.5", + "zendframework/zend-hydrator": "~1.0" }, "require-dev": { "zendframework/zend-config": "~2.5", @@ -23,7 +24,8 @@ "zendframework/zend-servicemanager": "~2.5", "zendframework/zend-filter": "~2.5", "fabpot/php-cs-fixer": "1.7.*", - "phpunit/PHPUnit": "~4.0" + "phpunit/PHPUnit": "~4.0", + "athletic/athletic": "~0.1" }, "suggest": { "zendframework/zend-eventmanager": "To support aggregate hydrator usage", @@ -35,13 +37,14 @@ "prefer-stable": true, "extra": { "branch-alias": { - "dev-master": "2.6-dev", - "dev-develop": "2.7-dev" + "dev-master": "2.7-dev", + "dev-develop": "2.8-dev" } }, "autoload-dev": { "psr-4": { - "ZendTest\\Stdlib\\": "test/" + "ZendTest\\Stdlib\\": "test/", + "ZendBench\\Stdlib\\": "benchmark/" } } } diff --git a/vendor/zendframework/zend-stdlib/src/Extractor/ExtractionInterface.php b/vendor/zendframework/zend-stdlib/src/Extractor/ExtractionInterface.php index 297d557746cc20c46a9b0f285213249f82176484..6c84720c83ee99634408e84b1c08cff9bd2155e1 100644 --- a/vendor/zendframework/zend-stdlib/src/Extractor/ExtractionInterface.php +++ b/vendor/zendframework/zend-stdlib/src/Extractor/ExtractionInterface.php @@ -9,13 +9,11 @@ namespace Zend\Stdlib\Extractor; -interface ExtractionInterface +use Zend\Hydrator\ExtractionInterface as BaseExtractionInterface; + +/** + * @deprecated Use Zend\Hydrator\ExtractionInterface from zendframework/zend-hydrator instead. + */ +interface ExtractionInterface extends BaseExtractionInterface { - /** - * Extract values from an object - * - * @param object $object - * @return array - */ - public function extract($object); } diff --git a/vendor/zendframework/zend-stdlib/src/FastPriorityQueue.php b/vendor/zendframework/zend-stdlib/src/FastPriorityQueue.php new file mode 100644 index 0000000000000000000000000000000000000000..16d2bcceba2ef6088a5ced445dbea167793b7f14 --- /dev/null +++ b/vendor/zendframework/zend-stdlib/src/FastPriorityQueue.php @@ -0,0 +1,343 @@ +values[$priority][] = $value; + if (! isset($this->priorities[$priority])) { + $this->priorities[$priority] = $priority; + $this->maxPriority = max($priority, $this->maxPriority); + } + ++$this->count; + } + + /** + * Extract an element in the queue according to the priority and the + * order of insertion + * + * @return mixed + */ + public function extract() + { + if (! $this->valid()) { + return false; + } + $value = $this->current(); + $this->nextAndRemove(); + return $value; + } + + /** + * Remove an item from the queue + * + * This is different than {@link extract()}; its purpose is to dequeue an + * item. + * + * Note: this removes the first item matching the provided item found. If + * the same item has been added multiple times, it will not remove other + * instances. + * + * @param mixed $datum + * @return bool False if the item was not found, true otherwise. + */ + public function remove($datum) + { + $this->rewind(); + while ($this->valid()) { + if (current($this->values[$this->maxPriority]) === $datum) { + $index = key($this->values[$this->maxPriority]); + unset($this->values[$this->maxPriority][$index]); + --$this->count; + return true; + } + $this->next(); + } + return false; + } + + /** + * Get the total number of elements in the queue + * + * @return integer + */ + public function count() + { + return $this->count; + } + + /** + * Get the current element in the queue + * + * @return mixed + */ + public function current() + { + switch ($this->extractFlag) { + case self::EXTR_DATA: + return current($this->values[$this->maxPriority]); + case self::EXTR_PRIORITY: + return $this->maxPriority; + case self::EXTR_BOTH: + return [ + 'data' => current($this->values[$this->maxPriority]), + 'priority' => $this->maxPriority + ]; + } + } + + /** + * Get the index of the current element in the queue + * + * @return integer + */ + public function key() + { + return $this->index; + } + + /** + * Set the iterator pointer to the next element in the queue + * removing the previous element + */ + protected function nextAndRemove() + { + if (false === next($this->values[$this->maxPriority])) { + unset($this->priorities[$this->maxPriority]); + unset($this->values[$this->maxPriority]); + $this->maxPriority = empty($this->priorities) ? 0 : max($this->priorities); + $this->subIndex = -1; + } + ++$this->index; + ++$this->subIndex; + --$this->count; + } + + /** + * Set the iterator pointer to the next element in the queue + * without removing the previous element + */ + public function next() + { + if (false === next($this->values[$this->maxPriority])) { + unset($this->subPriorities[$this->maxPriority]); + reset($this->values[$this->maxPriority]); + $this->maxPriority = empty($this->subPriorities) ? 0 : max($this->subPriorities); + $this->subIndex = -1; + } + ++$this->index; + ++$this->subIndex; + } + + /** + * Check if the current iterator is valid + * + * @return boolean + */ + public function valid() + { + return isset($this->values[$this->maxPriority]); + } + + /** + * Rewind the current iterator + */ + public function rewind() + { + $this->subPriorities = $this->priorities; + $this->maxPriority = empty($this->priorities) ? 0 : max($this->priorities); + $this->index = 0; + $this->subIndex = 0; + } + + /** + * Serialize to an array + * + * Array will be priority => data pairs + * + * @return array + */ + public function toArray() + { + $array = []; + foreach (clone $this as $item) { + $array[] = $item; + } + return $array; + } + + /** + * Serialize + * + * @return string + */ + public function serialize() + { + $clone = clone $this; + $clone->setExtractFlags(self::EXTR_BOTH); + + $data = []; + foreach ($clone as $item) { + $data[] = $item; + } + + return serialize($data); + } + + /** + * Deserialize + * + * @param string $data + * @return void + */ + public function unserialize($data) + { + foreach (unserialize($data) as $item) { + $this->insert($item['data'], $item['priority']); + } + } + + /** + * Set the extract flag + * + * @param integer $flag + */ + public function setExtractFlags($flag) + { + switch ($flag) { + case self::EXTR_DATA: + case self::EXTR_PRIORITY: + case self::EXTR_BOTH: + $this->extractFlag = $flag; + break; + default: + throw new Exception\InvalidArgumentException("The extract flag specified is not valid"); + } + } + + /** + * Check if the queue is empty + * + * @return boolean + */ + public function isEmpty() + { + return empty($this->values); + } + + /** + * Does the queue contain the given datum? + * + * @param mixed $datum + * @return bool + */ + public function contains($datum) + { + foreach ($this->values as $values) { + if (in_array($datum, $values)) { + return true; + } + } + return false; + } + + /** + * Does the queue have an item with the given priority? + * + * @param int $priority + * @return bool + */ + public function hasPriority($priority) + { + return isset($this->values[$priority]); + } +} diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/AbstractHydrator.php b/vendor/zendframework/zend-stdlib/src/Hydrator/AbstractHydrator.php index 338ed804422f19e6e3e3897cee4e934afee6d97b..a4cf08a5ad89b5290828b89690d02b08463745d7 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/AbstractHydrator.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/AbstractHydrator.php @@ -9,279 +9,11 @@ namespace Zend\Stdlib\Hydrator; -use ArrayObject; -use Zend\Stdlib\Exception; -use Zend\Stdlib\Hydrator\Filter\FilterComposite; -use Zend\Stdlib\Hydrator\NamingStrategy\NamingStrategyInterface; -use Zend\Stdlib\Hydrator\Strategy\StrategyInterface; +use Zend\Hydrator\AbstractHydrator as BaseAbstractHydrator; -abstract class AbstractHydrator implements - HydratorInterface, - StrategyEnabledInterface, - FilterEnabledInterface, - NamingStrategyEnabledInterface +/** + * @deprecated Use Zend\Hydrator\AbstractHydrator from zendframework/zend-hydrator instead. + */ +abstract class AbstractHydrator extends BaseAbstractHydrator implements HydratorInterface { - /** - * The list with strategies that this hydrator has. - * - * @var ArrayObject - */ - protected $strategies; - - /** - * An instance of NamingStrategyInterface - * - * @var NamingStrategyInterface - */ - protected $namingStrategy; - - /** - * Composite to filter the methods, that need to be hydrated - * - * @var Filter\FilterComposite - */ - protected $filterComposite; - - /** - * Initializes a new instance of this class. - */ - public function __construct() - { - $this->strategies = new ArrayObject(); - $this->filterComposite = new FilterComposite(); - } - - /** - * Gets the strategy with the given name. - * - * @param string $name The name of the strategy to get. - * - * @throws \Zend\Stdlib\Exception\InvalidArgumentException - * @return StrategyInterface - */ - public function getStrategy($name) - { - if (isset($this->strategies[$name])) { - return $this->strategies[$name]; - } - - if (!isset($this->strategies['*'])) { - throw new Exception\InvalidArgumentException(sprintf( - '%s: no strategy by name of "%s", and no wildcard strategy present', - __METHOD__, - $name - )); - } - - return $this->strategies['*']; - } - - /** - * Checks if the strategy with the given name exists. - * - * @param string $name The name of the strategy to check for. - * @return bool - */ - public function hasStrategy($name) - { - return array_key_exists($name, $this->strategies) - || array_key_exists('*', $this->strategies); - } - - /** - * Adds the given strategy under the given name. - * - * @param string $name The name of the strategy to register. - * @param StrategyInterface $strategy The strategy to register. - * @return HydratorInterface - */ - public function addStrategy($name, StrategyInterface $strategy) - { - $this->strategies[$name] = $strategy; - return $this; - } - - /** - * Removes the strategy with the given name. - * - * @param string $name The name of the strategy to remove. - * @return HydratorInterface - */ - public function removeStrategy($name) - { - unset($this->strategies[$name]); - return $this; - } - - /** - * Converts a value for extraction. If no strategy exists the plain value is returned. - * - * @param string $name The name of the strategy to use. - * @param mixed $value The value that should be converted. - * @param mixed $object The object is optionally provided as context. - * @return mixed - */ - public function extractValue($name, $value, $object = null) - { - if ($this->hasStrategy($name)) { - $strategy = $this->getStrategy($name); - $value = $strategy->extract($value, $object); - } - return $value; - } - - /** - * Converts a value for hydration. If no strategy exists the plain value is returned. - * - * @param string $name The name of the strategy to use. - * @param mixed $value The value that should be converted. - * @param array $data The whole data is optionally provided as context. - * @return mixed - */ - public function hydrateValue($name, $value, $data = null) - { - if ($this->hasStrategy($name)) { - $strategy = $this->getStrategy($name); - $value = $strategy->hydrate($value, $data); - } - return $value; - } - - /** - * Convert a name for extraction. If no naming strategy exists, the plain value is returned. - * - * @param string $name The name to convert. - * @param null $object The object is optionally provided as context. - * @return mixed - */ - public function extractName($name, $object = null) - { - if ($this->hasNamingStrategy()) { - $name = $this->getNamingStrategy()->extract($name, $object); - } - return $name; - } - - /** - * Converts a value for hydration. If no naming strategy exists, the plain value is returned. - * - * @param string $name The name to convert. - * @param array $data The whole data is optionally provided as context. - * @return mixed - */ - public function hydrateName($name, $data = null) - { - if ($this->hasNamingStrategy()) { - $name = $this->getNamingStrategy()->hydrate($name, $data); - } - return $name; - } - - /** - * Get the filter instance - * - * @return Filter\FilterComposite - */ - public function getFilter() - { - return $this->filterComposite; - } - - /** - * Add a new filter to take care of what needs to be hydrated. - * To exclude e.g. the method getServiceLocator: - * - * - * $composite->addFilter("servicelocator", - * function ($property) { - * list($class, $method) = explode('::', $property); - * if ($method === 'getServiceLocator') { - * return false; - * } - * return true; - * }, FilterComposite::CONDITION_AND - * ); - * - * - * @param string $name Index in the composite - * @param callable|Filter\FilterInterface $filter - * @param int $condition - * @return Filter\FilterComposite - */ - public function addFilter($name, $filter, $condition = FilterComposite::CONDITION_OR) - { - return $this->filterComposite->addFilter($name, $filter, $condition); - } - - /** - * Check whether a specific filter exists at key $name or not - * - * @param string $name Index in the composite - * @return bool - */ - public function hasFilter($name) - { - return $this->filterComposite->hasFilter($name); - } - - /** - * Remove a filter from the composition. - * To not extract "has" methods, you simply need to unregister it - * - * - * $filterComposite->removeFilter('has'); - * - * - * @param $name - * @return Filter\FilterComposite - */ - public function removeFilter($name) - { - return $this->filterComposite->removeFilter($name); - } - - /** - * Adds the given naming strategy - * - * @param NamingStrategyInterface $strategy The naming to register. - * @return self - */ - public function setNamingStrategy(NamingStrategyInterface $strategy) - { - $this->namingStrategy = $strategy; - - return $this; - } - - /** - * Gets the naming strategy. - * - * @return NamingStrategyInterface - */ - public function getNamingStrategy() - { - return $this->namingStrategy; - } - - /** - * Checks if a naming strategy exists. - * - * @return bool - */ - public function hasNamingStrategy() - { - return isset($this->namingStrategy); - } - - /** - * Removes the naming strategy - * - * @return self - */ - public function removeNamingStrategy() - { - $this->namingStrategy = null; - - return $this; - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Aggregate/AggregateHydrator.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Aggregate/AggregateHydrator.php index 6bba864d2982fa9b22ef60e746fbbbf52fe7ebec..62c6b32a780cd1665dbc67e12e100e86db7a55e9 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Aggregate/AggregateHydrator.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Aggregate/AggregateHydrator.php @@ -9,77 +9,14 @@ namespace Zend\Stdlib\Hydrator\Aggregate; -use Zend\EventManager\EventManager; -use Zend\EventManager\EventManagerAwareInterface; -use Zend\EventManager\EventManagerInterface; +use Zend\Hydrator\Aggregate\AggregateHydrator as BaseAggregateHydrator; use Zend\Stdlib\Hydrator\HydratorInterface; /** * Aggregate hydrator that composes multiple hydrators via events + * + * @deprecated Use Zend\Hydrator\Aggregate\AggregateHydrator from zendframework/zend-hydrator instead. */ -class AggregateHydrator implements HydratorInterface, EventManagerAwareInterface +class AggregateHydrator extends BaseAggregateHydrator implements HydratorInterface { - const DEFAULT_PRIORITY = 1; - - /** - * @var \Zend\EventManager\EventManagerInterface|null - */ - protected $eventManager; - - /** - * Attaches the provided hydrator to the list of hydrators to be used while hydrating/extracting data - * - * @param \Zend\Stdlib\Hydrator\HydratorInterface $hydrator - * @param int $priority - */ - public function add(HydratorInterface $hydrator, $priority = self::DEFAULT_PRIORITY) - { - $this->getEventManager()->attachAggregate(new HydratorListener($hydrator), $priority); - } - - /** - * {@inheritDoc} - */ - public function extract($object) - { - $event = new ExtractEvent($this, $object); - - $this->getEventManager()->trigger($event); - - return $event->getExtractedData(); - } - - /** - * {@inheritDoc} - */ - public function hydrate(array $data, $object) - { - $event = new HydrateEvent($this, $object, $data); - - $this->getEventManager()->trigger($event); - - return $event->getHydratedObject(); - } - - /** - * {@inheritDoc} - */ - public function setEventManager(EventManagerInterface $eventManager) - { - $eventManager->setIdentifiers([__CLASS__, get_class($this)]); - - $this->eventManager = $eventManager; - } - - /** - * {@inheritDoc} - */ - public function getEventManager() - { - if (null === $this->eventManager) { - $this->setEventManager(new EventManager()); - } - - return $this->eventManager; - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Aggregate/ExtractEvent.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Aggregate/ExtractEvent.php index a826710333b8d39e8e40cef2869f329848f625e1..9563efb2cd5a5d8e82c72ce15057f58e9430f31d 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Aggregate/ExtractEvent.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Aggregate/ExtractEvent.php @@ -9,90 +9,14 @@ namespace Zend\Stdlib\Hydrator\Aggregate; -use Zend\EventManager\Event; +use Zend\Hydrator\Aggregate\ExtractEvent as BaseExtractEvent; /** * Event triggered when the {@see \Zend\Stdlib\Hydrator\Aggregate\AggregateHydrator} extracts * data from an object + * + * @deprecated Use Zend\Hydrator\Aggregate\ExtractEvent from zendframework/zend-hydrator instead. */ -class ExtractEvent extends Event +class ExtractEvent extends BaseExtractEvent { - const EVENT_EXTRACT = 'extract'; - - /** - * {@inheritDoc} - */ - protected $name = self::EVENT_EXTRACT; - - /** - * @var object - */ - protected $extractionObject; - - /** - * @var array - */ - protected $extractedData = []; - - /** - * @param object $target - * @param object $extractionObject - */ - public function __construct($target, $extractionObject) - { - $this->target = $target; - $this->extractionObject = $extractionObject; - } - - /** - * Retrieves the object from which data is extracted - * - * @return object - */ - public function getExtractionObject() - { - return $this->extractionObject; - } - - /** - * @param object $extractionObject - * - * @return void - */ - public function setExtractionObject($extractionObject) - { - $this->extractionObject = $extractionObject; - } - - /** - * Retrieves the data that has been extracted - * - * @return array - */ - public function getExtractedData() - { - return $this->extractedData; - } - - /** - * @param array $extractedData - * - * @return void - */ - public function setExtractedData(array $extractedData) - { - $this->extractedData = $extractedData; - } - - /** - * Merge provided data with the extracted data - * - * @param array $additionalData - * - * @return void - */ - public function mergeExtractedData(array $additionalData) - { - $this->extractedData = array_merge($this->extractedData, $additionalData); - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Aggregate/HydrateEvent.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Aggregate/HydrateEvent.php index a7c91eec261194793a1a1fc001db658d72ac017d..29c9fd67b87563cf684c4b68fd472350b5edcdfb 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Aggregate/HydrateEvent.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Aggregate/HydrateEvent.php @@ -9,76 +9,14 @@ namespace Zend\Stdlib\Hydrator\Aggregate; -use Zend\EventManager\Event; +use Zend\Hydrator\Aggregate\HydrateEvent as BaseHydrateEvent; /** * Event triggered when the {@see \Zend\Stdlib\Hydrator\Aggregate\AggregateHydrator} hydrates * data into an object + * + * @deprecated Use Zend\Hydrator\Aggregate\HydrateEvent from zendframework/zend-hydrator instead. */ -class HydrateEvent extends Event +class HydrateEvent extends BaseHydrateEvent { - const EVENT_HYDRATE = 'hydrate'; - - /** - * {@inheritDoc} - */ - protected $name = self::EVENT_HYDRATE; - - /** - * @var object - */ - protected $hydratedObject; - - /** - * @var array - */ - protected $hydrationData; - - /** - * @param object $target - * @param object $hydratedObject - * @param array $hydrationData - */ - public function __construct($target, $hydratedObject, array $hydrationData) - { - $this->target = $target; - $this->hydratedObject = $hydratedObject; - $this->hydrationData = $hydrationData; - } - - /** - * Retrieves the object that is being hydrated - * - * @return object - */ - public function getHydratedObject() - { - return $this->hydratedObject; - } - - /** - * @param object $hydratedObject - */ - public function setHydratedObject($hydratedObject) - { - $this->hydratedObject = $hydratedObject; - } - - /** - * Retrieves the data that is being used for hydration - * - * @return array - */ - public function getHydrationData() - { - return $this->hydrationData; - } - - /** - * @param array $hydrationData - */ - public function setHydrationData(array $hydrationData) - { - $this->hydrationData = $hydrationData; - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Aggregate/HydratorListener.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Aggregate/HydratorListener.php index 84c8c1289c549fd6380b16e7b2b093d764d794bd..e15cae4762667ddb9ba7cece389d9c31a2c3ae82 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Aggregate/HydratorListener.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Aggregate/HydratorListener.php @@ -9,72 +9,15 @@ namespace Zend\Stdlib\Hydrator\Aggregate; -use Zend\EventManager\AbstractListenerAggregate; -use Zend\EventManager\EventManagerInterface; -use Zend\Stdlib\Hydrator\HydratorInterface; +use Zend\Hydrator\Aggregate\HydratorListener as BaseHydratorListener; /** * Aggregate listener wrapping around a hydrator. Listens * to {@see \Zend\Stdlib\Hydrator\Aggregate::EVENT_HYDRATE} and * {@see \Zend\Stdlib\Hydrator\Aggregate::EVENT_EXTRACT} + * + * @deprecated Use Zend\Hydrator\Aggregate\HydratorListener from zendframework/zend-hydrator instead. */ -class HydratorListener extends AbstractListenerAggregate +class HydratorListener extends BaseHydratorListener { - /** - * @var \Zend\Stdlib\Hydrator\HydratorInterface - */ - protected $hydrator; - - /** - * @param \Zend\Stdlib\Hydrator\HydratorInterface $hydrator - */ - public function __construct(HydratorInterface $hydrator) - { - $this->hydrator = $hydrator; - } - - /** - * {@inheritDoc} - */ - public function attach(EventManagerInterface $events, $priority = 1) - { - $this->listeners[] = $events->attach(HydrateEvent::EVENT_HYDRATE, [$this, 'onHydrate'], $priority); - $this->listeners[] = $events->attach(ExtractEvent::EVENT_EXTRACT, [$this, 'onExtract'], $priority); - } - - /** - * Callback to be used when {@see \Zend\Stdlib\Hydrator\Aggregate\HydrateEvent::EVENT_HYDRATE} is triggered - * - * @param \Zend\Stdlib\Hydrator\Aggregate\HydrateEvent $event - * - * @return object - * - * @internal - */ - public function onHydrate(HydrateEvent $event) - { - $object = $this->hydrator->hydrate($event->getHydrationData(), $event->getHydratedObject()); - - $event->setHydratedObject($object); - - return $object; - } - - /** - * Callback to be used when {@see \Zend\Stdlib\Hydrator\Aggregate\ExtractEvent::EVENT_EXTRACT} is triggered - * - * @param \Zend\Stdlib\Hydrator\Aggregate\ExtractEvent $event - * - * @return array - * - * @internal - */ - public function onExtract(ExtractEvent $event) - { - $data = $this->hydrator->extract($event->getExtractionObject()); - - $event->mergeExtractedData($data); - - return $data; - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/ArraySerializable.php b/vendor/zendframework/zend-stdlib/src/Hydrator/ArraySerializable.php index eb75e22285d7b3c1d503b99d1025ad27d5152fcb..415a44d1ae77b7dedc6c94e3adff3a069ec18c0e 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/ArraySerializable.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/ArraySerializable.php @@ -9,75 +9,11 @@ namespace Zend\Stdlib\Hydrator; -use Zend\Stdlib\Exception; +use Zend\Hydrator\ArraySerializable as BaseArraySerializable; -class ArraySerializable extends AbstractHydrator +/** + * @deprecated Use Zend\Hydrator\ArraySerializable from zendframework/zend-hydrator instead. + */ +class ArraySerializable extends BaseArraySerializable implements HydratorInterface { - /** - * Extract values from the provided object - * - * Extracts values via the object's getArrayCopy() method. - * - * @param object $object - * @return array - * @throws Exception\BadMethodCallException for an $object not implementing getArrayCopy() - */ - public function extract($object) - { - if (!is_callable([$object, 'getArrayCopy'])) { - throw new Exception\BadMethodCallException( - sprintf('%s expects the provided object to implement getArrayCopy()', __METHOD__) - ); - } - - $data = $object->getArrayCopy(); - $filter = $this->getFilter(); - - foreach ($data as $name => $value) { - if (!$filter->filter($name)) { - unset($data[$name]); - continue; - } - $extractedName = $this->extractName($name, $object); - // replace the original key with extracted, if differ - if ($extractedName !== $name) { - unset($data[$name]); - $name = $extractedName; - } - $data[$name] = $this->extractValue($name, $value, $object); - } - - return $data; - } - - /** - * Hydrate an object - * - * Hydrates an object by passing $data to either its exchangeArray() or - * populate() method. - * - * @param array $data - * @param object $object - * @return object - * @throws Exception\BadMethodCallException for an $object not implementing exchangeArray() or populate() - */ - public function hydrate(array $data, $object) - { - $replacement = []; - foreach ($data as $key => $value) { - $name = $this->hydrateName($key, $data); - $replacement[$name] = $this->hydrateValue($name, $value, $data); - } - - if (is_callable([$object, 'exchangeArray'])) { - $object->exchangeArray($replacement); - } elseif (is_callable([$object, 'populate'])) { - $object->populate($replacement); - } else { - throw new Exception\BadMethodCallException( - sprintf('%s expects the provided object to implement exchangeArray() or populate()', __METHOD__) - ); - } - return $object; - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/ClassMethods.php b/vendor/zendframework/zend-stdlib/src/Hydrator/ClassMethods.php index f95b0d1e3819aa162c133d63ed6a36a825a24b9b..ee6bdadc0fddfcbaab9655253392a6a89f301f03 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/ClassMethods.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/ClassMethods.php @@ -9,266 +9,11 @@ namespace Zend\Stdlib\Hydrator; -use Traversable; -use Zend\Stdlib\Exception; -use Zend\Stdlib\ArrayUtils; -use Zend\Stdlib\Hydrator\Filter\FilterComposite; -use Zend\Stdlib\Hydrator\Filter\FilterProviderInterface; -use Zend\Stdlib\Hydrator\Filter\GetFilter; -use Zend\Stdlib\Hydrator\Filter\HasFilter; -use Zend\Stdlib\Hydrator\Filter\IsFilter; -use Zend\Stdlib\Hydrator\Filter\MethodMatchFilter; -use Zend\Stdlib\Hydrator\Filter\OptionalParametersFilter; -use Zend\Stdlib\Hydrator\NamingStrategy\NamingStrategyInterface; -use Zend\Stdlib\Hydrator\NamingStrategy\UnderscoreNamingStrategy; +use Zend\Hydrator\ClassMethods as BaseClassMethods; -class ClassMethods extends AbstractHydrator implements HydratorOptionsInterface +/** + * @deprecated Use Zend\Hydrator\ClassMethods from zendframework/zend-hydrator instead. + */ +class ClassMethods extends BaseClassMethods implements HydratorInterface, HydratorOptionsInterface { - /** - * Holds the names of the methods used for hydration, indexed by class::property name, - * false if the hydration method is not callable/usable for hydration purposes - * - * @var string[]|bool[] - */ - private $hydrationMethodsCache = []; - - /** - * A map of extraction methods to property name to be used during extraction, indexed - * by class name and method name - * - * @var string[][] - */ - private $extractionMethodsCache = []; - - /** - * Flag defining whether array keys are underscore-separated (true) or camel case (false) - * - * @var bool - */ - protected $underscoreSeparatedKeys = true; - - /** - * @var \Zend\Stdlib\Hydrator\Filter\FilterInterface - */ - private $callableMethodFilter; - - /** - * Define if extract values will use camel case or name with underscore - * @param bool|array $underscoreSeparatedKeys - */ - public function __construct($underscoreSeparatedKeys = true) - { - parent::__construct(); - $this->setUnderscoreSeparatedKeys($underscoreSeparatedKeys); - - $this->callableMethodFilter = new OptionalParametersFilter(); - - $this->filterComposite->addFilter('is', new IsFilter()); - $this->filterComposite->addFilter('has', new HasFilter()); - $this->filterComposite->addFilter('get', new GetFilter()); - $this->filterComposite->addFilter('parameter', new OptionalParametersFilter(), FilterComposite::CONDITION_AND); - } - - /** - * @param array|Traversable $options - * @return ClassMethods - * @throws Exception\InvalidArgumentException - */ - public function setOptions($options) - { - if ($options instanceof Traversable) { - $options = ArrayUtils::iteratorToArray($options); - } elseif (!is_array($options)) { - throw new Exception\InvalidArgumentException( - 'The options parameter must be an array or a Traversable' - ); - } - if (isset($options['underscoreSeparatedKeys'])) { - $this->setUnderscoreSeparatedKeys($options['underscoreSeparatedKeys']); - } - - return $this; - } - - /** - * @param bool $underscoreSeparatedKeys - * @return ClassMethods - */ - public function setUnderscoreSeparatedKeys($underscoreSeparatedKeys) - { - $this->underscoreSeparatedKeys = (bool) $underscoreSeparatedKeys; - - if ($this->underscoreSeparatedKeys) { - $this->setNamingStrategy(new UnderscoreNamingStrategy); - } elseif ($this->getNamingStrategy() instanceof UnderscoreNamingStrategy) { - $this->removeNamingStrategy(); - } - - return $this; - } - - /** - * @return bool - */ - public function getUnderscoreSeparatedKeys() - { - return $this->underscoreSeparatedKeys; - } - - /** - * Extract values from an object with class methods - * - * Extracts the getter/setter of the given $object. - * - * @param object $object - * @return array - * @throws Exception\BadMethodCallException for a non-object $object - */ - public function extract($object) - { - if (!is_object($object)) { - throw new Exception\BadMethodCallException(sprintf( - '%s expects the provided $object to be a PHP object)', - __METHOD__ - )); - } - - $objectClass = get_class($object); - - // reset the hydrator's hydrator's cache for this object, as the filter may be per-instance - if ($object instanceof FilterProviderInterface) { - $this->extractionMethodsCache[$objectClass] = null; - } - - // pass 1 - finding out which properties can be extracted, with which methods (populate hydration cache) - if (! isset($this->extractionMethodsCache[$objectClass])) { - $this->extractionMethodsCache[$objectClass] = []; - $filter = $this->filterComposite; - $methods = get_class_methods($object); - - if ($object instanceof FilterProviderInterface) { - $filter = new FilterComposite( - [$object->getFilter()], - [new MethodMatchFilter('getFilter')] - ); - } - - foreach ($methods as $method) { - $methodFqn = $objectClass . '::' . $method; - - if (! ($filter->filter($methodFqn) && $this->callableMethodFilter->filter($methodFqn))) { - continue; - } - - $attribute = $method; - - if (strpos($method, 'get') === 0) { - $attribute = substr($method, 3); - if (!property_exists($object, $attribute)) { - $attribute = lcfirst($attribute); - } - } - - $this->extractionMethodsCache[$objectClass][$method] = $attribute; - } - } - - $values = []; - - // pass 2 - actually extract data - foreach ($this->extractionMethodsCache[$objectClass] as $methodName => $attributeName) { - $realAttributeName = $this->extractName($attributeName, $object); - $values[$realAttributeName] = $this->extractValue($realAttributeName, $object->$methodName(), $object); - } - - return $values; - } - - /** - * Hydrate an object by populating getter/setter methods - * - * Hydrates an object by getter/setter methods of the object. - * - * @param array $data - * @param object $object - * @return object - * @throws Exception\BadMethodCallException for a non-object $object - */ - public function hydrate(array $data, $object) - { - if (!is_object($object)) { - throw new Exception\BadMethodCallException(sprintf( - '%s expects the provided $object to be a PHP object)', - __METHOD__ - )); - } - - $objectClass = get_class($object); - - foreach ($data as $property => $value) { - $propertyFqn = $objectClass . '::$' . $property; - - if (! isset($this->hydrationMethodsCache[$propertyFqn])) { - $setterName = 'set' . ucfirst($this->hydrateName($property, $data)); - - $this->hydrationMethodsCache[$propertyFqn] = is_callable([$object, $setterName]) - ? $setterName - : false; - } - - if ($this->hydrationMethodsCache[$propertyFqn]) { - $object->{$this->hydrationMethodsCache[$propertyFqn]}($this->hydrateValue($property, $value, $data)); - } - } - - return $object; - } - - /** - * {@inheritDoc} - */ - public function addFilter($name, $filter, $condition = FilterComposite::CONDITION_OR) - { - $this->resetCaches(); - - return parent::addFilter($name, $filter, $condition); - } - - /** - * {@inheritDoc} - */ - public function removeFilter($name) - { - $this->resetCaches(); - - return parent::removeFilter($name); - } - - /** - * {@inheritDoc} - */ - public function setNamingStrategy(NamingStrategyInterface $strategy) - { - $this->resetCaches(); - - return parent::setNamingStrategy($strategy); - } - - /** - * {@inheritDoc} - */ - public function removeNamingStrategy() - { - $this->resetCaches(); - - return parent::removeNamingStrategy(); - } - - /** - * Reset all local hydration/extraction caches - */ - private function resetCaches() - { - $this->hydrationMethodsCache = $this->extractionMethodsCache = []; - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/DelegatingHydrator.php b/vendor/zendframework/zend-stdlib/src/Hydrator/DelegatingHydrator.php index db234d38ada5aa4064875a7a98833397815b7f61..eb65d95316905bf40dcbdd2a61ea5528eee2ce5d 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/DelegatingHydrator.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/DelegatingHydrator.php @@ -9,49 +9,11 @@ namespace Zend\Stdlib\Hydrator; -use Zend\ServiceManager\ServiceLocatorInterface; +use Zend\Hydrator\DelegatingHydrator as BaseDelegatingHydrator; -class DelegatingHydrator implements HydratorInterface +/** + * @deprecated Use Zend\Hydrator\DelegatingHydrator from zendframework/zend-hydrator instead. + */ +class DelegatingHydrator extends BaseDelegatingHydrator implements HydratorInterface { - /** - * @var ServiceLocatorInterface - */ - protected $hydrators; - - /** - * Constructor - * - * @param ServiceLocatorInterface $hydrators - */ - public function __construct(ServiceLocatorInterface $hydrators) - { - $this->hydrators = $hydrators; - } - - /** - * {@inheritdoc} - */ - public function hydrate(array $data, $object) - { - return $this->getHydrator($object)->hydrate($data, $object); - } - - /** - * {@inheritdoc} - */ - public function extract($object) - { - return $this->getHydrator($object)->extract($object); - } - - /** - * Gets hydrator of an object - * - * @param object $object - * @return HydratorInterface - */ - protected function getHydrator($object) - { - return $this->hydrators->get(get_class($object)); - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/DelegatingHydratorFactory.php b/vendor/zendframework/zend-stdlib/src/Hydrator/DelegatingHydratorFactory.php index c3a0da25e7f7eefc3f6f91f5a3bbc4f4ad256d57..170308d97d7168141e22879c2c483257ef7729b3 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/DelegatingHydratorFactory.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/DelegatingHydratorFactory.php @@ -9,21 +9,11 @@ namespace Zend\Stdlib\Hydrator; -use Zend\ServiceManager\FactoryInterface; -use Zend\ServiceManager\ServiceLocatorInterface; +use Zend\Hydrator\DelegatingHydratorFactory as BaseDelegatingHydratorFactory; -class DelegatingHydratorFactory implements FactoryInterface +/** + * @deprecated Use Zend\Hydrator\DelegatingHydratorFactory from zendframework/zend-hydrator instead. + */ +class DelegatingHydratorFactory extends BaseDelegatingHydratorFactory { - /** - * Creates DelegatingHydrator - * - * @param ServiceLocatorInterface $serviceLocator - * @return DelegatingHydrator - */ - public function createService(ServiceLocatorInterface $serviceLocator) - { - // Assume that this factory is registered with the HydratorManager, - // and just pass it directly on. - return new DelegatingHydrator($serviceLocator); - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/FilterComposite.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/FilterComposite.php index f9d4c564218251ed7fb4ce992d9d771d3e925608..b230c97ba3e1a31d4c38c08ce896d13ed5fdf968 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/FilterComposite.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/FilterComposite.php @@ -8,189 +8,11 @@ */ namespace Zend\Stdlib\Hydrator\Filter; -use ArrayObject; -use Zend\Stdlib\Exception\InvalidArgumentException; +use Zend\Hydrator\Filter\FilterComposite as BaseFilterComposite; -class FilterComposite implements FilterInterface +/** + * @deprecated Use Zend\Hydrator\Filter\FilterComposite from zendframework/zend-hydrator instead. + */ +class FilterComposite extends BaseFilterComposite implements FilterInterface { - /** - * @var ArrayObject - */ - protected $orFilter; - - /** - * @var ArrayObject - */ - protected $andFilter; - - /** - * Constant to add with "or" conditition - */ - const CONDITION_OR = 1; - - /** - * Constant to add with "and" conditition - */ - const CONDITION_AND = 2; - - /** - * Define default Filter - * - * @param array $orFilter - * @param array $andFilter - * @throws InvalidArgumentException - */ - public function __construct($orFilter = [], $andFilter = []) - { - array_walk( - $orFilter, - function ($value, $key) { - if (!is_callable($value) && !$value instanceof FilterInterface) { - throw new InvalidArgumentException( - 'The value of ' . $key . ' should be either a callable or ' . - 'an instance of Zend\Stdlib\Hydrator\Filter\FilterInterface' - ); - } - } - ); - - array_walk( - $andFilter, - function ($value, $key) { - if (!is_callable($value) && !$value instanceof FilterInterface) { - throw new InvalidArgumentException( - 'The value of ' . $key . ' should be either a callable or ' . - 'an instance of Zend\Stdlib\Hydrator\Filter\FilterInterface' - ); - } - } - ); - - $this->orFilter = new ArrayObject($orFilter); - $this->andFilter = new ArrayObject($andFilter); - } - - /** - * Add a filter to the composite. Has to be indexed with $name in - * order to identify a specific filter. - * - * This example will exclude all methods from the hydration, that starts with 'getService' - * - * $composite->addFilter('exclude', - * function ($method) { - * if (preg_match('/^getService/', $method) { - * return false; - * } - * return true; - * }, FilterComposite::CONDITION_AND - * ); - * - * - * @param string $name - * @param callable|FilterInterface $filter - * @param int $condition Can be either FilterComposite::CONDITION_OR or FilterComposite::CONDITION_AND - * @throws InvalidArgumentException - * @return FilterComposite - */ - public function addFilter($name, $filter, $condition = self::CONDITION_OR) - { - if (!is_callable($filter) && !($filter instanceof FilterInterface)) { - throw new InvalidArgumentException( - 'The value of ' . $name . ' should be either a callable or ' . - 'an instance of Zend\Stdlib\Hydrator\Filter\FilterInterface' - ); - } - - if ($condition === self::CONDITION_OR) { - $this->orFilter[$name] = $filter; - } elseif ($condition === self::CONDITION_AND) { - $this->andFilter[$name] = $filter; - } - - return $this; - } - - /** - * Remove a filter from the composition - * - * @param $name string Identifier for the filter - * @return FilterComposite - */ - public function removeFilter($name) - { - if (isset($this->orFilter[$name])) { - unset($this->orFilter[$name]); - } - - if (isset($this->andFilter[$name])) { - unset($this->andFilter[$name]); - } - - return $this; - } - - /** - * Check if $name has a filter registered - * - * @param $name string Identifier for the filter - * @return bool - */ - public function hasFilter($name) - { - return isset($this->orFilter[$name]) || isset($this->andFilter[$name]); - } - - /** - * Filter the composite based on the AND and OR condition - * Will return true if one from the "or conditions" and all from - * the "and condition" returns true. Otherwise false - * - * @param $property string Parameter will be e.g. Parent\Namespace\Class::method - * @return bool - */ - public function filter($property) - { - $andCount = count($this->andFilter); - $orCount = count($this->orFilter); - // return true if no filters are registered - if ($orCount === 0 && $andCount === 0) { - return true; - } elseif ($orCount === 0 && $andCount !== 0) { - $returnValue = true; - } else { - $returnValue = false; - } - - // Check if 1 from the or filters return true - foreach ($this->orFilter as $filter) { - if (is_callable($filter)) { - if ($filter($property) === true) { - $returnValue = true; - break; - } - continue; - } else { - if ($filter->filter($property) === true) { - $returnValue = true; - break; - } - } - } - - // Check if all of the and condition return true - foreach ($this->andFilter as $filter) { - if (is_callable($filter)) { - if ($filter($property) === false) { - return false; - } - continue; - } else { - if ($filter->filter($property) === false) { - return false; - } - } - } - - return $returnValue; - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/FilterInterface.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/FilterInterface.php index 16df098f56032e11cd6e99798a35fe3837b27734..95c4e24025d20ac9c75092867a0f5ff18bf90cb3 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/FilterInterface.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/FilterInterface.php @@ -8,14 +8,11 @@ */ namespace Zend\Stdlib\Hydrator\Filter; -interface FilterInterface +use Zend\Hydrator\Filter\FilterInterface as BaseFilterInterface; + +/** + * @deprecated Use Zend\Hydrator\Filter\FilterInterface from zendframework/zend-hydrator instead. + */ +interface FilterInterface extends BaseFilterInterface { - /** - * Should return true, if the given filter - * does not match - * - * @param string $property The name of the property - * @return bool - */ - public function filter($property); } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/FilterProviderInterface.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/FilterProviderInterface.php index c2e978877a544375fd894b3897f9e0b002a4f9bb..142ddf1ff7fe571cc61bf1d14b6a7af5e68a5ba2 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/FilterProviderInterface.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/FilterProviderInterface.php @@ -8,12 +8,11 @@ */ namespace Zend\Stdlib\Hydrator\Filter; -interface FilterProviderInterface +use Zend\Hydrator\Filter\FilterProviderInterface as BaseFilterProviderInterface; + +/** + * @deprecated Use Zend\Hydrator\Filter\FilterProviderInterface from zendframework/zend-hydrator instead. + */ +interface FilterProviderInterface extends BaseFilterProviderInterface { - /** - * Provides a filter for hydration - * - * @return FilterInterface - */ - public function getFilter(); } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/GetFilter.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/GetFilter.php index b4d898dc22fca3eacbcaf33b85f638056b5740f8..ca7dd3cbe89c50d4c4ab9f953eeea6ce78b902f5 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/GetFilter.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/GetFilter.php @@ -8,20 +8,11 @@ */ namespace Zend\Stdlib\Hydrator\Filter; -class GetFilter implements FilterInterface -{ - public function filter($property) - { - $pos = strpos($property, '::'); - if ($pos !== false) { - $pos += 2; - } else { - $pos = 0; - } +use Zend\Hydrator\Filter\GetFilter as BaseGetFilter; - if (substr($property, $pos, 3) === 'get') { - return true; - } - return false; - } +/** + * @deprecated Use Zend\Hydrator\Filter\GetFilter from zendframework/zend-hydrator instead. + */ +class GetFilter extends BaseGetFilter implements FilterInterface +{ } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/HasFilter.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/HasFilter.php index 0cf57f95e173cf034cf48f718f35f2b534cdf993..af00600bf40be9b22844b7c3f84c758058a46760 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/HasFilter.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/HasFilter.php @@ -8,20 +8,11 @@ */ namespace Zend\Stdlib\Hydrator\Filter; -class HasFilter implements FilterInterface -{ - public function filter($property) - { - $pos = strpos($property, '::'); - if ($pos !== false) { - $pos += 2; - } else { - $pos = 0; - } +use Zend\Hydrator\Filter\HasFilter as BaseHasFilter; - if (substr($property, $pos, 3) === 'has') { - return true; - } - return false; - } +/** + * @deprecated Use Zend\Hydrator\Filter\HasFilter from zendframework/zend-hydrator instead. + */ +class HasFilter extends BaseHasFilter implements FilterInterface +{ } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/IsFilter.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/IsFilter.php index 3b6e3763742ae3fa5d04cf19c3bdd875afba3915..9e51643f5f09b5f38f786574c34a52a40a1a15ff 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/IsFilter.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/IsFilter.php @@ -8,20 +8,11 @@ */ namespace Zend\Stdlib\Hydrator\Filter; -class IsFilter implements FilterInterface -{ - public function filter($property) - { - $pos = strpos($property, '::'); - if ($pos !== false) { - $pos += 2; - } else { - $pos = 0; - } +use Zend\Hydrator\Filter\IsFilter as BaseIsFilter; - if (substr($property, $pos, 2) === 'is') { - return true; - } - return false; - } +/** + * @deprecated Use Zend\Hydrator\Filter\IsFilter from zendframework/zend-hydrator instead. + */ +class IsFilter extends BaseIsFilter implements FilterInterface +{ } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/MethodMatchFilter.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/MethodMatchFilter.php index 2601a6fb31fdbba15b374ff4b506685b38f62591..471849ce89b47b7acf7d17fdfc9afcc91f538380 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/MethodMatchFilter.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/MethodMatchFilter.php @@ -8,41 +8,11 @@ */ namespace Zend\Stdlib\Hydrator\Filter; -class MethodMatchFilter implements FilterInterface -{ - /** - * The method to exclude - * @var string - */ - protected $method = null; - - /** - * Either an exclude or an include - * @var bool - */ - protected $exclude = null; - - /** - * @param string $method The method to exclude or include - * @param bool $exclude If the method should be excluded - */ - public function __construct($method, $exclude = true) - { - $this->method = $method; - $this->exclude = $exclude; - } +use Zend\Hydrator\Filter\MethodMatchFilter as BaseMethodMatchFilter; - public function filter($property) - { - $pos = strpos($property, '::'); - if ($pos !== false) { - $pos += 2; - } else { - $pos = 0; - } - if (substr($property, $pos) === $this->method) { - return !$this->exclude; - } - return $this->exclude; - } +/** + * @deprecated Use Zend\Hydrator\Filter\MethodMatchFilter from zendframework/zend-hydrator instead. + */ +class MethodMatchFilter extends BaseMethodMatchFilter implements FilterInterface +{ } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/NumberOfParameterFilter.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/NumberOfParameterFilter.php index 1254b63b35c29848a7e1efb059bcba79f07bcf17..95309b160a93349619c899f4b1f74419499fb702 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/NumberOfParameterFilter.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/NumberOfParameterFilter.php @@ -9,41 +9,11 @@ namespace Zend\Stdlib\Hydrator\Filter; -use ReflectionException; -use ReflectionMethod; -use Zend\Stdlib\Exception\InvalidArgumentException; +use Zend\Hydrator\Filter\NumberOfParameterFilter as BaseNumberOfParameterFilter; -class NumberOfParameterFilter implements FilterInterface +/** + * @deprecated Use Zend\Hydrator\Filter\NumberOfParameterFilter from zendframework/zend-hydrator instead. + */ +class NumberOfParameterFilter extends BaseNumberOfParameterFilter implements FilterInterface { - /** - * The number of parameters beeing accepted - * @var int - */ - protected $numberOfParameters = null; - - /** - * @param int $numberOfParameters Number of accepted parameters - */ - public function __construct($numberOfParameters = 0) - { - $this->numberOfParameters = (int) $numberOfParameters; - } - - /** - * @param string $property the name of the property - * @return bool - * @throws InvalidArgumentException - */ - public function filter($property) - { - try { - $reflectionMethod = new ReflectionMethod($property); - } catch (ReflectionException $exception) { - throw new InvalidArgumentException( - "Method $property doesn't exist" - ); - } - - return $reflectionMethod->getNumberOfParameters() === $this->numberOfParameters; - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/OptionalParametersFilter.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/OptionalParametersFilter.php index 8204e786f37e93133e0f911c0b04da63eafa68f6..07c8dfdc42b314e34c400774eb86991e7d4c2667 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/OptionalParametersFilter.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/OptionalParametersFilter.php @@ -8,47 +8,13 @@ */ namespace Zend\Stdlib\Hydrator\Filter; -use InvalidArgumentException; -use ReflectionException; -use ReflectionMethod; -use ReflectionParameter; +use Zend\Hydrator\Filter\OptionalParametersFilter as BaseOptionalParametersFilter; /** * Filter that includes methods which have no parameters or only optional parameters + * + * @deprecated Use Zend\Hydrator\Filter\OptionalParametersFilter from zendframework/zend-hydrator instead. */ -class OptionalParametersFilter implements FilterInterface +class OptionalParametersFilter extends BaseOptionalParametersFilter implements FilterInterface { - /** - * Map of methods already analyzed - * by {@see \Zend\Stdlib\Hydrator\Filter\OptionalParametersFilter::filter()}, - * cached for performance reasons - * - * @var bool[] - */ - protected static $propertiesCache = []; - - /** - * {@inheritDoc} - */ - public function filter($property) - { - if (isset(static::$propertiesCache[$property])) { - return static::$propertiesCache[$property]; - } - - try { - $reflectionMethod = new ReflectionMethod($property); - } catch (ReflectionException $exception) { - throw new InvalidArgumentException(sprintf('Method %s doesn\'t exist', $property)); - } - - $mandatoryParameters = array_filter( - $reflectionMethod->getParameters(), - function (ReflectionParameter $parameter) { - return ! $parameter->isOptional(); - } - ); - - return static::$propertiesCache[$property] = empty($mandatoryParameters); - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/FilterEnabledInterface.php b/vendor/zendframework/zend-stdlib/src/Hydrator/FilterEnabledInterface.php index 380aade050ad7fd18f684f916d7876af81643a77..9643f1427594a7792e0b1bae151693cd09f595fa 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/FilterEnabledInterface.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/FilterEnabledInterface.php @@ -9,55 +9,11 @@ namespace Zend\Stdlib\Hydrator; -use Zend\Stdlib\Hydrator\Filter\FilterInterface; -use Zend\Stdlib\Hydrator\Filter\FilterComposite; -use Zend\Stdlib\Hydrator\Filter\FilterProviderInterface; +use Zend\Hydrator\FilterEnabledInterface as BaseFilterEnabledInterface; -interface FilterEnabledInterface extends FilterProviderInterface +/** + * @deprecated Use Zend\Hydrator\FilterEnabledInterface from zendframework/zend-hydrator instead. + */ +interface FilterEnabledInterface extends BaseFilterEnabledInterface { - /** - * Add a new filter to take care of what needs to be hydrated. - * To exclude e.g. the method getServiceLocator: - * - * - * $composite->addFilter( - * "servicelocator", - * function ($property) { - * list($class, $method) = explode('::', $property); - * if ($method === 'getServiceLocator') { - * return false; - * } - * return true; - * }, - * FilterComposite::CONDITION_AND - * ); - * - * - * @param string $name Index in the composite - * @param callable|FilterInterface $filter - * @param int $condition - * @return FilterComposite - */ - public function addFilter($name, $filter, $condition = FilterComposite::CONDITION_OR); - - /** - * Check whether a specific filter exists at key $name or not - * - * @param string $name Index in the composite - * @return bool - */ - public function hasFilter($name); - - /** - * Remove a filter from the composition. - * To not extract "has" methods, you simply need to unregister it - * - * - * $filterComposite->removeFilter('has'); - * - * - * @param $name - * @return FilterComposite - */ - public function removeFilter($name); } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/HydrationInterface.php b/vendor/zendframework/zend-stdlib/src/Hydrator/HydrationInterface.php index e7deff491ae575b2bdf728d94c37f94e40fac656..8395169b4d794fc15909c50afb423694bdd0d8b0 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/HydrationInterface.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/HydrationInterface.php @@ -9,14 +9,11 @@ namespace Zend\Stdlib\Hydrator; -interface HydrationInterface +use Zend\Hydrator\HydrationInterface as BaseHydrationInterface; + +/** + * @deprecated Use Zend\Hydrator\HydrationInterface from zendframework/zend-hydrator instead. + */ +interface HydrationInterface extends BaseHydrationInterface { - /** - * Hydrate $object with the provided $data. - * - * @param array $data - * @param object $object - * @return object - */ - public function hydrate(array $data, $object); } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorAwareInterface.php b/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorAwareInterface.php index d64782ea41ee2ed55cb2be38035a296883533acf..625a609b7403448ea63bd142e2f1baae7fe3be65 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorAwareInterface.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorAwareInterface.php @@ -9,20 +9,11 @@ namespace Zend\Stdlib\Hydrator; -interface HydratorAwareInterface -{ - /** - * Set hydrator - * - * @param HydratorInterface $hydrator - * @return HydratorAwareInterface - */ - public function setHydrator(HydratorInterface $hydrator); +use Zend\Hydrator\HydratorAwareInterface as BaseHydratorAwareInterface; - /** - * Retrieve hydrator - * - * @return HydratorInterface - */ - public function getHydrator(); +/** + * @deprecated Use Zend\Hydrator\HydratorAwareInterface from zendframework/zend-hydrator instead. + */ +interface HydratorAwareInterface extends BaseHydratorAwareInterface +{ } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorAwareTrait.php b/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorAwareTrait.php index 9c772c277a3d451a5a29814ffa5a2c124fbaf1d1..e7d60820934330234d1d04647ab4a0084b68793a 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorAwareTrait.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorAwareTrait.php @@ -9,39 +9,12 @@ namespace Zend\Stdlib\Hydrator; +use Zend\Hydrator\HydratorAwareTrait as BaseHydratorAwareTrait; + +/** + * @deprecated Use Zend\Hydrator\HydratorAwareTrait from zendframework/zend-hydrator instead. + */ trait HydratorAwareTrait { - /** - * Hydrator instance - * - * @var HydratorInterface - * @access protected - */ - protected $hydrator = null; - - /** - * Set hydrator - * - * @param HydratorInterface $hydrator - * @return self - * @access public - */ - public function setHydrator(HydratorInterface $hydrator) - { - $this->hydrator = $hydrator; - - return $this; - } - - /** - * Retrieve hydrator - * - * @param void - * @return null|HydratorInterface - * @access public - */ - public function getHydrator() - { - return $this->hydrator; - } + use BaseHydratorAwareTrait; } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorInterface.php b/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorInterface.php index bc9983d9a5a6cc1d8c0d859cc548f4fd02a940b2..14f143ab8794c16b586211bdf62ae9ec604397ae 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorInterface.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorInterface.php @@ -10,7 +10,11 @@ namespace Zend\Stdlib\Hydrator; use Zend\Stdlib\Extractor\ExtractionInterface; +use Zend\Hydrator\HydratorInterface as BaseHydratorInterface; -interface HydratorInterface extends HydrationInterface, ExtractionInterface +/** + * @deprecated Use Zend\Hydrator\HydratorInterface from zendframework/zend-hydrator instead. + */ +interface HydratorInterface extends BaseHydratorInterface, HydrationInterface, ExtractionInterface { } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorOptionsInterface.php b/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorOptionsInterface.php index 44610f7c1e2c7ce7126f5675e88a17269c4eaec3..dfda9253fd89c6ccbb082f8b92db97e97360be69 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorOptionsInterface.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorOptionsInterface.php @@ -9,11 +9,11 @@ namespace Zend\Stdlib\Hydrator; -interface HydratorOptionsInterface +use Zend\Hydrator\HydratorOptionsInterface as BaseHydratorOptionsInterface; + +/** + * @deprecated Use Zend\Hydrator\HydratorOptionsInterface from zendframework/zend-hydrator instead. + */ +interface HydratorOptionsInterface extends BaseHydratorOptionsInterface { - /** - * @param array|\Traversable $options - * @return HydratorOptionsInterface - */ - public function setOptions($options); } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorPluginManager.php b/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorPluginManager.php index 537202fc6f14ac07363bd7cb25170b41ae7b767f..6b7049b8dae61bf2364da94e32c8634de85d07a5 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorPluginManager.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/HydratorPluginManager.php @@ -9,66 +9,15 @@ namespace Zend\Stdlib\Hydrator; -use Zend\ServiceManager\AbstractPluginManager; -use Zend\Stdlib\Exception; +use Zend\Hydrator\HydratorPluginManager as BaseHydratorPluginManager; /** * Plugin manager implementation for hydrators. * * Enforces that adapters retrieved are instances of HydratorInterface + * + * @deprecated Use Zend\Hydrator\HydratorPluginManager from zendframework/zend-hydrator instead. */ -class HydratorPluginManager extends AbstractPluginManager +class HydratorPluginManager extends BaseHydratorPluginManager { - /** - * Whether or not to share by default - * - * @var bool - */ - protected $shareByDefault = false; - - /** - * Default aliases - * - * @var array - */ - protected $aliases = [ - 'delegatinghydrator' => 'Zend\Stdlib\Hydrator\DelegatingHydrator', - ]; - - /** - * Default set of adapters - * - * @var array - */ - protected $invokableClasses = [ - 'arrayserializable' => 'Zend\Stdlib\Hydrator\ArraySerializable', - 'classmethods' => 'Zend\Stdlib\Hydrator\ClassMethods', - 'objectproperty' => 'Zend\Stdlib\Hydrator\ObjectProperty', - 'reflection' => 'Zend\Stdlib\Hydrator\Reflection' - ]; - - /** - * Default factory-based adapters - * - * @var array - */ - protected $factories = [ - 'Zend\Stdlib\Hydrator\DelegatingHydrator' => 'Zend\Stdlib\Hydrator\DelegatingHydratorFactory', - ]; - - /** - * {@inheritDoc} - */ - public function validatePlugin($plugin) - { - if ($plugin instanceof HydratorInterface) { - // we're okay - return; - } - - throw new Exception\RuntimeException(sprintf( - 'Plugin of type %s is invalid; must implement Zend\Stdlib\Hydrator\HydratorInterface', - (is_object($plugin) ? get_class($plugin) : gettype($plugin)) - )); - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Iterator/HydratingArrayIterator.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Iterator/HydratingArrayIterator.php index 22bc81ab90f9c88d07481c5e6674c6ef92d4d15c..f51befe446b20069c84a99aecff1881f855123b5 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Iterator/HydratingArrayIterator.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Iterator/HydratingArrayIterator.php @@ -9,28 +9,11 @@ namespace Zend\Stdlib\Hydrator\Iterator; -use ArrayIterator; -use Zend\Stdlib\Hydrator\HydratorInterface; +use Zend\Hydrator\Iterator\HydratingArrayIterator as BaseHydratingArrayIterator; -class HydratingArrayIterator extends HydratingIteratorIterator +/** + * @deprecated Use Zend\Hydrator\Iterator\HydratingArrayIterator from zendframework/zend-hydrator instead. + */ +class HydratingArrayIterator extends BaseHydratingArrayIterator implements HydratingIteratorInterface { - /** - * @var HydratorInterface - */ - protected $hydrator; - - /** - * @var object - */ - protected $prototype; - - /** - * @param HydratorInterface $hydrator - * @param array $data - * @param string|object $prototype Object, or class name to use for prototype. - */ - public function __construct(HydratorInterface $hydrator, array $data, $prototype) - { - parent::__construct($hydrator, new ArrayIterator($data), $prototype); - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Iterator/HydratingIteratorInterface.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Iterator/HydratingIteratorInterface.php index ba8c5967bd7477af45779d9e335c935b03a96426..81a9999b53238e1aa0585b4df83eba0448421287 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Iterator/HydratingIteratorInterface.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Iterator/HydratingIteratorInterface.php @@ -9,25 +9,11 @@ namespace Zend\Stdlib\Hydrator\Iterator; -use Iterator; -use Zend\Stdlib\Hydrator\HydratorInterface; +use Zend\Hydrator\Iterator\HydratingIteratorInterface as BaseHydratingIteratorInterface; -interface HydratingIteratorInterface extends Iterator +/** + * @deprecated Use Zend\Hydrator\Iterator\HydratingIteratorInterface from zendframework/zend-hydrator instead. + */ +interface HydratingIteratorInterface extends BaseHydratingIteratorInterface { - /** - * This sets the prototype to hydrate. - * - * This prototype can be the name of the class or the object itself; - * iteration will clone the object. - * - * @param string|object $prototype - */ - public function setPrototype($prototype); - - /** - * Sets the hydrator to use during iteration. - * - * @param HydratorInterface $hydrator - */ - public function setHydrator(HydratorInterface $hydrator); } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Iterator/HydratingIteratorIterator.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Iterator/HydratingIteratorIterator.php index 2cd1d65fa53b319996a9a7f99b3dd91b910708b1..1d2ac7ad9af721a08268aa42a1ebcae30a502ec7 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Iterator/HydratingIteratorIterator.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Iterator/HydratingIteratorIterator.php @@ -9,70 +9,11 @@ namespace Zend\Stdlib\Hydrator\Iterator; -use Iterator; -use IteratorIterator; -use Zend\Stdlib\Exception\InvalidArgumentException; -use Zend\Stdlib\Hydrator\HydratorInterface; +use Zend\Hydrator\Iterator\HydratingIteratorIterator as BaseHydratingIteratorIterator; -class HydratingIteratorIterator extends IteratorIterator implements HydratingIteratorInterface +/** + * @deprecated Use Zend\Hydrator\Iterator\HydratingIteratorIterator from zendframework/zend-hydrator instead. + */ +class HydratingIteratorIterator extends BaseHydratingIteratorIterator implements HydratingIteratorInterface { - /** - * @var HydratorInterface - */ - protected $hydrator; - - /** - * @var object - */ - protected $prototype; - - /** - * @param HydratorInterface $hydrator - * @param Iterator $data - * @param string|object $prototype Object or class name to use for prototype. - */ - public function __construct(HydratorInterface $hydrator, Iterator $data, $prototype) - { - $this->setHydrator($hydrator); - $this->setPrototype($prototype); - parent::__construct($data); - } - - /** - * @inheritdoc - */ - public function setPrototype($prototype) - { - if (is_object($prototype)) { - $this->prototype = $prototype; - return; - } - - if (!class_exists($prototype)) { - throw new InvalidArgumentException( - sprintf('Method %s was passed an invalid class name: %s', __METHOD__, $prototype) - ); - } - - $this->prototype = new $prototype; - } - - /** - * @inheritdoc - */ - public function setHydrator(HydratorInterface $hydrator) - { - $this->hydrator = $hydrator; - } - - /** - * @return object Returns hydrated clone of $prototype - */ - public function current() - { - $currentValue = parent::current(); - $object = clone $this->prototype; - $this->hydrator->hydrate($currentValue, $object); - return $object; - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/ArrayMapNamingStrategy.php b/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/ArrayMapNamingStrategy.php index 6ca3711f3dffbe8d3d6fc02b6488ba8f646e97f0..d440c531e40379d2646aeacd11d61c4f0cfdad47 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/ArrayMapNamingStrategy.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/ArrayMapNamingStrategy.php @@ -9,43 +9,11 @@ namespace Zend\Stdlib\Hydrator\NamingStrategy; -final class ArrayMapNamingStrategy implements NamingStrategyInterface -{ - /** - * @var string[] - */ - private $extractionMap = []; - - /** - * @var string[] - */ - private $hydrationMap = []; - - /** - * Constructor - * - * @param array $extractionMap A map of string keys and values for symmetric translation of hydrated - * and extracted field names - */ - public function __construct(array $extractionMap) - { - $this->extractionMap = $extractionMap; - $this->hydrationMap = array_flip($extractionMap); - } - - /** - * {@inheritDoc} - */ - public function hydrate($name) - { - return isset($this->hydrationMap[$name]) ? $this->hydrationMap[$name] : $name; - } +use Zend\Hydrator\NamingStrategy\ArrayMapNamingStrategy as BaseArrayMapNamingStrategy; - /** - * {@inheritDoc} - */ - public function extract($name) - { - return isset($this->extractionMap[$name]) ? $this->extractionMap[$name] : $name; - } +/** + * @deprecated Use Zend\Hydrator\NamingStrategy\ArrayMapNamingStrategy from zendframework/zend-hydrator instead. + */ +class ArrayMapNamingStrategy extends BaseArrayMapNamingStrategy implements NamingStrategyInterface +{ } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/CompositeNamingStrategy.php b/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/CompositeNamingStrategy.php index 76a3082bdb948043f6657dce5ef9f1c5281f9aba..d529a8b0331a17327c7d329fee61c4d4eaf4aa84 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/CompositeNamingStrategy.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/CompositeNamingStrategy.php @@ -9,56 +9,11 @@ namespace Zend\Stdlib\Hydrator\NamingStrategy; -final class CompositeNamingStrategy implements NamingStrategyInterface -{ - /** - * @var array - */ - private $namingStrategies = []; - - /** - * @var NamingStrategyInterface - */ - private $defaultNamingStrategy; - - /** - * @param NamingStrategyInterface[] $strategies indexed by the name they translate - * @param NamingStrategyInterface|null $defaultNamingStrategy - */ - public function __construct(array $strategies, NamingStrategyInterface $defaultNamingStrategy = null) - { - $this->namingStrategies = array_map( - function (NamingStrategyInterface $strategy) { - // this callback is here only to ensure type-safety - return $strategy; - }, - $strategies - ); - - $this->defaultNamingStrategy = $defaultNamingStrategy ?: new IdentityNamingStrategy(); - } - - /** - * {@inheritDoc} - */ - public function extract($name) - { - $strategy = isset($this->namingStrategies[$name]) - ? $this->namingStrategies[$name] - : $this->defaultNamingStrategy; +use Zend\Hydrator\NamingStrategy\CompositeNamingStrategy as BaseCompositeNamingStrategy; - return $strategy->extract($name); - } - - /** - * {@inheritDoc} - */ - public function hydrate($name) - { - $strategy = isset($this->namingStrategies[$name]) - ? $this->namingStrategies[$name] - : $this->defaultNamingStrategy; - - return $strategy->hydrate($name); - } +/** + * @deprecated Use Zend\Hydrator\NamingStrategy\CompositeNamingStrategy from zendframework/zend-hydrator instead. + */ +class CompositeNamingStrategy extends BaseCompositeNamingStrategy implements NamingStrategyInterface +{ } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/IdentityNamingStrategy.php b/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/IdentityNamingStrategy.php index ee4b328d34d638e787ec9eca9d10e0c8a034269c..be5783917543aebd1cf6eb5a5ad29c6df19e4ed6 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/IdentityNamingStrategy.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/IdentityNamingStrategy.php @@ -9,21 +9,11 @@ namespace Zend\Stdlib\Hydrator\NamingStrategy; -final class IdentityNamingStrategy implements NamingStrategyInterface -{ - /** - * {@inheritDoc} - */ - public function hydrate($name) - { - return $name; - } +use Zend\Hydrator\NamingStrategy\IdentityNamingStrategy as BaseIdentityNamingStrategy; - /** - * {@inheritDoc} - */ - public function extract($name) - { - return $name; - } +/** + * @deprecated Use Zend\Hydrator\NamingStrategy\IdentityNamingStrategy from zendframework/zend-hydrator instead. + */ +class IdentityNamingStrategy extends BaseIdentityNamingStrategy implements NamingStrategyInterface +{ } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/MapNamingStrategy.php b/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/MapNamingStrategy.php index 7d04e5787a53590ef92c887655a1b8812d2503f6..59e3f7f8ffd5227e3a76221e89535d8e17faebf8 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/MapNamingStrategy.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/MapNamingStrategy.php @@ -9,81 +9,11 @@ namespace Zend\Stdlib\Hydrator\NamingStrategy; -use Zend\Stdlib\Exception\InvalidArgumentException; +use Zend\Hydrator\NamingStrategy\MapNamingStrategy as BaseMapNamingStrategy; -class MapNamingStrategy implements NamingStrategyInterface +/** + * @deprecated Use Zend\Hydrator\NamingStrategy\MapNamingStrategy from zendframework/zend-hydrator instead. + */ +class MapNamingStrategy extends BaseMapNamingStrategy implements NamingStrategyInterface { - /** - * Map for hydrate name conversion. - * - * @var array - */ - protected $mapping = []; - - /** - * Reversed map for extract name conversion. - * - * @var array - */ - protected $reverse = []; - - /** - * Initialize. - * - * @param array $mapping Map for name conversion on hydration - * @param array $reverse Reverse map for name conversion on extraction - */ - public function __construct(array $mapping, array $reverse = null) - { - $this->mapping = $mapping; - $this->reverse = $reverse ?: $this->flipMapping($mapping); - } - - /** - * Safelly flip mapping array. - * - * @param array $array Array to flip - * @return array Flipped array - * @throws InvalidArgumentException - */ - protected function flipMapping(array $array) - { - array_walk($array, function ($value) { - if (!is_string($value) && !is_int($value)) { - throw new InvalidArgumentException('Mapping array can\'t be flipped because of invalid value'); - } - }); - - return array_flip($array); - } - - /** - * Converts the given name so that it can be extracted by the hydrator. - * - * @param string $name The original name - * @return mixed The hydrated name - */ - public function hydrate($name) - { - if (array_key_exists($name, $this->mapping)) { - return $this->mapping[$name]; - } - - return $name; - } - - /** - * Converts the given name so that it can be hydrated by the hydrator. - * - * @param string $name The original name - * @return mixed The extracted name - */ - public function extract($name) - { - if (array_key_exists($name, $this->reverse)) { - return $this->reverse[$name]; - } - - return $name; - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/NamingStrategyInterface.php b/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/NamingStrategyInterface.php index ff99385c19f98dbdbe641a003e5f7b02be787d6a..4d82ee1d6c34c0e1999f414f1bc58a4b252f01db 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/NamingStrategyInterface.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/NamingStrategyInterface.php @@ -9,29 +9,13 @@ namespace Zend\Stdlib\Hydrator\NamingStrategy; +use Zend\Hydrator\NamingStrategy\NamingStrategyInterface as BaseNamingStrategyInterface; + /** * Allow property extraction / hydration for hydrator * - * Interface PropertyStrategyInterface - * @package Zend\Stdlib\Hydrator\NamingStrategy + * @deprecated Use Zend\Hydrator\NamingStrategy\NamingStrategyInterface from zendframework/zend-hydrator instead. */ -interface NamingStrategyInterface +interface NamingStrategyInterface extends BaseNamingStrategyInterface { - /** - * Converts the given name so that it can be extracted by the hydrator. - * - * @param string $name The original name - * @param object $object (optional) The original object for context. - * @return mixed The hydrated name - */ - public function hydrate($name); - - /** - * Converts the given name so that it can be hydrated by the hydrator. - * - * @param string $name The original name - * @param array $data (optional) The original data for context. - * @return mixed The extracted name - */ - public function extract($name); } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/UnderscoreNamingStrategy.php b/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/UnderscoreNamingStrategy.php index 023b4eec76a6b89616acfe35554e6fe6b45af5fa..2b9d6efbc7f340ccc2621dc78a6cc72994af74da 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/UnderscoreNamingStrategy.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/UnderscoreNamingStrategy.php @@ -9,72 +9,11 @@ namespace Zend\Stdlib\Hydrator\NamingStrategy; -use Zend\Filter\FilterChain; +use Zend\Hydrator\NamingStrategy\UnderscoreNamingStrategy as BaseUnderscoreNamingStrategy; -class UnderscoreNamingStrategy implements NamingStrategyInterface +/** + * @deprecated Use Zend\Hydrator\NamingStrategy\UnderscoreNamingStrategy from zendframework/zend-hydrator instead. + */ +class UnderscoreNamingStrategy extends BaseUnderscoreNamingStrategy implements NamingStrategyInterface { - /** - * @var FilterChain|null - */ - protected static $camelCaseToUnderscoreFilter; - - /** - * @var FilterChain|null - */ - protected static $underscoreToStudlyCaseFilter; - - /** - * Remove underscores and capitalize letters - * - * @param string $name - * @return string - */ - public function hydrate($name) - { - return $this->getUnderscoreToStudlyCaseFilter()->filter($name); - } - - /** - * Remove capitalized letters and prepend underscores. - * - * @param string $name - * @return string - */ - public function extract($name) - { - return $this->getCamelCaseToUnderscoreFilter()->filter($name); - } - - /** - * @return FilterChain - */ - protected function getUnderscoreToStudlyCaseFilter() - { - if (static::$underscoreToStudlyCaseFilter instanceof FilterChain) { - return static::$underscoreToStudlyCaseFilter; - } - - $filter = new FilterChain(); - - $filter->attachByName('WordUnderscoreToStudlyCase'); - - return static::$underscoreToStudlyCaseFilter = $filter; - } - - /** - * @return FilterChain - */ - protected function getCamelCaseToUnderscoreFilter() - { - if (static::$camelCaseToUnderscoreFilter instanceof FilterChain) { - return static::$camelCaseToUnderscoreFilter; - } - - $filter = new FilterChain(); - - $filter->attachByName('WordCamelCaseToUnderscore'); - $filter->attachByName('StringToLower'); - - return static::$camelCaseToUnderscoreFilter = $filter; - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategyEnabledInterface.php b/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategyEnabledInterface.php index f9c6288a760b0948d3f52d27df6239608adfcce7..8f8acabc5b16a90d1a1f3ff6764dd04e1ff8483e 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategyEnabledInterface.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/NamingStrategyEnabledInterface.php @@ -9,36 +9,11 @@ namespace Zend\Stdlib\Hydrator; -use Zend\Stdlib\Hydrator\NamingStrategy\NamingStrategyInterface; +use Zend\Hydrator\NamingStrategyEnabledInterface as BaseNamingStrategyEnabledInterface; -interface NamingStrategyEnabledInterface +/** + * @deprecated Use Zend\Hydrator\NamingStrategy\NamingStrategyEnabledInterface from zendframework/zend-hydrator instead. + */ +interface NamingStrategyEnabledInterface extends BaseNamingStrategyEnabledInterface { - /** - * Adds the given naming strategy - * - * @param NamingStrategyInterface $strategy The naming to register. - * @return NamingStrategyEnabledInterface - */ - public function setNamingStrategy(NamingStrategyInterface $strategy); - - /** - * Gets the naming strategy. - * - * @return NamingStrategyInterface - */ - public function getNamingStrategy(); - - /** - * Checks if a naming strategy exists. - * - * @return bool - */ - public function hasNamingStrategy(); - - /** - * Removes the naming with the given name. - * - * @return NamingStrategyEnabledInterface - */ - public function removeNamingStrategy(); } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/ObjectProperty.php b/vendor/zendframework/zend-stdlib/src/Hydrator/ObjectProperty.php index 8b886eb1ef3b9305aaaf32bdb46d8d39af71c4c4..c846fe5d52b041bdce670a1e4f7a12feead1ec52 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/ObjectProperty.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/ObjectProperty.php @@ -9,102 +9,11 @@ namespace Zend\Stdlib\Hydrator; -use Zend\Stdlib\Exception; -use ReflectionClass; -use ReflectionProperty; +use Zend\Hydrator\ObjectProperty as BaseObjectProperty; -class ObjectProperty extends AbstractHydrator +/** + * @deprecated Use Zend\Hydrator\ObjectProperty from zendframework/zend-hydrator instead. + */ +class ObjectProperty extends BaseObjectProperty implements HydratorInterface { - /** - * @var array[] indexed by class name and then property name - */ - private static $skippedPropertiesCache = []; - - /** - * {@inheritDoc} - * - * Extracts the accessible non-static properties of the given $object. - * - * @throws Exception\BadMethodCallException for a non-object $object - */ - public function extract($object) - { - if (!is_object($object)) { - throw new Exception\BadMethodCallException( - sprintf('%s expects the provided $object to be a PHP object)', __METHOD__) - ); - } - - $data = get_object_vars($object); - $filter = $this->getFilter(); - - foreach ($data as $name => $value) { - // Filter keys, removing any we don't want - if (! $filter->filter($name)) { - unset($data[$name]); - continue; - } - - // Replace name if extracted differ - $extracted = $this->extractName($name, $object); - - if ($extracted !== $name) { - unset($data[$name]); - $name = $extracted; - } - - $data[$name] = $this->extractValue($name, $value, $object); - } - - return $data; - } - - /** - * {@inheritDoc} - * - * Hydrate an object by populating public properties - * - * Hydrates an object by setting public properties of the object. - * - * @throws Exception\BadMethodCallException for a non-object $object - */ - public function hydrate(array $data, $object) - { - if (!is_object($object)) { - throw new Exception\BadMethodCallException( - sprintf('%s expects the provided $object to be a PHP object)', __METHOD__) - ); - } - - $properties = & self::$skippedPropertiesCache[get_class($object)]; - - if (! isset($properties)) { - $reflection = new ReflectionClass($object); - $properties = array_fill_keys( - array_map( - function (ReflectionProperty $property) { - return $property->getName(); - }, - $reflection->getProperties( - ReflectionProperty::IS_PRIVATE - + ReflectionProperty::IS_PROTECTED - + ReflectionProperty::IS_STATIC - ) - ), - true - ); - } - - foreach ($data as $name => $value) { - $property = $this->hydrateName($name, $data); - - if (isset($properties[$property])) { - continue; - } - - $object->$property = $this->hydrateValue($property, $value, $data); - } - - return $object; - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Reflection.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Reflection.php index a963d1f60cc80074339b1e7ca1f168f95d4f8a63..22d8cdfde3d371c9ab9bd85c37ab3c4d569ab244 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Reflection.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Reflection.php @@ -9,87 +9,11 @@ namespace Zend\Stdlib\Hydrator; -use ReflectionClass; -use Zend\Stdlib\Exception; +use Zend\Hydrator\Reflection as BaseReflection; -class Reflection extends AbstractHydrator +/** + * @deprecated Use Zend\Hydrator\Reflection from zendframework/zend-hydrator instead. + */ +class Reflection extends BaseReflection implements HydratorInterface { - /** - * Simple in-memory array cache of ReflectionProperties used. - * @var \ReflectionProperty[] - */ - protected static $reflProperties = []; - - /** - * Extract values from an object - * - * @param object $object - * @return array - */ - public function extract($object) - { - $result = []; - foreach (self::getReflProperties($object) as $property) { - $propertyName = $this->extractName($property->getName(), $object); - if (!$this->filterComposite->filter($propertyName)) { - continue; - } - - $value = $property->getValue($object); - $result[$propertyName] = $this->extractValue($propertyName, $value, $object); - } - - return $result; - } - - /** - * Hydrate $object with the provided $data. - * - * @param array $data - * @param object $object - * @return object - */ - public function hydrate(array $data, $object) - { - $reflProperties = self::getReflProperties($object); - foreach ($data as $key => $value) { - $name = $this->hydrateName($key, $data); - if (isset($reflProperties[$name])) { - $reflProperties[$name]->setValue($object, $this->hydrateValue($name, $value, $data)); - } - } - return $object; - } - - /** - * Get a reflection properties from in-memory cache and lazy-load if - * class has not been loaded. - * - * @param string|object $input - * @throws Exception\InvalidArgumentException - * @return \ReflectionProperty[] - */ - protected static function getReflProperties($input) - { - if (is_object($input)) { - $input = get_class($input); - } elseif (!is_string($input)) { - throw new Exception\InvalidArgumentException('Input must be a string or an object.'); - } - - if (isset(static::$reflProperties[$input])) { - return static::$reflProperties[$input]; - } - - static::$reflProperties[$input] = []; - $reflClass = new ReflectionClass($input); - $reflProperties = $reflClass->getProperties(); - - foreach ($reflProperties as $property) { - $property->setAccessible(true); - static::$reflProperties[$input][$property->getName()] = $property; - } - - return static::$reflProperties[$input]; - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/BooleanStrategy.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/BooleanStrategy.php index 3c29231f34c5c551ee84b61fd124bcd0ce3a19f1..d89f507114af6e59ae47f3f16b6cf167edf55921 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/BooleanStrategy.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/BooleanStrategy.php @@ -9,98 +9,13 @@ namespace Zend\Stdlib\Hydrator\Strategy; -use Zend\Stdlib\Exception\InvalidArgumentException; +use Zend\Hydrator\Strategy\BooleanStrategy as BaseBooleanStrategy; /** * This Strategy extracts and hydrates int and string values to Boolean values * - * @package Zend\Stdlib\Hydrator\Strategy + * @deprecated Use Zend\Hydrator\Strategy\BooleanStrategy from zendframework/zend-hydrator instead. */ -final class BooleanStrategy implements StrategyInterface +class BooleanStrategy extends BaseBooleanStrategy implements StrategyInterface { - /** - * @var int|string - */ - private $trueValue; - - /** - * @var int|string - */ - private $falseValue; - - /** - * @param int|string $trueValue - * @param int|string $falseValue - * @throws InvalidArgumentException - */ - public function __construct($trueValue, $falseValue) - { - if (!is_int($trueValue) && !is_string($trueValue)) { - throw new InvalidArgumentException(sprintf( - 'Unable to instantiate BooleanStrategy. Expected int or string as $trueValue. %s was given', - is_object($trueValue) ? get_class($trueValue) : gettype($trueValue) - )); - } - - if (!is_int($falseValue) && !is_string($falseValue)) { - throw new InvalidArgumentException(sprintf( - 'Unable to instantiate BooleanStrategy. Expected int or string as $falseValue. %s was given', - is_object($falseValue) ? get_class($falseValue) : gettype($falseValue) - )); - } - - $this->trueValue = $trueValue; - $this->falseValue = $falseValue; - } - - /** - * Converts the given value so that it can be extracted by the hydrator. - * - * @param bool $value The original value. - * @throws InvalidArgumentException - * @return int|string Returns the value that should be extracted. - */ - public function extract($value) - { - if (!is_bool($value)) { - throw new InvalidArgumentException(sprintf( - 'Unable to extract. Expected bool. %s was given.', - is_object($value) ? get_class($value) : gettype($value) - )); - } - - return $value === true ? $this->trueValue : $this->falseValue; - } - - /** - * Converts the given value so that it can be hydrated by the hydrator. - * - * @param int|string $value The original value. - * @throws InvalidArgumentException - * @return bool Returns the value that should be hydrated. - */ - public function hydrate($value) - { - if (!is_string($value) && !is_int($value)) { - throw new InvalidArgumentException(sprintf( - 'Unable to hydrate. Expected string or int. %s was given.', - is_object($value) ? get_class($value) : gettype($value) - )); - } - - if ($value === $this->trueValue) { - return true; - } - - if ($value === $this->falseValue) { - return false; - } - - throw new InvalidArgumentException(sprintf( - 'Unexpected value %s can\'t be hydrated. Expect %s or %s as Value.', - $value, - $this->trueValue, - $this->falseValue - )); - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/ClosureStrategy.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/ClosureStrategy.php index bf456a7fc434991ba4ae49654cf05f8800de0da3..32572226f214c1c3b144a128994049dfd9e84ff2 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/ClosureStrategy.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/ClosureStrategy.php @@ -9,94 +9,11 @@ namespace Zend\Stdlib\Hydrator\Strategy; -class ClosureStrategy implements StrategyInterface -{ - /** - * Function, used in extract method, default: - * function ($value) { - * return $value; - * }; - * @var callable - */ - protected $extractFunc = null; - - /** - * Function, used in hydrate method, default: - * function ($value) { - * return $value; - * }; - * @var callable - */ - protected $hydrateFunc = null; - - /** - * You can describe how your values will extract and hydrate, like this: - * $hydrator->addStrategy('category', new ClosureStrategy( - * function (Category $value) { - * return (int) $value->id; - * }, - * function ($value) { - * return new Category((int) $value); - * } - * )); - * - * @param callable $extractFunc - anonymous function, that extract values - * from object - * @param callable $hydrateFunc - anonymous function, that hydrate values - * into object - */ - public function __construct($extractFunc = null, $hydrateFunc = null) - { - if (isset($extractFunc)) { - if (!is_callable($extractFunc)) { - throw new \Exception('$extractFunc must be callable'); - } - - $this->extractFunc = $extractFunc; - } else { - $this->extractFunc = function ($value) { - return $value; - }; - } - - if (isset($hydrateFunc)) { - if (!is_callable($hydrateFunc)) { - throw new \Exception('$hydrateFunc must be callable'); - } - - $this->hydrateFunc = $hydrateFunc; - } else { - $this->hydrateFunc = function ($value) { - return $value; - }; - } - } +use Zend\Hydrator\Strategy\ClosureStrategy as BaseClosureStrategy; - /** - * Converts the given value so that it can be extracted by the hydrator. - * - * @param mixed $value The original value. - * @param array $object The object is optionally provided as context. - * @return mixed Returns the value that should be extracted. - */ - public function extract($value, $object = null) - { - $func = $this->extractFunc; - - return $func($value, $object); - } - - /** - * Converts the given value so that it can be hydrated by the hydrator. - * - * @param mixed $value The original value. - * @param array $data The whole data is optionally provided as context. - * @return mixed Returns the value that should be hydrated. - */ - public function hydrate($value, $data = null) - { - $func = $this->hydrateFunc; - - return $func($value, $data); - } +/** + * @deprecated Use Zend\Hydrator\Strategy\ClosureStrategy from zendframework/zend-hydrator instead. + */ +class ClosureStrategy extends BaseClosureStrategy implements StrategyInterface +{ } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/DateTimeFormatterStrategy.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/DateTimeFormatterStrategy.php index 62d92c588bc4d042e4e010152ef0485b53efb137..8e633f322fb704937d26bdecccfae38eb23d0cbd 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/DateTimeFormatterStrategy.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/DateTimeFormatterStrategy.php @@ -9,72 +9,11 @@ namespace Zend\Stdlib\Hydrator\Strategy; -use DateTime; -use DateTimeZone; +use Zend\Hydrator\Strategy\DateTimeFormatterStrategy as BaseDateTimeFormatterStrategy; -final class DateTimeFormatterStrategy implements StrategyInterface +/** + * @deprecated Use Zend\Hydrator\Strategy\DateTimeFormatterStrategy from zendframework/zend-hydrator instead. + */ +class DateTimeFormatterStrategy extends BaseDateTimeFormatterStrategy implements StrategyInterface { - /** - * @var string - */ - private $format; - - /** - * @var DateTimeZone|null - */ - private $timezone; - - /** - * Constructor - * - * @param string $format - * @param DateTimeZone|null $timezone - */ - public function __construct($format = DateTime::RFC3339, DateTimeZone $timezone = null) - { - $this->format = (string) $format; - $this->timezone = $timezone; - } - - /** - * {@inheritDoc} - * - * Converts to date time string - * - * @param mixed|DateTime $value - * - * @return mixed|string - */ - public function extract($value) - { - if ($value instanceof DateTime) { - return $value->format($this->format); - } - - return $value; - } - - /** - * Converts date time string to DateTime instance for injecting to object - * - * {@inheritDoc} - * - * @param mixed|string $value - * - * @return mixed|DateTime - */ - public function hydrate($value) - { - if ($value === '' || $value === null) { - return; - } - - if ($this->timezone) { - $hydrated = DateTime::createFromFormat($this->format, $value, $this->timezone); - } else { - $hydrated = DateTime::createFromFormat($this->format, $value); - } - - return $hydrated ?: $value; - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/DefaultStrategy.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/DefaultStrategy.php index b2c5c29b433a319a11e27f0b92f9fe0fe72a02ba..155c82f0ffdbbf190c89b24db3920f6e9bc57090 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/DefaultStrategy.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/DefaultStrategy.php @@ -9,27 +9,11 @@ namespace Zend\Stdlib\Hydrator\Strategy; -class DefaultStrategy implements StrategyInterface -{ - /** - * Converts the given value so that it can be extracted by the hydrator. - * - * @param mixed $value The original value. - * @return mixed Returns the value that should be extracted. - */ - public function extract($value) - { - return $value; - } +use Zend\Hydrator\Strategy\DefaultStrategy as BaseDefaultStrategy; - /** - * Converts the given value so that it can be hydrated by the hydrator. - * - * @param mixed $value The original value. - * @return mixed Returns the value that should be hydrated. - */ - public function hydrate($value) - { - return $value; - } +/** + * @deprecated Use Zend\Hydrator\Strategy\DefaultStrategy from zendframework/zend-hydrator instead. + */ +class DefaultStrategy extends BaseDefaultStrategy implements StrategyInterface +{ } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/Exception/ExceptionInterface.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/Exception/ExceptionInterface.php index c7b576ce3c0324a87729597ba2c3b099d548ba5c..16a921be1a32e9d07c253b446b48d38dcf9aaee3 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/Exception/ExceptionInterface.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/Exception/ExceptionInterface.php @@ -9,6 +9,11 @@ namespace Zend\Stdlib\Hydrator\Strategy\Exception; -interface ExceptionInterface +use Zend\Hydrator\Strategy\Exception; + +/** + * @deprecated Use Zend\Hydrator\Strategy\Exception\ExceptionInterface from zendframework/zend-hydrator instead. + */ +interface ExceptionInterface extends Exception\ExceptionInterface { } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/Exception/InvalidArgumentException.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/Exception/InvalidArgumentException.php index 2e6510df45e0bfe39c0c53c9a9ca863caff894f4..10f69a244a0cdc8fc4a8d2a4d12aec4e2b5e0bf6 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/Exception/InvalidArgumentException.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/Exception/InvalidArgumentException.php @@ -9,6 +9,11 @@ namespace Zend\Stdlib\Hydrator\Strategy\Exception; -class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface +use Zend\Hydrator\Strategy\Exception\InvalidArgumentException as BaseInvalidArgumentException; + +/** + * @deprecated Use Zend\Hydrator\Strategy\Exception\InvalidArgumentException from zendframework/zend-hydrator instead. + */ +class InvalidArgumentException extends BaseInvalidArgumentException implements ExceptionInterface { } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/ExplodeStrategy.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/ExplodeStrategy.php index 97c790b0cac19264412e6ee32c401fc650b91a8a..ca7e5851c22ca38799d637413198a501d3c58d52 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/ExplodeStrategy.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/ExplodeStrategy.php @@ -9,105 +9,11 @@ namespace Zend\Stdlib\Hydrator\Strategy; -final class ExplodeStrategy implements StrategyInterface -{ - /** - * @var string - */ - private $valueDelimiter; - - /** - * @var int|null - */ - private $explodeLimit; - - /** - * Constructor - * - * @param string $delimiter String that the values will be split upon - * @param int|null $explodeLimit Explode limit - */ - public function __construct($delimiter = ',', $explodeLimit = null) - { - $this->setValueDelimiter($delimiter); - - $this->explodeLimit = ($explodeLimit === null) ? null : (int) $explodeLimit; - } - - /** - * Sets the delimiter string that the values will be split upon - * - * @param string $delimiter - * @return self - */ - private function setValueDelimiter($delimiter) - { - if (!is_string($delimiter)) { - throw new Exception\InvalidArgumentException(sprintf( - '%s expects Delimiter to be string, %s provided instead', - __METHOD__, - is_object($delimiter) ? get_class($delimiter) : gettype($delimiter) - )); - } - - if (empty($delimiter)) { - throw new Exception\InvalidArgumentException('Delimiter cannot be empty.'); - } - - $this->valueDelimiter = $delimiter; - } - - /** - * {@inheritDoc} - * - * Split a string by delimiter - * - * @param string|null $value - * - * @return string[] - * - * @throws Exception\InvalidArgumentException - */ - public function hydrate($value) - { - if (null === $value) { - return []; - } +use Zend\Hydrator\Strategy\ExplodeStrategy as BaseExplodeStrategy; - if (!(is_string($value) || is_numeric($value))) { - throw new Exception\InvalidArgumentException(sprintf( - '%s expects argument 1 to be string, %s provided instead', - __METHOD__, - is_object($value) ? get_class($value) : gettype($value) - )); - } - - if ($this->explodeLimit !== null) { - return explode($this->valueDelimiter, $value, $this->explodeLimit); - } - - return explode($this->valueDelimiter, $value); - } - - /** - * {@inheritDoc} - * - * Join array elements with delimiter - * - * @param string[] $value The original value. - * - * @return string|null - */ - public function extract($value) - { - if (!is_array($value)) { - throw new Exception\InvalidArgumentException(sprintf( - '%s expects argument 1 to be array, %s provided instead', - __METHOD__, - is_object($value) ? get_class($value) : gettype($value) - )); - } - - return empty($value) ? null : implode($this->valueDelimiter, $value); - } +/** + * @deprecated Use Zend\Hydrator\Strategy\ExplodeStrategy from zendframework/zend-hydrator instead. + */ +class ExplodeStrategy extends BaseExplodeStrategy implements StrategyInterface +{ } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/SerializableStrategy.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/SerializableStrategy.php index 51549ddad80099787ac1fb1e6a02c1d38ea6919d..04527923131e9fc456592ab02497fcb9bcfd6491 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/SerializableStrategy.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/SerializableStrategy.php @@ -9,115 +9,11 @@ namespace Zend\Stdlib\Hydrator\Strategy; -use Zend\Stdlib\Exception\InvalidArgumentException; -use Zend\Serializer\Adapter\AdapterInterface as SerializerAdapter; -use Zend\Serializer\Serializer as SerializerFactory; +use Zend\Hydrator\Strategy\SerializableStrategy as BaseSerializableStrategy; -class SerializableStrategy implements StrategyInterface +/** + * @deprecated Use Zend\Hydrator\Strategy\SerializableStrategy from zendframework/zend-hydrator instead. + */ +class SerializableStrategy extends BaseSerializableStrategy implements StrategyInterface { - /** - * @var string|SerializerAdapter - */ - protected $serializer; - - /** - * @var array - */ - protected $serializerOptions = []; - - /** - * - * @param mixed $serializer string or SerializerAdapter - * @param mixed $serializerOptions - */ - public function __construct($serializer, $serializerOptions = null) - { - $this->setSerializer($serializer); - if ($serializerOptions) { - $this->setSerializerOptions($serializerOptions); - } - } - - /** - * Serialize the given value so that it can be extracted by the hydrator. - * - * @param mixed $value The original value. - * @return mixed Returns the value that should be extracted. - */ - public function extract($value) - { - $serializer = $this->getSerializer(); - return $serializer->serialize($value); - } - - /** - * Unserialize the given value so that it can be hydrated by the hydrator. - * - * @param mixed $value The original value. - * @return mixed Returns the value that should be hydrated. - */ - public function hydrate($value) - { - $serializer = $this->getSerializer(); - return $serializer->unserialize($value); - } - - /** - * Set serializer - * - * @param string|SerializerAdapter $serializer - * @return SerializableStrategy - */ - public function setSerializer($serializer) - { - if (!is_string($serializer) && !$serializer instanceof SerializerAdapter) { - throw new InvalidArgumentException(sprintf( - '%s expects either a string serializer name or Zend\Serializer\Adapter\AdapterInterface instance; ' - . 'received "%s"', - __METHOD__, - (is_object($serializer) ? get_class($serializer) : gettype($serializer)) - )); - } - $this->serializer = $serializer; - return $this; - } - - /** - * Get serializer - * - * @return SerializerAdapter - */ - public function getSerializer() - { - if (is_string($this->serializer)) { - $options = $this->getSerializerOptions(); - $this->setSerializer(SerializerFactory::factory($this->serializer, $options)); - } elseif (null === $this->serializer) { - $this->setSerializer(SerializerFactory::getDefaultAdapter()); - } - - return $this->serializer; - } - - /** - * Set configuration options for instantiating a serializer adapter - * - * @param mixed $serializerOptions - * @return SerializableStrategy - */ - public function setSerializerOptions($serializerOptions) - { - $this->serializerOptions = $serializerOptions; - return $this; - } - - /** - * Get configuration options for instantiating a serializer adapter - * - * @return mixed - */ - public function getSerializerOptions() - { - return $this->serializerOptions; - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/StrategyChain.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/StrategyChain.php index a9316bbd7c0c1581881a97f6a09b94c543de0ac9..33d2bc13e8d5b55f11a3b5fd4704c51d937f5f1f 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/StrategyChain.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/StrategyChain.php @@ -9,65 +9,11 @@ namespace Zend\Stdlib\Hydrator\Strategy; -use Traversable; -use Zend\Stdlib\ArrayUtils; +use Zend\Hydrator\Strategy\StrategyChain as BaseStrategyChain; -final class StrategyChain implements StrategyInterface +/** + * @deprecated Use Zend\Hydrator\Strategy\StrategyChain from zendframework/zend-hydrator instead. + */ +class StrategyChain extends BaseStrategyChain implements StrategyInterface { - /** - * Strategy chain for extraction - * - * @var StrategyInterface[] - */ - private $extractionStrategies; - - /** - * Strategy chain for hydration - * - * @var StrategyInterface[] - */ - private $hydrationStrategies; - - /** - * Constructor - * - * @param array|Traversable $extractionStrategies - */ - public function __construct($extractionStrategies) - { - $extractionStrategies = ArrayUtils::iteratorToArray($extractionStrategies); - $this->extractionStrategies = array_map( - function (StrategyInterface $strategy) { - // this callback is here only to ensure type-safety - return $strategy; - }, - $extractionStrategies - ); - - $this->hydrationStrategies = array_reverse($extractionStrategies); - } - - /** - * {@inheritDoc} - */ - public function extract($value) - { - foreach ($this->extractionStrategies as $strategy) { - $value = $strategy->extract($value); - } - - return $value; - } - - /** - * {@inheritDoc} - */ - public function hydrate($value) - { - foreach ($this->hydrationStrategies as $strategy) { - $value = $strategy->hydrate($value); - } - - return $value; - } } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/StrategyInterface.php b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/StrategyInterface.php index 562ec4bd6c12ef761eb3d7e6d5088b0c177dbf0e..a1eb8e906dbba8ada51a0d70326ab15fb4c2316f 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/StrategyInterface.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/StrategyInterface.php @@ -9,26 +9,11 @@ namespace Zend\Stdlib\Hydrator\Strategy; +use Zend\Hydrator\Strategy\StrategyInterface as BaseStrategyInterface; + /** - * @todo v3.0, add optional object/data to extract/hydrate. + * @deprecated Use Zend\Hydrator\Strategy\StrategyInterface from zendframework/zend-hydrator instead. */ -interface StrategyInterface +interface StrategyInterface extends BaseStrategyInterface { - /** - * Converts the given value so that it can be extracted by the hydrator. - * - * @param mixed $value The original value. - * @param object $object (optional) The original object for context. - * @return mixed Returns the value that should be extracted. - */ - public function extract($value); - - /** - * Converts the given value so that it can be hydrated by the hydrator. - * - * @param mixed $value The original value. - * @param array $data (optional) The original data for context. - * @return mixed Returns the value that should be hydrated. - */ - public function hydrate($value); } diff --git a/vendor/zendframework/zend-stdlib/src/Hydrator/StrategyEnabledInterface.php b/vendor/zendframework/zend-stdlib/src/Hydrator/StrategyEnabledInterface.php index 6f29b16a6dda73f76481b4dee5b20f7f11f7cace..9c058a7120aa1015a9743ae2c01ad831f9ced424 100644 --- a/vendor/zendframework/zend-stdlib/src/Hydrator/StrategyEnabledInterface.php +++ b/vendor/zendframework/zend-stdlib/src/Hydrator/StrategyEnabledInterface.php @@ -9,40 +9,11 @@ namespace Zend\Stdlib\Hydrator; -use Zend\Stdlib\Hydrator\Strategy\StrategyInterface; +use Zend\Hydrator\StrategyEnabledInterface as BaseStrategyEnabledInterface; -interface StrategyEnabledInterface +/** + * @deprecated Use Zend\Hydrator\Strategy\StrategyEnabledInterface from zendframework/zend-hydrator instead. + */ +interface StrategyEnabledInterface extends BaseStrategyEnabledInterface { - /** - * Adds the given strategy under the given name. - * - * @param string $name The name of the strategy to register. - * @param StrategyInterface $strategy The strategy to register. - * @return StrategyEnabledInterface - */ - public function addStrategy($name, StrategyInterface $strategy); - - /** - * Gets the strategy with the given name. - * - * @param string $name The name of the strategy to get. - * @return StrategyInterface - */ - public function getStrategy($name); - - /** - * Checks if the strategy with the given name exists. - * - * @param string $name The name of the strategy to check for. - * @return bool - */ - public function hasStrategy($name); - - /** - * Removes the strategy with the given name. - * - * @param string $name The name of the strategy to remove. - * @return StrategyEnabledInterface - */ - public function removeStrategy($name); }