diff --git a/core/composer.json b/core/composer.json index b1547dfed462..74fe45b0d2b6 100644 --- a/core/composer.json +++ b/core/composer.json @@ -19,7 +19,7 @@ "symfony/process": "2.7.*", "symfony/yaml": "2.7.*", "twig/twig": "1.20.*", - "doctrine/common": "~2.4.2", + "doctrine/common": "2.5.*", "doctrine/annotations": "1.2.*", "guzzlehttp/guzzle": "dev-master#1879fbe853b0c64d109e369c7aeff09849e62d1e", "symfony-cmf/routing": "1.3.*", diff --git a/core/composer.lock b/core/composer.lock index 2ce605c5e7e9..766c508e86df 100644 --- a/core/composer.lock +++ b/core/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "6d065bd806544df5f446905bc3d6379f", + "hash": "775f6be68f3d5efa8872e99cdf0e2f83", "packages": [ { "name": "behat/mink", @@ -126,7 +126,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/minkphp/MinkGoutteDriver/zipball/cc5ce119b5a8e06662f634b35967aff0b0c7dfdd", + "url": "https://api.github.com/repos/minkphp/MinkGoutteDriver/zipball/7e9a7319cc0e8cf9d4d4c9e06e2020d3a31bd792", "reference": "cc5ce119b5a8e06662f634b35967aff0b0c7dfdd", "shasum": "" }, @@ -170,16 +170,16 @@ }, { "name": "doctrine/annotations", - "version": "v1.2.1", + "version": "v1.2.7", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "6a6bec0670bb6e71a263b08bc1b98ea242928633" + "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/6a6bec0670bb6e71a263b08bc1b98ea242928633", - "reference": "6a6bec0670bb6e71a263b08bc1b98ea242928633", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535", + "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535", "shasum": "" }, "require": { @@ -234,20 +234,20 @@ "docblock", "parser" ], - "time": "2014-09-25 16:45:30" + "time": "2015-08-31 12:32:49" }, { "name": "doctrine/cache", - "version": "v1.3.1", + "version": "v1.4.2", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7" + "reference": "8c434000f420ade76a07c64cbe08ca47e5c101ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/cf483685798a72c93bf4206e3dd6358ea07d64e7", - "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7", + "url": "https://api.github.com/repos/doctrine/cache/zipball/8c434000f420ade76a07c64cbe08ca47e5c101ca", + "reference": "8c434000f420ade76a07c64cbe08ca47e5c101ca", "shasum": "" }, "require": { @@ -258,12 +258,13 @@ }, "require-dev": { "phpunit/phpunit": ">=3.7", + "predis/predis": "~1.0", "satooshi/php-coveralls": "~0.6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "1.5.x-dev" } }, "autoload": { @@ -303,25 +304,28 @@ "cache", "caching" ], - "time": "2014-09-17 14:24:04" + "time": "2015-08-31 12:36:41" }, { "name": "doctrine/collections", - "version": "v1.2", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/collections.git", - "reference": "b99c5c46c87126201899afe88ec490a25eedd6a2" + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/b99c5c46c87126201899afe88ec490a25eedd6a2", - "reference": "b99c5c46c87126201899afe88ec490a25eedd6a2", + "url": "https://api.github.com/repos/doctrine/collections/zipball/6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a", "shasum": "" }, "require": { "php": ">=5.3.2" }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, "type": "library", "extra": { "branch-alias": { @@ -338,17 +342,6 @@ "MIT" ], "authors": [ - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/", - "role": "Creator" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", - "homepage": "http://www.instaclick.com" - }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -357,11 +350,17 @@ "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, { "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", - "role": "Developer of wrapped JMSSerializerBundle" + "email": "schmittjoh@gmail.com" } ], "description": "Collections Abstraction library", @@ -371,20 +370,20 @@ "collections", "iterator" ], - "time": "2014-02-03 23:07:43" + "time": "2015-04-14 22:21:58" }, { "name": "doctrine/common", - "version": "v2.4.2", + "version": "v2.5.1", "source": { "type": "git", "url": "https://github.com/doctrine/common.git", - "reference": "5db6ab40e4c531f14dad4ca96a394dfce5d4255b" + "reference": "0009b8f0d4a917aabc971fb089eba80e872f83f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/5db6ab40e4c531f14dad4ca96a394dfce5d4255b", - "reference": "5db6ab40e4c531f14dad4ca96a394dfce5d4255b", + "url": "https://api.github.com/repos/doctrine/common/zipball/0009b8f0d4a917aabc971fb089eba80e872f83f9", + "reference": "0009b8f0d4a917aabc971fb089eba80e872f83f9", "shasum": "" }, "require": { @@ -401,7 +400,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4.x-dev" + "dev-master": "2.6.x-dev" } }, "autoload": { @@ -414,17 +413,6 @@ "MIT" ], "authors": [ - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/", - "role": "Creator" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", - "homepage": "http://www.instaclick.com" - }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -433,11 +421,17 @@ "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, { "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", - "role": "Developer of wrapped JMSSerializerBundle" + "email": "schmittjoh@gmail.com" } ], "description": "Common Library for Doctrine projects", @@ -449,26 +443,34 @@ "persistence", "spl" ], - "time": "2014-05-21 19:28:51" + "time": "2015-08-31 13:00:22" }, { "name": "doctrine/inflector", - "version": "v1.0", + "version": "v1.0.1", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "v1.0" + "reference": "0bcb2e79d8571787f18b7eb036ed3d004908e604" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/54b8333d2a5682afdc690060c1cf384ba9f47f08", - "reference": "v1.0", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/0bcb2e79d8571787f18b7eb036ed3d004908e604", + "reference": "0bcb2e79d8571787f18b7eb036ed3d004908e604", "shasum": "" }, "require": { "php": ">=5.3.2" }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { "psr-0": { "Doctrine\\Common\\Inflector\\": "lib/" @@ -479,16 +481,6 @@ "MIT" ], "authors": [ - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", - "homepage": "http://www.instaclick.com" - }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -498,34 +490,40 @@ "email": "kontakt@beberlei.de" }, { - "name": "Johannes M. Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", - "role": "Developer of wrapped JMSSerializerBundle" + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" } ], "description": "Common String Manipulations with regard to casing and singular/plural rules.", "homepage": "http://www.doctrine-project.org", "keywords": [ "inflection", - "pluarlize", - "singuarlize", + "pluralize", + "singularize", "string" ], - "time": "2013-01-10 21:49:15" + "time": "2014-12-20 21:24:13" }, { "name": "doctrine/instantiator", - "version": "1.0.4", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119" + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", "shasum": "" }, "require": { @@ -536,7 +534,7 @@ "ext-pdo": "*", "ext-phar": "*", "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "2.0.*@ALPHA" + "squizlabs/php_codesniffer": "~2.0" }, "type": "library", "extra": { @@ -545,8 +543,8 @@ } }, "autoload": { - "psr-0": { - "Doctrine\\Instantiator\\": "src" + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" } }, "notification-url": "https://packagist.org/downloads/", @@ -566,7 +564,7 @@ "constructor", "instantiate" ], - "time": "2014-10-13 12:58:55" + "time": "2015-06-14 21:17:01" }, { "name": "doctrine/lexer", @@ -796,7 +794,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d687700d601f8b5f19b99ffc1c0f6af835a3c7b7", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/33af93ab4b5e76df7a4c774910590f814a3e576c", "reference": "1879fbe853b0c64d109e369c7aeff09849e62d1e", "shasum": "" }, diff --git a/core/vendor/composer/autoload_namespaces.php b/core/vendor/composer/autoload_namespaces.php index 63f4b704af3e..4ab08c810db2 100644 --- a/core/vendor/composer/autoload_namespaces.php +++ b/core/vendor/composer/autoload_namespaces.php @@ -14,7 +14,6 @@ return array( 'Prophecy\\' => array($vendorDir . '/phpspec/prophecy/src'), 'Egulias\\' => array($vendorDir . '/egulias/email-validator/src'), 'EasyRdf_' => array($vendorDir . '/easyrdf/easyrdf/lib'), - 'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src'), 'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib'), 'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib'), 'Doctrine\\Common\\Collections\\' => array($vendorDir . '/doctrine/collections/lib'), diff --git a/core/vendor/composer/autoload_psr4.php b/core/vendor/composer/autoload_psr4.php index aeaabc1b58a9..1d8824afd4f3 100644 --- a/core/vendor/composer/autoload_psr4.php +++ b/core/vendor/composer/autoload_psr4.php @@ -37,6 +37,7 @@ return array( 'Drupal\\Driver\\' => array($baseDir . '/../drivers/lib/Drupal/Driver'), 'Drupal\\Core\\' => array($baseDir . '/lib/Drupal/Core'), 'Drupal\\Component\\' => array($baseDir . '/lib/Drupal/Component'), + 'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'), 'Behat\\Mink\\Driver\\' => array($vendorDir . '/behat/mink-goutte-driver/src'), 'Behat\\Mink\\' => array($vendorDir . '/behat/mink/src'), ); diff --git a/core/vendor/composer/installed.json b/core/vendor/composer/installed.json index e406431a18d7..9d0305393ff1 100644 --- a/core/vendor/composer/installed.json +++ b/core/vendor/composer/installed.json @@ -1,280 +1,4 @@ [ - { - "name": "doctrine/inflector", - "version": "v1.0", - "version_normalized": "1.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/inflector.git", - "reference": "v1.0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/54b8333d2a5682afdc690060c1cf384ba9f47f08", - "reference": "v1.0", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "time": "2013-01-10 21:49:15", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "Doctrine\\Common\\Inflector\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", - "homepage": "http://www.instaclick.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Johannes M. Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", - "role": "Developer of wrapped JMSSerializerBundle" - } - ], - "description": "Common String Manipulations with regard to casing and singular/plural rules.", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "inflection", - "pluarlize", - "singuarlize", - "string" - ] - }, - { - "name": "doctrine/collections", - "version": "v1.2", - "version_normalized": "1.2.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/collections.git", - "reference": "b99c5c46c87126201899afe88ec490a25eedd6a2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/b99c5c46c87126201899afe88ec490a25eedd6a2", - "reference": "b99c5c46c87126201899afe88ec490a25eedd6a2", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "time": "2014-02-03 23:07:43", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Doctrine\\Common\\Collections\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/", - "role": "Creator" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", - "homepage": "http://www.instaclick.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", - "role": "Developer of wrapped JMSSerializerBundle" - } - ], - "description": "Collections Abstraction library", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "array", - "collections", - "iterator" - ] - }, - { - "name": "doctrine/cache", - "version": "v1.3.1", - "version_normalized": "1.3.1.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/cache.git", - "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/cf483685798a72c93bf4206e3dd6358ea07d64e7", - "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "conflict": { - "doctrine/common": ">2.2,<2.4" - }, - "require-dev": { - "phpunit/phpunit": ">=3.7", - "satooshi/php-coveralls": "~0.6" - }, - "time": "2014-09-17 14:24:04", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Doctrine\\Common\\Cache\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Caching library offering an object-oriented API for many cache backends", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "cache", - "caching" - ] - }, - { - "name": "doctrine/annotations", - "version": "v1.2.1", - "version_normalized": "1.2.1.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "6a6bec0670bb6e71a263b08bc1b98ea242928633" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/6a6bec0670bb6e71a263b08bc1b98ea242928633", - "reference": "6a6bec0670bb6e71a263b08bc1b98ea242928633", - "shasum": "" - }, - "require": { - "doctrine/lexer": "1.*", - "php": ">=5.3.2" - }, - "require-dev": { - "doctrine/cache": "1.*", - "phpunit/phpunit": "4.*" - }, - "time": "2014-09-25 16:45:30", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Doctrine\\Common\\Annotations\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "annotations", - "docblock", - "parser" - ] - }, { "name": "phpunit/php-text-template", "version": "1.2.0", @@ -321,62 +45,6 @@ "template" ] }, - { - "name": "doctrine/instantiator", - "version": "1.0.4", - "version_normalized": "1.0.4.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119", - "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.*@ALPHA" - }, - "time": "2014-10-13 12:58:55", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Doctrine\\Instantiator\\": "src" - } - }, - "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" - ] - }, { "name": "phpunit/php-timer", "version": "1.0.5", @@ -691,86 +359,6 @@ "global state" ] }, - { - "name": "doctrine/common", - "version": "v2.4.2", - "version_normalized": "2.4.2.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/common.git", - "reference": "5db6ab40e4c531f14dad4ca96a394dfce5d4255b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/5db6ab40e4c531f14dad4ca96a394dfce5d4255b", - "reference": "5db6ab40e4c531f14dad4ca96a394dfce5d4255b", - "shasum": "" - }, - "require": { - "doctrine/annotations": "1.*", - "doctrine/cache": "1.*", - "doctrine/collections": "1.*", - "doctrine/inflector": "1.*", - "doctrine/lexer": "1.*", - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "~3.7" - }, - "time": "2014-05-21 19:28:51", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Doctrine\\Common\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/", - "role": "Creator" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", - "homepage": "http://www.instaclick.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", - "role": "Developer of wrapped JMSSerializerBundle" - } - ], - "description": "Common Library for Doctrine projects", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "annotations", - "collections", - "eventmanager", - "persistence", - "spl" - ] - }, { "name": "behat/mink", "version": "v1.6.1", @@ -2121,7 +1709,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d687700d601f8b5f19b99ffc1c0f6af835a3c7b7", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/33af93ab4b5e76df7a4c774910590f814a3e576c", "reference": "1879fbe853b0c64d109e369c7aeff09849e62d1e", "shasum": "" }, @@ -2236,7 +1824,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/minkphp/MinkGoutteDriver/zipball/cc5ce119b5a8e06662f634b35967aff0b0c7dfdd", + "url": "https://api.github.com/repos/minkphp/MinkGoutteDriver/zipball/7e9a7319cc0e8cf9d4d4c9e06e2020d3a31bd792", "reference": "cc5ce119b5a8e06662f634b35967aff0b0c7dfdd", "shasum": "" }, @@ -3477,5 +3065,415 @@ "stream", "uri" ] + }, + { + "name": "doctrine/common", + "version": "v2.5.1", + "version_normalized": "2.5.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "0009b8f0d4a917aabc971fb089eba80e872f83f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/0009b8f0d4a917aabc971fb089eba80e872f83f9", + "reference": "0009b8f0d4a917aabc971fb089eba80e872f83f9", + "shasum": "" + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "~3.7" + }, + "time": "2015-08-31 13:00:22", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common Library for Doctrine projects", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "collections", + "eventmanager", + "persistence", + "spl" + ] + }, + { + "name": "doctrine/annotations", + "version": "v1.2.7", + "version_normalized": "1.2.7.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535", + "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": ">=5.3.2" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "4.*" + }, + "time": "2015-08-31 12:32:49", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Annotations\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ] + }, + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "version_normalized": "1.0.5.0", + "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" + }, + "time": "2015-06-14 21:17:01", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "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" + ] + }, + { + "name": "doctrine/cache", + "version": "v1.4.2", + "version_normalized": "1.4.2.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "8c434000f420ade76a07c64cbe08ca47e5c101ca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/8c434000f420ade76a07c64cbe08ca47e5c101ca", + "reference": "8c434000f420ade76a07c64cbe08ca47e5c101ca", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "phpunit/phpunit": ">=3.7", + "predis/predis": "~1.0", + "satooshi/php-coveralls": "~0.6" + }, + "time": "2015-08-31 12:36:41", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Cache\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ] + }, + { + "name": "doctrine/collections", + "version": "v1.3.0", + "version_normalized": "1.3.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "time": "2015-04-14 22:21:58", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Collections\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "array", + "collections", + "iterator" + ] + }, + { + "name": "doctrine/inflector", + "version": "v1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "0bcb2e79d8571787f18b7eb036ed3d004908e604" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/0bcb2e79d8571787f18b7eb036ed3d004908e604", + "reference": "0bcb2e79d8571787f18b7eb036ed3d004908e604", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "time": "2014-12-20 21:24:13", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Inflector\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string" + ] } ] diff --git a/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php index d55996067b01..4ebd1fb4a00c 100644 --- a/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php +++ b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php @@ -162,13 +162,14 @@ class AnnotationReader implements Reader throw AnnotationException::optimizerPlusSaveComments(); } + if (PHP_VERSION_ID < 70000) { + if (extension_loaded('Zend Optimizer+') && (ini_get('zend_optimizerplus.load_comments') === "0" || ini_get('opcache.load_comments') === "0")) { + throw AnnotationException::optimizerPlusLoadComments(); + } - if (extension_loaded('Zend Optimizer+') && (ini_get('zend_optimizerplus.load_comments') === "0" || ini_get('opcache.load_comments') === "0")) { - throw AnnotationException::optimizerPlusLoadComments(); - } - - if (extension_loaded('Zend OPcache') && ini_get('opcache.load_comments') == 0) { - throw AnnotationException::optimizerPlusLoadComments(); + if (extension_loaded('Zend OPcache') && ini_get('opcache.load_comments') == 0) { + throw AnnotationException::optimizerPlusLoadComments(); + } } AnnotationRegistry::registerFile(__DIR__ . '/Annotation/IgnoreAnnotation.php'); diff --git a/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php index 330afd3657fd..d864540e002f 100644 --- a/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php +++ b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php @@ -84,7 +84,7 @@ final class DocLexer extends AbstractLexer return array( '[a-z_\\\][a-z0-9_\:\\\]*[a-z_][a-z0-9_]*', '(?:[+-]?[0-9]+(?:[\.][0-9]+)*)(?:[eE][+-]?[0-9]+)?', - '"(?:[^"]|"")*"', + '"(?:""|[^"])*+"', ); } diff --git a/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php index e9b29af18709..24add1b3ba83 100644 --- a/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php +++ b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php @@ -24,6 +24,10 @@ namespace Doctrine\Common\Annotations; * * @author Johannes M. Schmitt * @author Benjamin Eberlei + * + * @deprecated the FileCacheReader is deprecated and will be removed + * in version 2.0.0 of doctrine/annotations. Please use the + * {@see \Doctrine\Common\Annotations\CachedReader} instead. */ class FileCacheReader implements Reader { @@ -52,6 +56,11 @@ class FileCacheReader implements Reader */ private $classNameHashes = array(); + /** + * @var int + */ + private $umask; + /** * Constructor. * @@ -61,10 +70,19 @@ class FileCacheReader implements Reader * * @throws \InvalidArgumentException */ - public function __construct(Reader $reader, $cacheDir, $debug = false) + public function __construct(Reader $reader, $cacheDir, $debug = false, $umask = 0002) { + if ( ! is_int($umask)) { + throw new \InvalidArgumentException(sprintf( + 'The parameter umask must be an integer, was: %s', + gettype($umask) + )); + } + $this->reader = $reader; - if (!is_dir($cacheDir) && !@mkdir($cacheDir, 0777, true)) { + $this->umask = $umask; + + if (!is_dir($cacheDir) && !@mkdir($cacheDir, 0777 & (~$this->umask), true)) { throw new \InvalidArgumentException(sprintf('The directory "%s" does not exist and could not be created.', $cacheDir)); } @@ -189,7 +207,25 @@ class FileCacheReader implements Reader if (!is_writable($this->dir)) { throw new \InvalidArgumentException(sprintf('The directory "%s" is not writable. Both, the webserver and the console user need access. You can manage access rights for multiple users with "chmod +a". If your system does not support this, check out the acl package.', $this->dir)); } - file_put_contents($path, 'dir, uniqid('', true)); + + if (false === $tempfile) { + throw new \RuntimeException(sprintf('Unable to create tempfile in directory: %s', $this->dir)); + } + + $written = file_put_contents($tempfile, 'umask)); + + if (false === rename($tempfile, $path)) { + @unlink($tempfile); + throw new \RuntimeException(sprintf('Unable to rename %s to %s', $tempfile, $path)); + } } /** diff --git a/core/vendor/doctrine/annotations/phpunit.xml.dist b/core/vendor/doctrine/annotations/phpunit.xml.dist deleted file mode 100644 index 6ab0c8c8895a..000000000000 --- a/core/vendor/doctrine/annotations/phpunit.xml.dist +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - ./tests/Doctrine/ - - - - - - ./lib/Doctrine/ - - - - - - performance - - - diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php deleted file mode 100644 index dd324bdf124c..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php +++ /dev/null @@ -1,645 +0,0 @@ -getReflectionClass(); - $reader = $this->getReader(); - - $this->assertEquals(1, count($reader->getClassAnnotations($class))); - $this->assertInstanceOf($annotName = 'Doctrine\Tests\Common\Annotations\DummyAnnotation', $annot = $reader->getClassAnnotation($class, $annotName)); - $this->assertEquals("hello", $annot->dummyValue); - - $field1Prop = $class->getProperty('field1'); - $propAnnots = $reader->getPropertyAnnotations($field1Prop); - $this->assertEquals(1, count($propAnnots)); - $this->assertInstanceOf($annotName, $annot = $reader->getPropertyAnnotation($field1Prop, $annotName)); - $this->assertEquals("fieldHello", $annot->dummyValue); - - $getField1Method = $class->getMethod('getField1'); - $methodAnnots = $reader->getMethodAnnotations($getField1Method); - $this->assertEquals(1, count($methodAnnots)); - $this->assertInstanceOf($annotName, $annot = $reader->getMethodAnnotation($getField1Method, $annotName)); - $this->assertEquals(array(1, 2, "three"), $annot->value); - - $field2Prop = $class->getProperty('field2'); - $propAnnots = $reader->getPropertyAnnotations($field2Prop); - $this->assertEquals(1, count($propAnnots)); - $this->assertInstanceOf($annotName = 'Doctrine\Tests\Common\Annotations\DummyJoinTable', $joinTableAnnot = $reader->getPropertyAnnotation($field2Prop, $annotName)); - $this->assertEquals(1, count($joinTableAnnot->joinColumns)); - $this->assertEquals(1, count($joinTableAnnot->inverseJoinColumns)); - $this->assertTrue($joinTableAnnot->joinColumns[0] instanceof DummyJoinColumn); - $this->assertTrue($joinTableAnnot->inverseJoinColumns[0] instanceof DummyJoinColumn); - $this->assertEquals('col1', $joinTableAnnot->joinColumns[0]->name); - $this->assertEquals('col2', $joinTableAnnot->joinColumns[0]->referencedColumnName); - $this->assertEquals('col3', $joinTableAnnot->inverseJoinColumns[0]->name); - $this->assertEquals('col4', $joinTableAnnot->inverseJoinColumns[0]->referencedColumnName); - - $dummyAnnot = $reader->getMethodAnnotation($class->getMethod('getField1'), 'Doctrine\Tests\Common\Annotations\DummyAnnotation'); - $this->assertEquals('', $dummyAnnot->dummyValue); - $this->assertEquals(array(1, 2, 'three'), $dummyAnnot->value); - - $dummyAnnot = $reader->getPropertyAnnotation($class->getProperty('field1'), 'Doctrine\Tests\Common\Annotations\DummyAnnotation'); - $this->assertEquals('fieldHello', $dummyAnnot->dummyValue); - - $classAnnot = $reader->getClassAnnotation($class, 'Doctrine\Tests\Common\Annotations\DummyAnnotation'); - $this->assertEquals('hello', $classAnnot->dummyValue); - } - - public function testAnnotationsWithValidTargets() - { - $reader = $this->getReader(); - $class = new ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithValidAnnotationTarget'); - - $this->assertEquals(1,count($reader->getClassAnnotations($class))); - $this->assertEquals(1,count($reader->getPropertyAnnotations($class->getProperty('foo')))); - $this->assertEquals(1,count($reader->getMethodAnnotations($class->getMethod('someFunction')))); - $this->assertEquals(1,count($reader->getPropertyAnnotations($class->getProperty('nested')))); - } - - public function testAnnotationsWithVarType() - { - $reader = $this->getReader(); - $class = new ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationWithVarType'); - - $this->assertEquals(1,count($fooAnnot = $reader->getPropertyAnnotations($class->getProperty('foo')))); - $this->assertEquals(1,count($barAnnot = $reader->getMethodAnnotations($class->getMethod('bar')))); - - $this->assertInternalType('string', $fooAnnot[0]->string); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll', $barAnnot[0]->annotation); - } - - public function testAtInDescription() - { - $reader = $this->getReader(); - $class = new ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAtInDescriptionAndAnnotation'); - - $this->assertEquals(1, count($fooAnnot = $reader->getPropertyAnnotations($class->getProperty('foo')))); - $this->assertEquals(1, count($barAnnot = $reader->getPropertyAnnotations($class->getProperty('bar')))); - - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetPropertyMethod', $fooAnnot[0]); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetPropertyMethod', $barAnnot[0]); - } - - public function testClassWithWithDanglingComma() - { - $reader = $this->getReader(); - $annots = $reader->getClassAnnotations(new \ReflectionClass('Doctrine\Tests\Common\Annotations\DummyClassWithDanglingComma')); - - $this->assertCount(1, $annots); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetPropertyMethod is not allowed to be declared on class Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtClass. You may only use this annotation on these code elements: METHOD, PROPERTY - */ - public function testClassWithInvalidAnnotationTargetAtClassDocBlock() - { - $reader = $this->getReader(); - $reader->getClassAnnotations(new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtClass')); - } - - public function testClassWithWithInclude() - { - $reader = $this->getReader(); - $annots = $reader->getClassAnnotations(new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithRequire')); - $this->assertCount(1, $annots); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetClass is not allowed to be declared on property Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtProperty::$foo. You may only use this annotation on these code elements: CLASS - */ - public function testClassWithInvalidAnnotationTargetAtPropertyDocBlock() - { - $reader = $this->getReader(); - $reader->getPropertyAnnotations(new \ReflectionProperty('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtProperty', 'foo')); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetAnnotation is not allowed to be declared on property Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtProperty::$bar. You may only use this annotation on these code elements: ANNOTATION - */ - public function testClassWithInvalidNestedAnnotationTargetAtPropertyDocBlock() - { - $reader = $this->getReader(); - $reader->getPropertyAnnotations(new \ReflectionProperty('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtProperty', 'bar')); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetClass is not allowed to be declared on method Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtMethod::functionName(). You may only use this annotation on these code elements: CLASS - */ - public function testClassWithInvalidAnnotationTargetAtMethodDocBlock() - { - $reader = $this->getReader(); - $reader->getMethodAnnotations(new \ReflectionMethod('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtMethod', 'functionName')); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 24 in class @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithTargetSyntaxError. - */ - public function testClassWithAnnotationWithTargetSyntaxErrorAtClassDocBlock() - { - $reader = $this->getReader(); - $reader->getClassAnnotations(new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationWithTargetSyntaxError')); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 24 in class @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithTargetSyntaxError. - */ - public function testClassWithAnnotationWithTargetSyntaxErrorAtPropertyDocBlock() - { - $reader = $this->getReader(); - $reader->getPropertyAnnotations(new \ReflectionProperty('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationWithTargetSyntaxError','foo')); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 24 in class @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithTargetSyntaxError. - */ - public function testClassWithAnnotationWithTargetSyntaxErrorAtMethodDocBlock() - { - $reader = $this->getReader(); - $reader->getMethodAnnotations(new \ReflectionMethod('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationWithTargetSyntaxError','bar')); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage [Type Error] Attribute "string" of @AnnotationWithVarType declared on property Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationWithVarType::$invalidProperty expects a(n) string, but got integer. - */ - public function testClassWithPropertyInvalidVarTypeError() - { - $reader = $this->getReader(); - $class = new ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationWithVarType'); - - $reader->getPropertyAnnotations($class->getProperty('invalidProperty')); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage [Type Error] Attribute "annotation" of @AnnotationWithVarType declared on method Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationWithVarType::invalidMethod() expects a(n) Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll, but got an instance of Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAnnotation. - */ - public function testClassWithMethodInvalidVarTypeError() - { - $reader = $this->getReader(); - $class = new ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationWithVarType'); - - $reader->getMethodAnnotations($class->getMethod('invalidMethod')); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 18 in class Doctrine\Tests\Common\Annotations\DummyClassSyntaxError. - */ - public function testClassSyntaxErrorContext() - { - $reader = $this->getReader(); - $reader->getClassAnnotations(new \ReflectionClass('Doctrine\Tests\Common\Annotations\DummyClassSyntaxError')); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 18 in method Doctrine\Tests\Common\Annotations\DummyClassMethodSyntaxError::foo(). - */ - public function testMethodSyntaxErrorContext() - { - $reader = $this->getReader(); - $reader->getMethodAnnotations(new \ReflectionMethod('Doctrine\Tests\Common\Annotations\DummyClassMethodSyntaxError', 'foo')); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 18 in property Doctrine\Tests\Common\Annotations\DummyClassPropertySyntaxError::$foo. - */ - public function testPropertySyntaxErrorContext() - { - $reader = $this->getReader(); - $reader->getPropertyAnnotations(new \ReflectionProperty('Doctrine\Tests\Common\Annotations\DummyClassPropertySyntaxError', 'foo')); - } - - /** - * @group regression - */ - public function testMultipleAnnotationsOnSameLine() - { - $reader = $this->getReader(); - $annots = $reader->getPropertyAnnotations(new \ReflectionProperty('Doctrine\Tests\Common\Annotations\DummyClass2', 'id')); - $this->assertEquals(3, count($annots)); - } - - public function testNonAnnotationProblem() - { - $reader = $this->getReader(); - - $this->assertNotNull($annot = $reader->getPropertyAnnotation(new \ReflectionProperty('Doctrine\Tests\Common\Annotations\DummyClassNonAnnotationProblem', 'foo'), $name = 'Doctrine\Tests\Common\Annotations\DummyAnnotation')); - $this->assertInstanceOf($name, $annot); - } - - public function testIncludeIgnoreAnnotation() - { - $reader = $this->getReader(); - - $reader->getPropertyAnnotations(new \ReflectionProperty('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithIgnoreAnnotation', 'foo')); - $this->assertFalse(class_exists('Doctrine\Tests\Common\Annotations\Fixtures\IgnoreAnnotationClass', false)); - } - - public function testImportWithConcreteAnnotation() - { - $reader = $this->getReader(); - $property = new \ReflectionProperty('Doctrine\Tests\Common\Annotations\TestImportWithConcreteAnnotation', 'field'); - $annotations = $reader->getPropertyAnnotations($property); - $this->assertEquals(1, count($annotations)); - $this->assertNotNull($reader->getPropertyAnnotation($property, 'Doctrine\Tests\Common\Annotations\DummyAnnotation')); - } - - public function testImportWithInheritance() - { - $reader = $this->getReader(); - - $class = new TestParentClass(); - $ref = new \ReflectionClass($class); - - $childAnnotations = $reader->getPropertyAnnotations($ref->getProperty('child')); - $this->assertEquals(1, count($childAnnotations)); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Foo\Name', reset($childAnnotations)); - - $parentAnnotations = $reader->getPropertyAnnotations($ref->getProperty('parent')); - $this->assertEquals(1, count($parentAnnotations)); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Bar\Name', reset($parentAnnotations)); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage The annotation "@NameFoo" in property Doctrine\Tests\Common\Annotations\TestAnnotationNotImportedClass::$field was never imported. - */ - public function testImportDetectsNotImportedAnnotation() - { - $reader = $this->getReader(); - $reader->getPropertyAnnotations(new \ReflectionProperty('Doctrine\Tests\Common\Annotations\TestAnnotationNotImportedClass', 'field')); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage The annotation "@Foo\Bar\Name" in property Doctrine\Tests\Common\Annotations\TestNonExistentAnnotationClass::$field was never imported. - */ - public function testImportDetectsNonExistentAnnotation() - { - $reader = $this->getReader(); - $reader->getPropertyAnnotations(new \ReflectionProperty('Doctrine\Tests\Common\Annotations\TestNonExistentAnnotationClass', 'field')); - } - - public function testTopLevelAnnotation() - { - $reader = $this->getReader(); - $annotations = $reader->getPropertyAnnotations(new \ReflectionProperty('Doctrine\Tests\Common\Annotations\TestTopLevelAnnotationClass', 'field')); - - $this->assertEquals(1, count($annotations)); - $this->assertInstanceOf('\TopLevelAnnotation', reset($annotations)); - } - - public function testIgnoresAnnotationsNotPrefixedWithWhitespace() - { - $reader = $this->getReader(); - - $annotation = $reader->getClassAnnotation(new \ReflectionClass(new TestIgnoresNonAnnotationsClass()), 'Doctrine\Tests\Common\Annotations\Name'); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Name', $annotation); - } - - private static $testResetsPhpParserAfterUseRun = false; - - /** - * When getUseStatements isn't available on ReflectionClass the PhpParser has to use token_get_all(). If that - * happens various PHP compiler globals get set, and these can have seriously bad effects on the next file to be - * parsed. - * Notably the doc_comment compiler global can end up containing a docblock comment. The next file to be parsed - * on an include() will have this docblock comment attached to the first thing in the file that the compiler - * considers to own comments. If this is a class then any later calls to getDocComment() for that class will have - * undesirable effects. *sigh* - */ - public function testResetsPhpParserAfterUse() - { - // If someone has already included our main test fixture this test is invalid. It's important that our require - // causes this file to be parsed and compiled at a certain point. - $this->assertFalse(!self::$testResetsPhpParserAfterUseRun && class_exists('Doctrine_Tests_Common_Annotations_Fixtures_ClassNoNamespaceNoComment'), 'Test invalid if class has already been compiled'); - self::$testResetsPhpParserAfterUseRun = true; - - $reader = $this->getReader(); - - // First make sure the annotation cache knows about the annotations we want to use. - // If we don't do this then loading of annotations into the cache will cause the parser to get out of the bad - // state we want to test. - $class = new ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithValidAnnotationTarget'); - $reader->getClassAnnotations($class); - - // Now import an incredibly dull class which makes use of the same class level annotation that the previous class does. - $class = new ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithClassAnnotationOnly'); - $annotations = $reader->getClassAnnotations($class); - - // This include needs to be here since we need the PHP compiler to run over it as the next thing the PHP - // parser sees since PhpParser called token_get_all() on the intro to ClassWithClassAnnotationOnly. - // Our test class cannot be in a namespace (some versions of PHP reset the doc_comment compiler global when - // you hit a namespace declaration), so cannot be autoloaded. - require_once __DIR__ . '/Fixtures/ClassNoNamespaceNoComment.php'; - - // So, hopefully, if all has gone OK, our class with class annotations should actually have them. - // If this fails then something is quite badly wrong elsewhere. - // Note that if this happens before the require it can cause other PHP files to be included, resetting the - // compiler global state, and invalidating this test case. - $this->assertNotEmpty($annotations); - - $annotations = $reader->getClassAnnotations(new \ReflectionClass(new \Doctrine_Tests_Common_Annotations_Fixtures_ClassNoNamespaceNoComment())); - // And if our workaround for this bug is OK, our class with no doc comment should not have any class annotations. - $this->assertEmpty($annotations); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage The class "Doctrine\Tests\Common\Annotations\Fixtures\NoAnnotation" is not annotated with @Annotation. Are you sure this class can be used as annotation? If so, then you need to add @Annotation to the _class_ doc comment of "Doctrine\Tests\Common\Annotations\Fixtures\NoAnnotation". If it is indeed no annotation, then you need to add @IgnoreAnnotation("NoAnnotation") to the _class_ doc comment of class Doctrine\Tests\Common\Annotations\Fixtures\InvalidAnnotationUsageClass. - */ - public function testErrorWhenInvalidAnnotationIsUsed() - { - $reader = $this->getReader(); - $ref = new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\InvalidAnnotationUsageClass'); - $reader->getClassAnnotations($ref); - } - - public function testInvalidAnnotationUsageButIgnoredClass() - { - $reader = $this->getReader(); - $ref = new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\InvalidAnnotationUsageButIgnoredClass'); - $annots = $reader->getClassAnnotations($ref); - - $this->assertEquals(2, count($annots)); - } - - /** - * @group DDC-1660 - * @group regression - */ - public function testInvalidAnnotationButIgnored() - { - $reader = $this->getReader(); - $class = new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassDDC1660'); - - $this->assertTrue(class_exists('Doctrine\Tests\Common\Annotations\Fixtures\Annotation\Version')); - $this->assertCount(0, $reader->getClassAnnotations($class)); - $this->assertCount(0, $reader->getMethodAnnotations($class->getMethod('bar'))); - $this->assertCount(0, $reader->getPropertyAnnotations($class->getProperty('foo'))); - } - - public function testAnnotationEnumeratorException() - { - $reader = $this->getReader(); - $class = new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationEnum'); - - $this->assertCount(1, $bar = $reader->getMethodAnnotations($class->getMethod('bar'))); - $this->assertCount(1, $foo = $reader->getPropertyAnnotations($class->getProperty('foo'))); - - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnum', $bar[0]); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnum', $foo[0]); - - try { - $reader->getPropertyAnnotations($class->getProperty('invalidProperty')); - $this->fail(); - } catch (\Doctrine\Common\Annotations\AnnotationException $exc) { - $this->assertEquals('[Enum Error] Attribute "value" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnum declared on property Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationEnum::$invalidProperty accept only [ONE, TWO, THREE], but got FOUR.', $exc->getMessage()); - } - - try { - $reader->getMethodAnnotations($class->getMethod('invalidMethod')); - $this->fail(); - } catch (\Doctrine\Common\Annotations\AnnotationException $exc) { - $this->assertEquals('[Enum Error] Attribute "value" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnum declared on method Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationEnum::invalidMethod() accept only [ONE, TWO, THREE], but got 5.', $exc->getMessage()); - } - } - - /** - * @group DCOM-106 - */ - public function testIgnoreFixMeAndUpperCaseToDo() - { - $reader = $this->getReader(); - $ref = new \ReflectionClass('Doctrine\Tests\Common\Annotations\DCOM106'); - $reader->getClassAnnotations($ref); - } - - /** - * @return AnnotationReader - */ - abstract protected function getReader(); -} - -/** - * @parseAnnotation("var") - * @author Johannes M. Schmitt - * - */ -class TestParseAnnotationClass -{ - /** - * @var - */ - private $field; -} - -/** - * @Name - * @author Johannes M. Schmitt - */ -class TestIgnoresNonAnnotationsClass -{ -} - -class TestTopLevelAnnotationClass -{ - /** - * @\TopLevelAnnotation - */ - private $field; -} - -class TestNonExistentAnnotationClass -{ - /** - * @Foo\Bar\Name - */ - private $field; -} - -class TestAnnotationNotImportedClass -{ - /** - * @NameFoo - */ - private $field; -} - -class TestChildClass -{ - /** - * @\Doctrine\Tests\Common\Annotations\Foo\Name(name = "foo") - */ - protected $child; -} - -class TestParentClass extends TestChildClass -{ - /** - * @\Doctrine\Tests\Common\Annotations\Bar\Name(name = "bar") - */ - private $parent; -} - -class TestImportWithConcreteAnnotation -{ - /** - * @DummyAnnotation(dummyValue = "bar") - */ - private $field; -} - -/** - * @ignoreAnnotation("var") - */ -class DummyClass2 { - /** - * @DummyId @DummyColumn(type="integer") @DummyGeneratedValue - * @var integer - */ - private $id; -} - -/** @Annotation */ -class DummyId extends Annotation {} -/** @Annotation */ -class DummyColumn extends Annotation { - public $type; -} -/** @Annotation */ -class DummyGeneratedValue extends Annotation {} -/** @Annotation */ -class DummyAnnotation extends Annotation { - public $dummyValue; -} - -/** - * @api - * @Annotation - */ -class DummyAnnotationWithIgnoredAnnotation extends Annotation { - public $dummyValue; -} - -/** @Annotation */ -class DummyJoinColumn extends Annotation { - public $name; - public $referencedColumnName; -} -/** @Annotation */ -class DummyJoinTable extends Annotation { - public $name; - public $joinColumns; - public $inverseJoinColumns; -} - -/** - * @DummyAnnotation(dummyValue = "bar",) - */ -class DummyClassWithDanglingComma -{ -} - -/** - * @DummyAnnotation(@) - */ -class DummyClassSyntaxError -{ - -} - -class DummyClassMethodSyntaxError -{ - /** - * @DummyAnnotation(@) - */ - public function foo() - { - - } -} - -class DummyClassPropertySyntaxError -{ - /** - * @DummyAnnotation(@) - */ - public $foo; -} - -/** - * @ignoreAnnotation({"since", "var"}) - */ -class DummyClassNonAnnotationProblem -{ - /** - * @DummyAnnotation - * - * @var \Test - * @since 0.1 - */ - public $foo; -} - - -/** -* @DummyAnnotation Foo bar -*/ -class DummyClassWithEmail -{ - -} - - -/** - * @fixme public - * @TODO - */ -class DCOM106 -{ - -} - -namespace Doctrine\Tests\Common\Annotations\Foo; - -/** @Annotation */ -class Name extends \Doctrine\Common\Annotations\Annotation -{ - public $name; -} - -namespace Doctrine\Tests\Common\Annotations\Bar; - -/** @Annotation */ -class Name extends \Doctrine\Common\Annotations\Annotation -{ - public $name; -} diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/AnnotationReaderTest.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/AnnotationReaderTest.php deleted file mode 100644 index d6dd05638906..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/AnnotationReaderTest.php +++ /dev/null @@ -1,59 +0,0 @@ -markTestSkipped('This test requires PHP 5.4 or later.'); - } - - $reader = $this->getReader(); - $ref = new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassUsesTrait'); - - $annotations = $reader->getMethodAnnotations($ref->getMethod('someMethod')); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Bar\Autoload', $annotations[0]); - - $annotations = $reader->getMethodAnnotations($ref->getMethod('traitMethod')); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\Annotation\Autoload', $annotations[0]); - } - - public function testMethodAnnotationFromOverwrittenTrait() - { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('This test requires PHP 5.4 or later.'); - } - - $reader = $this->getReader(); - $ref = new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassOverwritesTrait'); - - $annotations = $reader->getMethodAnnotations($ref->getMethod('traitMethod')); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Bar2\Autoload', $annotations[0]); - } - - public function testPropertyAnnotationFromTrait() - { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('This test requires PHP 5.4 or later.'); - } - - $reader = $this->getReader(); - $ref = new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassUsesTrait'); - - $annotations = $reader->getPropertyAnnotations($ref->getProperty('aProperty')); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Bar\Autoload', $annotations[0]); - - $annotations = $reader->getPropertyAnnotations($ref->getProperty('traitProperty')); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\Annotation\Autoload', $annotations[0]); - } - -} \ No newline at end of file diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/CachedReaderTest.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/CachedReaderTest.php deleted file mode 100644 index 5dd89f75d1a8..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/CachedReaderTest.php +++ /dev/null @@ -1,56 +0,0 @@ -getMock('Doctrine\Common\Cache\Cache'); - $cache - ->expects($this->at(0)) - ->method('fetch') - ->with($this->equalTo($cacheKey)) - ->will($this->returnValue(array())) - ; - $cache - ->expects($this->at(1)) - ->method('fetch') - ->with($this->equalTo('[C]'.$cacheKey)) - ->will($this->returnValue(time() - 10)) - ; - $cache - ->expects($this->at(2)) - ->method('save') - ->with($this->equalTo($cacheKey)) - ; - $cache - ->expects($this->at(3)) - ->method('save') - ->with($this->equalTo('[C]'.$cacheKey)) - ; - - $reader = new CachedReader(new AnnotationReader(), $cache, true); - $route = new Route(); - $route->pattern = '/someprefix'; - $this->assertEquals(array($route), $reader->getClassAnnotations(new \ReflectionClass($name))); - } - - protected function getReader() - { - $this->cache = new ArrayCache(); - return new CachedReader(new AnnotationReader(), $this->cache); - } -} \ No newline at end of file diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php deleted file mode 100644 index 844619d0d1f9..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php +++ /dev/null @@ -1,157 +0,0 @@ -setInput("@Name"); - $this->assertNull($lexer->token); - $this->assertNull($lexer->lookahead); - - $this->assertTrue($lexer->moveNext()); - $this->assertNull($lexer->token); - $this->assertEquals('@', $lexer->lookahead['value']); - - $this->assertTrue($lexer->moveNext()); - $this->assertEquals('@', $lexer->token['value']); - $this->assertEquals('Name', $lexer->lookahead['value']); - - $this->assertFalse($lexer->moveNext()); - } - - public function testScannerTokenizesDocBlockWhitConstants() - { - $lexer = new DocLexer(); - $docblock = '@AnnotationWithConstants(PHP_EOL, ClassWithConstants::SOME_VALUE, ClassWithConstants::CONSTANT_, ClassWithConstants::CONST_ANT3, \Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants::SOME_VALUE)'; - - $tokens = array ( - array( - 'value' => '@', - 'position' => 0, - 'type' => DocLexer::T_AT, - ), - array( - 'value' => 'AnnotationWithConstants', - 'position' => 1, - 'type' => DocLexer::T_IDENTIFIER, - ), - array( - 'value' => '(', - 'position' => 24, - 'type' => DocLexer::T_OPEN_PARENTHESIS, - ), - array( - 'value' => 'PHP_EOL', - 'position' => 25, - 'type' => DocLexer::T_IDENTIFIER, - ), - array( - 'value' => ',', - 'position' => 32, - 'type' => DocLexer::T_COMMA, - ), - array( - 'value' => 'ClassWithConstants::SOME_VALUE', - 'position' => 34, - 'type' => DocLexer::T_IDENTIFIER, - ), - array( - 'value' => ',', - 'position' => 64, - 'type' => DocLexer::T_COMMA, - ), - array( - 'value' => 'ClassWithConstants::CONSTANT_', - 'position' => 66, - 'type' => DocLexer::T_IDENTIFIER, - ), - array( - 'value' => ',', - 'position' => 95, - 'type' => DocLexer::T_COMMA, - ), - array( - 'value' => 'ClassWithConstants::CONST_ANT3', - 'position' => 97, - 'type' => DocLexer::T_IDENTIFIER, - ), - array( - 'value' => ',', - 'position' => 127, - 'type' => DocLexer::T_COMMA, - ), - array( - 'value' => '\\Doctrine\\Tests\\Common\\Annotations\\Fixtures\\IntefaceWithConstants::SOME_VALUE', - 'position' => 129, - 'type' => DocLexer::T_IDENTIFIER, - ), - array( - 'value' => ')', - 'position' => 206, - 'type' => DocLexer::T_CLOSE_PARENTHESIS, - ) - - ); - - $lexer->setInput($docblock); - - foreach ($tokens as $expected) { - $lexer->moveNext(); - $lookahead = $lexer->lookahead; - $this->assertEquals($expected['value'], $lookahead['value']); - $this->assertEquals($expected['type'], $lookahead['type']); - $this->assertEquals($expected['position'], $lookahead['position']); - } - - $this->assertFalse($lexer->moveNext()); - } - - - public function testScannerTokenizesDocBlockWhitInvalidIdentifier() - { - $lexer = new DocLexer(); - $docblock = '@Foo\3.42'; - - $tokens = array ( - array( - 'value' => '@', - 'position' => 0, - 'type' => DocLexer::T_AT, - ), - array( - 'value' => 'Foo', - 'position' => 1, - 'type' => DocLexer::T_IDENTIFIER, - ), - array( - 'value' => '\\', - 'position' => 4, - 'type' => DocLexer::T_NAMESPACE_SEPARATOR, - ), - array( - 'value' => 3.42, - 'position' => 5, - 'type' => DocLexer::T_FLOAT, - ) - ); - - $lexer->setInput($docblock); - - foreach ($tokens as $expected) { - $lexer->moveNext(); - $lookahead = $lexer->lookahead; - $this->assertEquals($expected['value'], $lookahead['value']); - $this->assertEquals($expected['type'], $lookahead['type']); - $this->assertEquals($expected['position'], $lookahead['position']); - } - - $this->assertFalse($lexer->moveNext()); - } - -} \ No newline at end of file diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php deleted file mode 100644 index 7d670a99e250..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php +++ /dev/null @@ -1,1359 +0,0 @@ -createTestParser(); - - // Nested arrays with nested annotations - $result = $parser->parse('@Name(foo={1,2, {"key"=@Name}})'); - $annot = $result[0]; - - $this->assertTrue($annot instanceof Name); - $this->assertNull($annot->value); - $this->assertEquals(3, count($annot->foo)); - $this->assertEquals(1, $annot->foo[0]); - $this->assertEquals(2, $annot->foo[1]); - $this->assertTrue(is_array($annot->foo[2])); - - $nestedArray = $annot->foo[2]; - $this->assertTrue(isset($nestedArray['key'])); - $this->assertTrue($nestedArray['key'] instanceof Name); - } - - public function testBasicAnnotations() - { - $parser = $this->createTestParser(); - - // Marker annotation - $result = $parser->parse("@Name"); - $annot = $result[0]; - $this->assertTrue($annot instanceof Name); - $this->assertNull($annot->value); - $this->assertNull($annot->foo); - - // Associative arrays - $result = $parser->parse('@Name(foo={"key1" = "value1"})'); - $annot = $result[0]; - $this->assertNull($annot->value); - $this->assertTrue(is_array($annot->foo)); - $this->assertTrue(isset($annot->foo['key1'])); - - // Numerical arrays - $result = $parser->parse('@Name({2="foo", 4="bar"})'); - $annot = $result[0]; - $this->assertTrue(is_array($annot->value)); - $this->assertEquals('foo', $annot->value[2]); - $this->assertEquals('bar', $annot->value[4]); - $this->assertFalse(isset($annot->value[0])); - $this->assertFalse(isset($annot->value[1])); - $this->assertFalse(isset($annot->value[3])); - - // Multiple values - $result = $parser->parse('@Name(@Name, @Name)'); - $annot = $result[0]; - - $this->assertTrue($annot instanceof Name); - $this->assertTrue(is_array($annot->value)); - $this->assertTrue($annot->value[0] instanceof Name); - $this->assertTrue($annot->value[1] instanceof Name); - - // Multiple types as values - $result = $parser->parse('@Name(foo="Bar", @Name, {"key1"="value1", "key2"="value2"})'); - $annot = $result[0]; - - $this->assertTrue($annot instanceof Name); - $this->assertTrue(is_array($annot->value)); - $this->assertTrue($annot->value[0] instanceof Name); - $this->assertTrue(is_array($annot->value[1])); - $this->assertEquals('value1', $annot->value[1]['key1']); - $this->assertEquals('value2', $annot->value[1]['key2']); - - // Complete docblock - $docblock = <<parse($docblock); - $this->assertEquals(1, count($result)); - $annot = $result[0]; - $this->assertTrue($annot instanceof Name); - $this->assertEquals("bar", $annot->foo); - $this->assertNull($annot->value); - } - - public function testDefaultValueAnnotations() - { - $parser = $this->createTestParser(); - - // Array as first value - $result = $parser->parse('@Name({"key1"="value1"})'); - $annot = $result[0]; - - $this->assertTrue($annot instanceof Name); - $this->assertTrue(is_array($annot->value)); - $this->assertEquals('value1', $annot->value['key1']); - - // Array as first value and additional values - $result = $parser->parse('@Name({"key1"="value1"}, foo="bar")'); - $annot = $result[0]; - - $this->assertTrue($annot instanceof Name); - $this->assertTrue(is_array($annot->value)); - $this->assertEquals('value1', $annot->value['key1']); - $this->assertEquals('bar', $annot->foo); - } - - public function testNamespacedAnnotations() - { - $parser = new DocParser; - $parser->setIgnoreNotImportedAnnotations(true); - - $docblock = << - * @Doctrine\Tests\Common\Annotations\Name(foo="bar") - * @ignore - */ -DOCBLOCK; - - $result = $parser->parse($docblock); - $this->assertEquals(1, count($result)); - $annot = $result[0]; - $this->assertTrue($annot instanceof Name); - $this->assertEquals("bar", $annot->foo); - } - - /** - * @group debug - */ - public function testTypicalMethodDocBlock() - { - $parser = $this->createTestParser(); - - $docblock = <<parse($docblock); - $this->assertEquals(2, count($result)); - $this->assertTrue(isset($result[0])); - $this->assertTrue(isset($result[1])); - $annot = $result[0]; - $this->assertTrue($annot instanceof Name); - $this->assertEquals("bar", $annot->foo); - $marker = $result[1]; - $this->assertTrue($marker instanceof Marker); - } - - - public function testAnnotationWithoutConstructor() - { - $parser = $this->createTestParser(); - - - $docblock = <<parse($docblock); - $this->assertEquals(count($result), 1); - $annot = $result[0]; - - $this->assertNotNull($annot); - $this->assertTrue($annot instanceof SomeAnnotationClassNameWithoutConstructor); - - $this->assertNull($annot->name); - $this->assertNotNull($annot->data); - $this->assertEquals($annot->data, "Some data"); - - - - -$docblock = <<parse($docblock); - $this->assertEquals(count($result), 1); - $annot = $result[0]; - - $this->assertNotNull($annot); - $this->assertTrue($annot instanceof SomeAnnotationClassNameWithoutConstructor); - - $this->assertEquals($annot->name, "Some Name"); - $this->assertEquals($annot->data, "Some data"); - - - - -$docblock = <<parse($docblock); - $this->assertEquals(count($result), 1); - $annot = $result[0]; - - $this->assertEquals($annot->data, "Some data"); - $this->assertNull($annot->name); - - - $docblock = <<parse($docblock); - $this->assertEquals(count($result), 1); - $annot = $result[0]; - - $this->assertEquals($annot->name, "Some name"); - $this->assertNull($annot->data); - - $docblock = <<parse($docblock); - $this->assertEquals(count($result), 1); - $annot = $result[0]; - - $this->assertEquals($annot->data, "Some data"); - $this->assertNull($annot->name); - - - - $docblock = <<parse($docblock); - $this->assertEquals(count($result), 1); - $annot = $result[0]; - - $this->assertEquals($annot->name, "Some name"); - $this->assertEquals($annot->data, "Some data"); - - - $docblock = <<parse($docblock); - $this->assertEquals(count($result), 1); - $annot = $result[0]; - - $this->assertEquals($annot->name, "Some name"); - $this->assertEquals($annot->data, "Some data"); - - $docblock = <<parse($docblock); - $this->assertEquals(count($result), 1); - $this->assertTrue($result[0] instanceof SomeAnnotationClassNameWithoutConstructorAndProperties); - } - - public function testAnnotationTarget() - { - - $parser = new DocParser; - $parser->setImports(array( - '__NAMESPACE__' => 'Doctrine\Tests\Common\Annotations\Fixtures', - )); - $class = new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithValidAnnotationTarget'); - - - $context = 'class ' . $class->getName(); - $docComment = $class->getDocComment(); - - $parser->setTarget(Target::TARGET_CLASS); - $this->assertNotNull($parser->parse($docComment,$context)); - - - $property = $class->getProperty('foo'); - $docComment = $property->getDocComment(); - $context = 'property ' . $class->getName() . "::\$" . $property->getName(); - - $parser->setTarget(Target::TARGET_PROPERTY); - $this->assertNotNull($parser->parse($docComment,$context)); - - - - $method = $class->getMethod('someFunction'); - $docComment = $property->getDocComment(); - $context = 'method ' . $class->getName() . '::' . $method->getName() . '()'; - - $parser->setTarget(Target::TARGET_METHOD); - $this->assertNotNull($parser->parse($docComment,$context)); - - - try { - $class = new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtClass'); - $context = 'class ' . $class->getName(); - $docComment = $class->getDocComment(); - - $parser->setTarget(Target::TARGET_CLASS); - $parser->parse($docComment, $context); - - $this->fail(); - } catch (\Doctrine\Common\Annotations\AnnotationException $exc) { - $this->assertNotNull($exc->getMessage()); - } - - - try { - - $class = new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtMethod'); - $method = $class->getMethod('functionName'); - $docComment = $method->getDocComment(); - $context = 'method ' . $class->getName() . '::' . $method->getName() . '()'; - - $parser->setTarget(Target::TARGET_METHOD); - $parser->parse($docComment, $context); - - $this->fail(); - } catch (\Doctrine\Common\Annotations\AnnotationException $exc) { - $this->assertNotNull($exc->getMessage()); - } - - - try { - $class = new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtProperty'); - $property = $class->getProperty('foo'); - $docComment = $property->getDocComment(); - $context = 'property ' . $class->getName() . "::\$" . $property->getName(); - - $parser->setTarget(Target::TARGET_PROPERTY); - $parser->parse($docComment, $context); - - $this->fail(); - } catch (\Doctrine\Common\Annotations\AnnotationException $exc) { - $this->assertNotNull($exc->getMessage()); - } - - } - - public function getAnnotationVarTypeProviderValid() - { - //({attribute name}, {attribute value}) - return array( - // mixed type - array('mixed', '"String Value"'), - array('mixed', 'true'), - array('mixed', 'false'), - array('mixed', '1'), - array('mixed', '1.2'), - array('mixed', '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll'), - - // boolean type - array('boolean', 'true'), - array('boolean', 'false'), - - // alias for internal type boolean - array('bool', 'true'), - array('bool', 'false'), - - // integer type - array('integer', '0'), - array('integer', '1'), - array('integer', '123456789'), - array('integer', '9223372036854775807'), - - // alias for internal type double - array('float', '0.1'), - array('float', '1.2'), - array('float', '123.456'), - - // string type - array('string', '"String Value"'), - array('string', '"true"'), - array('string', '"123"'), - - // array type - array('array', '{@AnnotationExtendsAnnotationTargetAll}'), - array('array', '{@AnnotationExtendsAnnotationTargetAll,@AnnotationExtendsAnnotationTargetAll}'), - - array('arrayOfIntegers', '1'), - array('arrayOfIntegers', '{1}'), - array('arrayOfIntegers', '{1,2,3,4}'), - array('arrayOfAnnotations', '@AnnotationExtendsAnnotationTargetAll'), - array('arrayOfAnnotations', '{@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll}'), - array('arrayOfAnnotations', '{@AnnotationExtendsAnnotationTargetAll, @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll}'), - - // annotation instance - array('annotation', '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll'), - array('annotation', '@AnnotationExtendsAnnotationTargetAll'), - ); - } - - public function getAnnotationVarTypeProviderInvalid() - { - //({attribute name}, {type declared type}, {attribute value} , {given type or class}) - return array( - // boolean type - array('boolean','boolean','1','integer'), - array('boolean','boolean','1.2','double'), - array('boolean','boolean','"str"','string'), - array('boolean','boolean','{1,2,3}','array'), - array('boolean','boolean','@Name', 'an instance of Doctrine\Tests\Common\Annotations\Name'), - - // alias for internal type boolean - array('bool','bool', '1','integer'), - array('bool','bool', '1.2','double'), - array('bool','bool', '"str"','string'), - array('bool','bool', '{"str"}','array'), - - // integer type - array('integer','integer', 'true','boolean'), - array('integer','integer', 'false','boolean'), - array('integer','integer', '1.2','double'), - array('integer','integer', '"str"','string'), - array('integer','integer', '{"str"}','array'), - array('integer','integer', '{1,2,3,4}','array'), - - // alias for internal type double - array('float','float', 'true','boolean'), - array('float','float', 'false','boolean'), - array('float','float', '123','integer'), - array('float','float', '"str"','string'), - array('float','float', '{"str"}','array'), - array('float','float', '{12.34}','array'), - array('float','float', '{1,2,3}','array'), - - // string type - array('string','string', 'true','boolean'), - array('string','string', 'false','boolean'), - array('string','string', '12','integer'), - array('string','string', '1.2','double'), - array('string','string', '{"str"}','array'), - array('string','string', '{1,2,3,4}','array'), - - // annotation instance - array('annotation','Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll', 'true','boolean'), - array('annotation','Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll', 'false','boolean'), - array('annotation','Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll', '12','integer'), - array('annotation','Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll', '1.2','double'), - array('annotation','Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll', '{"str"}','array'), - array('annotation','Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll', '{1,2,3,4}','array'), - array('annotation','Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll', '@Name','an instance of Doctrine\Tests\Common\Annotations\Name'), - ); - } - - public function getAnnotationVarTypeArrayProviderInvalid() - { - //({attribute name}, {type declared type}, {attribute value} , {given type or class}) - return array( - array('arrayOfIntegers', 'integer', 'true', 'boolean'), - array('arrayOfIntegers', 'integer', 'false', 'boolean'), - array('arrayOfIntegers', 'integer', '{true,true}', 'boolean'), - array('arrayOfIntegers', 'integer', '{1,true}', 'boolean'), - array('arrayOfIntegers', 'integer', '{1,2,1.2}', 'double'), - array('arrayOfIntegers', 'integer', '{1,2,"str"}', 'string'), - - array('arrayOfStrings', 'string', 'true', 'boolean'), - array('arrayOfStrings', 'string', 'false', 'boolean'), - array('arrayOfStrings', 'string', '{true,true}', 'boolean'), - array('arrayOfStrings', 'string', '{"foo",true}', 'boolean'), - array('arrayOfStrings', 'string', '{"foo","bar",1.2}', 'double'), - array('arrayOfStrings', 'string', '1', 'integer'), - - array('arrayOfAnnotations', 'Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll', 'true', 'boolean'), - array('arrayOfAnnotations', 'Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll', 'false', 'boolean'), - array('arrayOfAnnotations', 'Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll', '{@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll,true}', 'boolean'), - array('arrayOfAnnotations', 'Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll', '{@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll,true}', 'boolean'), - array('arrayOfAnnotations', 'Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll', '{@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll,1.2}', 'double'), - array('arrayOfAnnotations', 'Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll', '{@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll,@AnnotationExtendsAnnotationTargetAll,"str"}', 'string'), - ); - } - - /** - * @dataProvider getAnnotationVarTypeProviderValid - */ - public function testAnnotationWithVarType($attribute, $value) - { - $parser = $this->createTestParser(); - $context = 'property SomeClassName::$invalidProperty.'; - $docblock = sprintf('@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithVarType(%s = %s)',$attribute, $value); - $parser->setTarget(Target::TARGET_PROPERTY); - - $result = $parser->parse($docblock, $context); - - $this->assertTrue(sizeof($result) === 1); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithVarType', $result[0]); - $this->assertNotNull($result[0]->$attribute); - } - - /** - * @dataProvider getAnnotationVarTypeProviderInvalid - */ - public function testAnnotationWithVarTypeError($attribute,$type,$value,$given) - { - $parser = $this->createTestParser(); - $context = 'property SomeClassName::invalidProperty.'; - $docblock = sprintf('@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithVarType(%s = %s)',$attribute, $value); - $parser->setTarget(Target::TARGET_PROPERTY); - - try { - $parser->parse($docblock, $context); - $this->fail(); - } catch (\Doctrine\Common\Annotations\AnnotationException $exc) { - $this->assertContains("[Type Error] Attribute \"$attribute\" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithVarType declared on property SomeClassName::invalidProperty. expects a(n) $type, but got $given.", $exc->getMessage()); - } - } - - - /** - * @dataProvider getAnnotationVarTypeArrayProviderInvalid - */ - public function testAnnotationWithVarTypeArrayError($attribute,$type,$value,$given) - { - $parser = $this->createTestParser(); - $context = 'property SomeClassName::invalidProperty.'; - $docblock = sprintf('@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithVarType(%s = %s)',$attribute, $value); - $parser->setTarget(Target::TARGET_PROPERTY); - - try { - $parser->parse($docblock, $context); - $this->fail(); - } catch (\Doctrine\Common\Annotations\AnnotationException $exc) { - $this->assertContains("[Type Error] Attribute \"$attribute\" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithVarType declared on property SomeClassName::invalidProperty. expects either a(n) $type, or an array of {$type}s, but got $given.", $exc->getMessage()); - } - } - - /** - * @dataProvider getAnnotationVarTypeProviderValid - */ - public function testAnnotationWithAttributes($attribute, $value) - { - $parser = $this->createTestParser(); - $context = 'property SomeClassName::$invalidProperty.'; - $docblock = sprintf('@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithAttributes(%s = %s)',$attribute, $value); - $parser->setTarget(Target::TARGET_PROPERTY); - - $result = $parser->parse($docblock, $context); - - $this->assertTrue(sizeof($result) === 1); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithAttributes', $result[0]); - $getter = "get".ucfirst($attribute); - $this->assertNotNull($result[0]->$getter()); - } - - /** - * @dataProvider getAnnotationVarTypeProviderInvalid - */ - public function testAnnotationWithAttributesError($attribute,$type,$value,$given) - { - $parser = $this->createTestParser(); - $context = 'property SomeClassName::invalidProperty.'; - $docblock = sprintf('@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithAttributes(%s = %s)',$attribute, $value); - $parser->setTarget(Target::TARGET_PROPERTY); - - try { - $parser->parse($docblock, $context); - $this->fail(); - } catch (\Doctrine\Common\Annotations\AnnotationException $exc) { - $this->assertContains("[Type Error] Attribute \"$attribute\" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithAttributes declared on property SomeClassName::invalidProperty. expects a(n) $type, but got $given.", $exc->getMessage()); - } - } - - - /** - * @dataProvider getAnnotationVarTypeArrayProviderInvalid - */ - public function testAnnotationWithAttributesWithVarTypeArrayError($attribute,$type,$value,$given) - { - $parser = $this->createTestParser(); - $context = 'property SomeClassName::invalidProperty.'; - $docblock = sprintf('@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithAttributes(%s = %s)',$attribute, $value); - $parser->setTarget(Target::TARGET_PROPERTY); - - try { - $parser->parse($docblock, $context); - $this->fail(); - } catch (\Doctrine\Common\Annotations\AnnotationException $exc) { - $this->assertContains("[Type Error] Attribute \"$attribute\" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithAttributes declared on property SomeClassName::invalidProperty. expects either a(n) $type, or an array of {$type}s, but got $given.", $exc->getMessage()); - } - } - - public function testAnnotationWithRequiredAttributes() - { - $parser = $this->createTestParser(); - $context = 'property SomeClassName::invalidProperty.'; - $parser->setTarget(Target::TARGET_PROPERTY); - - - $docblock = '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithRequiredAttributes("Some Value", annot = @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAnnotation)'; - $result = $parser->parse($docblock); - - $this->assertTrue(sizeof($result) === 1); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithRequiredAttributes', $result[0]); - $this->assertEquals("Some Value",$result[0]->getValue()); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAnnotation', $result[0]->getAnnot()); - - - $docblock = '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithRequiredAttributes("Some Value")'; - try { - $result = $parser->parse($docblock,$context); - $this->fail(); - } catch (\Doctrine\Common\Annotations\AnnotationException $exc) { - $this->assertContains('Attribute "annot" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithRequiredAttributes declared on property SomeClassName::invalidProperty. expects a(n) Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAnnotation. This value should not be null.', $exc->getMessage()); - } - - $docblock = '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithRequiredAttributes(annot = @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAnnotation)'; - try { - $result = $parser->parse($docblock,$context); - $this->fail(); - } catch (\Doctrine\Common\Annotations\AnnotationException $exc) { - $this->assertContains('Attribute "value" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithRequiredAttributes declared on property SomeClassName::invalidProperty. expects a(n) string. This value should not be null.', $exc->getMessage()); - } - - } - - public function testAnnotationWithRequiredAttributesWithoutContructor() - { - $parser = $this->createTestParser(); - $context = 'property SomeClassName::invalidProperty.'; - $parser->setTarget(Target::TARGET_PROPERTY); - - - $docblock = '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithRequiredAttributesWithoutContructor("Some Value", annot = @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAnnotation)'; - $result = $parser->parse($docblock); - - $this->assertTrue(sizeof($result) === 1); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithRequiredAttributesWithoutContructor', $result[0]); - $this->assertEquals("Some Value", $result[0]->value); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAnnotation', $result[0]->annot); - - - $docblock = '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithRequiredAttributesWithoutContructor("Some Value")'; - try { - $result = $parser->parse($docblock,$context); - $this->fail(); - } catch (\Doctrine\Common\Annotations\AnnotationException $exc) { - $this->assertContains('Attribute "annot" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithRequiredAttributesWithoutContructor declared on property SomeClassName::invalidProperty. expects a(n) Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAnnotation. This value should not be null.', $exc->getMessage()); - } - - $docblock = '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithRequiredAttributesWithoutContructor(annot = @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAnnotation)'; - try { - $result = $parser->parse($docblock,$context); - $this->fail(); - } catch (\Doctrine\Common\Annotations\AnnotationException $exc) { - $this->assertContains('Attribute "value" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithRequiredAttributesWithoutContructor declared on property SomeClassName::invalidProperty. expects a(n) string. This value should not be null.', $exc->getMessage()); - } - - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage Attribute "value" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnum declared on property SomeClassName::invalidProperty. accept only [ONE, TWO, THREE], but got FOUR. - */ - public function testAnnotationEnumeratorException() - { - $parser = $this->createTestParser(); - $context = 'property SomeClassName::invalidProperty.'; - $docblock = '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnum("FOUR")'; - - $parser->setIgnoreNotImportedAnnotations(false); - $parser->setTarget(Target::TARGET_PROPERTY); - $parser->parse($docblock, $context); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage Attribute "value" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnumLiteral declared on property SomeClassName::invalidProperty. accept only [AnnotationEnumLiteral::ONE, AnnotationEnumLiteral::TWO, AnnotationEnumLiteral::THREE], but got 4. - */ - public function testAnnotationEnumeratorLiteralException() - { - $parser = $this->createTestParser(); - $context = 'property SomeClassName::invalidProperty.'; - $docblock = '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnumLiteral(4)'; - - $parser->setIgnoreNotImportedAnnotations(false); - $parser->setTarget(Target::TARGET_PROPERTY); - $parser->parse($docblock, $context); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage @Enum supports only scalar values "array" given. - */ - public function testAnnotationEnumInvalidTypeDeclarationException() - { - $parser = $this->createTestParser(); - $docblock = '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnumInvalid("foo")'; - - $parser->setIgnoreNotImportedAnnotations(false); - $parser->parse($docblock); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Undefined enumerator value "3" for literal "AnnotationEnumLiteral::THREE". - */ - public function testAnnotationEnumInvalidLiteralDeclarationException() - { - $parser = $this->createTestParser(); - $docblock = '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnumLiteralInvalid("foo")'; - - $parser->setIgnoreNotImportedAnnotations(false); - $parser->parse($docblock); - } - - public function getConstantsProvider() - { - $provider[] = array( - '@AnnotationWithConstants(PHP_EOL)', - PHP_EOL - ); - $provider[] = array( - '@AnnotationWithConstants(AnnotationWithConstants::INTEGER)', - AnnotationWithConstants::INTEGER - ); - $provider[] = array( - '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants(AnnotationWithConstants::STRING)', - AnnotationWithConstants::STRING - ); - $provider[] = array( - '@AnnotationWithConstants(Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants::FLOAT)', - AnnotationWithConstants::FLOAT - ); - $provider[] = array( - '@AnnotationWithConstants(ClassWithConstants::SOME_VALUE)', - ClassWithConstants::SOME_VALUE - ); - $provider[] = array( - '@AnnotationWithConstants(ClassWithConstants::OTHER_KEY_)', - ClassWithConstants::OTHER_KEY_ - ); - $provider[] = array( - '@AnnotationWithConstants(ClassWithConstants::OTHER_KEY_2)', - ClassWithConstants::OTHER_KEY_2 - ); - $provider[] = array( - '@AnnotationWithConstants(Doctrine\Tests\Common\Annotations\Fixtures\ClassWithConstants::SOME_VALUE)', - ClassWithConstants::SOME_VALUE - ); - $provider[] = array( - '@AnnotationWithConstants(IntefaceWithConstants::SOME_VALUE)', - IntefaceWithConstants::SOME_VALUE - ); - $provider[] = array( - '@AnnotationWithConstants(\Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants::SOME_VALUE)', - IntefaceWithConstants::SOME_VALUE - ); - $provider[] = array( - '@AnnotationWithConstants({AnnotationWithConstants::STRING, AnnotationWithConstants::INTEGER, AnnotationWithConstants::FLOAT})', - array(AnnotationWithConstants::STRING, AnnotationWithConstants::INTEGER, AnnotationWithConstants::FLOAT) - ); - $provider[] = array( - '@AnnotationWithConstants({ - AnnotationWithConstants::STRING = AnnotationWithConstants::INTEGER - })', - array(AnnotationWithConstants::STRING => AnnotationWithConstants::INTEGER) - ); - $provider[] = array( - '@AnnotationWithConstants({ - Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants::SOME_KEY = AnnotationWithConstants::INTEGER - })', - array(IntefaceWithConstants::SOME_KEY => AnnotationWithConstants::INTEGER) - ); - $provider[] = array( - '@AnnotationWithConstants({ - \Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants::SOME_KEY = AnnotationWithConstants::INTEGER - })', - array(IntefaceWithConstants::SOME_KEY => AnnotationWithConstants::INTEGER) - ); - $provider[] = array( - '@AnnotationWithConstants({ - AnnotationWithConstants::STRING = AnnotationWithConstants::INTEGER, - ClassWithConstants::SOME_KEY = ClassWithConstants::SOME_VALUE, - Doctrine\Tests\Common\Annotations\Fixtures\ClassWithConstants::SOME_KEY = IntefaceWithConstants::SOME_VALUE - })', - array( - AnnotationWithConstants::STRING => AnnotationWithConstants::INTEGER, - ClassWithConstants::SOME_KEY => ClassWithConstants::SOME_VALUE, - ClassWithConstants::SOME_KEY => IntefaceWithConstants::SOME_VALUE - ) - ); - $provider[] = array( - '@AnnotationWithConstants(AnnotationWithConstants::class)', - 'Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants' - ); - $provider[] = array( - '@AnnotationWithConstants({AnnotationWithConstants::class = AnnotationWithConstants::class})', - array('Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants' => 'Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants') - ); - $provider[] = array( - '@AnnotationWithConstants(Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants::class)', - 'Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants' - ); - $provider[] = array( - '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants(Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants::class)', - 'Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants' - ); - return $provider; - } - - /** - * @dataProvider getConstantsProvider - */ - public function testSupportClassConstants($docblock, $expected) - { - $parser = $this->createTestParser(); - $parser->setImports(array( - 'classwithconstants' => 'Doctrine\Tests\Common\Annotations\Fixtures\ClassWithConstants', - 'intefacewithconstants' => 'Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants', - 'annotationwithconstants' => 'Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants' - )); - - $result = $parser->parse($docblock); - $this->assertInstanceOf('\Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants', $annotation = $result[0]); - $this->assertEquals($expected, $annotation->value); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage The annotation @SomeAnnotationClassNameWithoutConstructorAndProperties declared on does not accept any values, but got {"value":"Foo"}. - */ - public function testWithoutConstructorWhenIsNotDefaultValue() - { - $parser = $this->createTestParser(); - $docblock = <<setTarget(Target::TARGET_CLASS); - $parser->parse($docblock); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage The annotation @SomeAnnotationClassNameWithoutConstructorAndProperties declared on does not accept any values, but got {"value":"Foo"}. - */ - public function testWithoutConstructorWhenHasNoProperties() - { - $parser = $this->createTestParser(); - $docblock = <<setTarget(Target::TARGET_CLASS); - $parser->parse($docblock); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 24 in class @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithTargetSyntaxError. - */ - public function testAnnotationTargetSyntaxError() - { - $parser = $this->createTestParser(); - $context = 'class ' . 'SomeClassName'; - $docblock = <<setTarget(Target::TARGET_CLASS); - $parser->parse($docblock,$context); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid Target "Foo". Available targets: [ALL, CLASS, METHOD, PROPERTY, ANNOTATION] - */ - public function testAnnotationWithInvalidTargetDeclarationError() - { - $parser = $this->createTestParser(); - $context = 'class ' . 'SomeClassName'; - $docblock = <<setTarget(Target::TARGET_CLASS); - $parser->parse($docblock,$context); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage @Target expects either a string value, or an array of strings, "NULL" given. - */ - public function testAnnotationWithTargetEmptyError() - { - $parser = $this->createTestParser(); - $context = 'class ' . 'SomeClassName'; - $docblock = <<setTarget(Target::TARGET_CLASS); - $parser->parse($docblock,$context); - } - - /** - * @group DDC-575 - */ - public function testRegressionDDC575() - { - $parser = $this->createTestParser(); - - $docblock = <<parse($docblock); - - $this->assertInstanceOf("Doctrine\Tests\Common\Annotations\Name", $result[0]); - - $docblock = <<parse($docblock); - - $this->assertInstanceOf("Doctrine\Tests\Common\Annotations\Name", $result[0]); - } - - /** - * @group DDC-77 - */ - public function testAnnotationWithoutClassIsIgnoredWithoutWarning() - { - $parser = new DocParser(); - $parser->setIgnoreNotImportedAnnotations(true); - $result = $parser->parse("@param"); - - $this->assertEquals(0, count($result)); - } - - /** - * @group DCOM-168 - */ - public function testNotAnAnnotationClassIsIgnoredWithoutWarning() - { - $parser = new DocParser(); - $parser->setIgnoreNotImportedAnnotations(true); - $parser->setIgnoredAnnotationNames(array('PHPUnit_Framework_TestCase' => true)); - $result = $parser->parse('@PHPUnit_Framework_TestCase'); - - $this->assertEquals(0, count($result)); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage Expected PlainValue, got ''' at position 10. - */ - public function testAnnotationDontAcceptSingleQuotes() - { - $parser = $this->createTestParser(); - $parser->parse("@Name(foo='bar')"); - } - - /** - * @group DCOM-41 - */ - public function testAnnotationDoesntThrowExceptionWhenAtSignIsNotFollowedByIdentifier() - { - $parser = new DocParser(); - $result = $parser->parse("'@'"); - - $this->assertEquals(0, count($result)); - } - - /** - * @group DCOM-41 - * @expectedException \Doctrine\Common\Annotations\AnnotationException - */ - public function testAnnotationThrowsExceptionWhenAtSignIsNotFollowedByIdentifierInNestedAnnotation() - { - $parser = new DocParser(); - $parser->parse("@Doctrine\Tests\Common\Annotations\Name(@')"); - } - - /** - * @group DCOM-56 - */ - public function testAutoloadAnnotation() - { - $this->assertFalse(class_exists('Doctrine\Tests\Common\Annotations\Fixture\Annotation\Autoload', false), 'Pre-condition: Doctrine\Tests\Common\Annotations\Fixture\Annotation\Autoload not allowed to be loaded.'); - - $parser = new DocParser(); - - AnnotationRegistry::registerAutoloadNamespace('Doctrine\Tests\Common\Annotations\Fixtures\Annotation', __DIR__ . '/../../../../'); - - $parser->setImports(array( - 'autoload' => 'Doctrine\Tests\Common\Annotations\Fixtures\Annotation\Autoload', - )); - $annotations = $parser->parse('@Autoload'); - - $this->assertEquals(1, count($annotations)); - $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\Annotation\Autoload', $annotations[0]); - } - - public function createTestParser() - { - $parser = new DocParser(); - $parser->setIgnoreNotImportedAnnotations(true); - $parser->setImports(array( - 'name' => 'Doctrine\Tests\Common\Annotations\Name', - '__NAMESPACE__' => 'Doctrine\Tests\Common\Annotations', - )); - - return $parser; - } - - /** - * @group DDC-78 - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage Expected PlainValue, got ''' at position 10 in class \Doctrine\Tests\Common\Annotations\Name - */ - public function testSyntaxErrorWithContextDescription() - { - $parser = $this->createTestParser(); - $parser->parse("@Name(foo='bar')", "class \Doctrine\Tests\Common\Annotations\Name"); - } - - /** - * @group DDC-183 - */ - public function testSyntaxErrorWithUnknownCharacters() - { - $docblock = <<setInput(trim($docblock, '/ *')); - //var_dump($lexer); - - try { - $parser = $this->createTestParser(); - $parser->parse($docblock); - } catch (\Exception $e) { - $this->fail($e->getMessage()); - } - } - - /** - * @group DCOM-14 - */ - public function testIgnorePHPDocThrowTag() - { - $docblock = <<createTestParser(); - $parser->parse($docblock); - } catch (\Exception $e) { - $this->fail($e->getMessage()); - } - } - - /** - * @group DCOM-38 - */ - public function testCastInt() - { - $parser = $this->createTestParser(); - - $result = $parser->parse("@Name(foo=1234)"); - $annot = $result[0]; - $this->assertInternalType('int', $annot->foo); - } - - /** - * @group DCOM-38 - */ - public function testCastNegativeInt() - { - $parser = $this->createTestParser(); - - $result = $parser->parse("@Name(foo=-1234)"); - $annot = $result[0]; - $this->assertInternalType('int', $annot->foo); - } - - /** - * @group DCOM-38 - */ - public function testCastFloat() - { - $parser = $this->createTestParser(); - - $result = $parser->parse("@Name(foo=1234.345)"); - $annot = $result[0]; - $this->assertInternalType('float', $annot->foo); - } - - /** - * @group DCOM-38 - */ - public function testCastNegativeFloat() - { - $parser = $this->createTestParser(); - - $result = $parser->parse("@Name(foo=-1234.345)"); - $annot = $result[0]; - $this->assertInternalType('float', $annot->foo); - - $result = $parser->parse("@Marker(-1234.345)"); - $annot = $result[0]; - $this->assertInternalType('float', $annot->value); - } - - public function testReservedKeywordsInAnnotations() - { - $parser = $this->createTestParser(); - - $result = $parser->parse('@Doctrine\Tests\Common\Annotations\True'); - $this->assertTrue($result[0] instanceof True); - $result = $parser->parse('@Doctrine\Tests\Common\Annotations\False'); - $this->assertTrue($result[0] instanceof False); - $result = $parser->parse('@Doctrine\Tests\Common\Annotations\Null'); - $this->assertTrue($result[0] instanceof Null); - - $result = $parser->parse('@True'); - $this->assertTrue($result[0] instanceof True); - $result = $parser->parse('@False'); - $this->assertTrue($result[0] instanceof False); - $result = $parser->parse('@Null'); - $this->assertTrue($result[0] instanceof Null); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage [Creation Error] The annotation @SomeAnnotationClassNameWithoutConstructor declared on some class does not have a property named "invalidaProperty". Available properties: data, name - */ - public function testSetValuesExeption() - { - $docblock = <<createTestParser()->parse($docblock, 'some class'); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage [Syntax Error] Expected Doctrine\Common\Annotations\DocLexer::T_IDENTIFIER or Doctrine\Common\Annotations\DocLexer::T_TRUE or Doctrine\Common\Annotations\DocLexer::T_FALSE or Doctrine\Common\Annotations\DocLexer::T_NULL, got '3.42' at position 5. - */ - public function testInvalidIdentifierInAnnotation() - { - $parser = $this->createTestParser(); - $parser->parse('@Foo\3.42'); - } - - public function testTrailingCommaIsAllowed() - { - $parser = $this->createTestParser(); - - $annots = $parser->parse('@Name({ - "Foo", - "Bar", - })'); - $this->assertEquals(1, count($annots)); - $this->assertEquals(array('Foo', 'Bar'), $annots[0]->value); - } - - public function testDefaultAnnotationValueIsNotOverwritten() - { - $parser = $this->createTestParser(); - - $annots = $parser->parse('@Doctrine\Tests\Common\Annotations\Fixtures\Annotation\AnnotWithDefaultValue'); - $this->assertEquals(1, count($annots)); - $this->assertEquals('bar', $annots[0]->foo); - } - - public function testArrayWithColon() - { - $parser = $this->createTestParser(); - - $annots = $parser->parse('@Name({"foo": "bar"})'); - $this->assertEquals(1, count($annots)); - $this->assertEquals(array('foo' => 'bar'), $annots[0]->value); - } - - /** - * @expectedException \Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage [Semantical Error] Couldn't find constant foo. - */ - public function testInvalidContantName() - { - $parser = $this->createTestParser(); - $parser->parse('@Name(foo: "bar")'); - } - - /** - * Tests parsing empty arrays. - */ - public function testEmptyArray() - { - $parser = $this->createTestParser(); - - $annots = $parser->parse('@Name({"foo": {}})'); - $this->assertEquals(1, count($annots)); - $this->assertEquals(array('foo' => array()), $annots[0]->value); - } - - public function testKeyHasNumber() - { - $parser = $this->createTestParser(); - $annots = $parser->parse('@SettingsAnnotation(foo="test", bar2="test")'); - - $this->assertEquals(1, count($annots)); - $this->assertEquals(array('foo' => 'test', 'bar2' => 'test'), $annots[0]->settings); - } -} - -/** @Annotation */ -class SettingsAnnotation -{ - public $settings; - - public function __construct($settings) - { - $this->settings = $settings; - } -} - -/** @Annotation */ -class SomeAnnotationClassNameWithoutConstructor -{ - public $data; - public $name; -} - -/** @Annotation */ -class SomeAnnotationWithConstructorWithoutParams -{ - function __construct() - { - $this->data = "Some data"; - } - public $data; - public $name; -} - -/** @Annotation */ -class SomeAnnotationClassNameWithoutConstructorAndProperties{} - -/** - * @Annotation - * @Target("Foo") - */ -class AnnotationWithInvalidTargetDeclaration{} - -/** - * @Annotation - * @Target - */ -class AnnotationWithTargetEmpty{} - -/** @Annotation */ -class AnnotationExtendsAnnotationTargetAll extends \Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll -{ -} - -/** @Annotation */ -class Name extends \Doctrine\Common\Annotations\Annotation { - public $foo; -} - -/** @Annotation */ -class Marker { - public $value; -} - -/** @Annotation */ -class True {} - -/** @Annotation */ -class False {} - -/** @Annotation */ -class Null {} - -namespace Doctrine\Tests\Common\Annotations\FooBar; - -/** @Annotation */ -class Name extends \Doctrine\Common\Annotations\Annotation { -} diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/DummyClass.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/DummyClass.php deleted file mode 100644 index 17223f68adf5..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/DummyClass.php +++ /dev/null @@ -1,48 +0,0 @@ -cacheDir = sys_get_temp_dir() . "/annotations_". uniqid(); - @mkdir($this->cacheDir); - return new FileCacheReader(new AnnotationReader(), $this->cacheDir); - } - - public function tearDown() - { - foreach (glob($this->cacheDir.'/*.php') AS $file) { - unlink($file); - } - rmdir($this->cacheDir); - } - - /** - * @group DCOM-81 - */ - public function testAttemptToCreateAnnotationCacheDir() - { - $this->cacheDir = sys_get_temp_dir() . "/not_existed_dir_". uniqid(); - - $this->assertFalse(is_dir($this->cacheDir)); - - new FileCacheReader(new AnnotationReader(), $this->cacheDir); - - $this->assertTrue(is_dir($this->cacheDir)); - } -} \ No newline at end of file diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/AnnotWithDefaultValue.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/AnnotWithDefaultValue.php deleted file mode 100644 index 44108e192460..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/AnnotWithDefaultValue.php +++ /dev/null @@ -1,10 +0,0 @@ -roles = $values['value']; - } -} \ No newline at end of file diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Template.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Template.php deleted file mode 100644 index b507e602aa0c..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Template.php +++ /dev/null @@ -1,14 +0,0 @@ -name = isset($values['value']) ? $values['value'] : null; - } -} \ No newline at end of file diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Version.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Version.php deleted file mode 100644 index 09ef03177f79..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Version.php +++ /dev/null @@ -1,11 +0,0 @@ -"), - @Attribute("arrayOfStrings", type = "string[]"), - @Attribute("annotation", type = "Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll"), - @Attribute("arrayOfAnnotations", type = "array"), - }) - */ -final class AnnotationWithAttributes -{ - - public final function __construct(array $data) - { - foreach ($data as $key => $value) { - $this->$key = $value; - } - } - - private $mixed; - private $boolean; - private $bool; - private $float; - private $string; - private $integer; - private $array; - private $annotation; - private $arrayOfIntegers; - private $arrayOfStrings; - private $arrayOfAnnotations; - - /** - * @return mixed - */ - public function getMixed() - { - return $this->mixed; - } - - /** - * @return boolean - */ - public function getBoolean() - { - return $this->boolean; - } - - /** - * @return bool - */ - public function getBool() - { - return $this->bool; - } - - /** - * @return float - */ - public function getFloat() - { - return $this->float; - } - - /** - * @return string - */ - public function getString() - { - return $this->string; - } - - public function getInteger() - { - return $this->integer; - } - - /** - * @return array - */ - public function getArray() - { - return $this->array; - } - - /** - * @return Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll - */ - public function getAnnotation() - { - return $this->annotation; - } - - /** - * @return string[] - */ - public function getArrayOfStrings() - { - return $this->arrayOfIntegers; - } - - /** - * @return array - */ - public function getArrayOfIntegers() - { - return $this->arrayOfIntegers; - } - - /** - * @return array - */ - public function getArrayOfAnnotations() - { - return $this->arrayOfAnnotations; - } - -} \ No newline at end of file diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationWithConstants.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationWithConstants.php deleted file mode 100644 index 9c94558be3ef..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationWithConstants.php +++ /dev/null @@ -1,20 +0,0 @@ - $value) { - $this->$key = $value; - } - } - - /** - * @var string - */ - private $value; - - /** - * - * @var Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAnnotation - */ - private $annot; - - /** - * @return string - */ - public function getValue() - { - return $this->value; - } - - /** - * @return Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAnnotation - */ - public function getAnnot() - { - return $this->annot; - } - -} \ No newline at end of file diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationWithRequiredAttributesWithoutContructor.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationWithRequiredAttributesWithoutContructor.php deleted file mode 100644 index bf458ee77a99..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationWithRequiredAttributesWithoutContructor.php +++ /dev/null @@ -1,24 +0,0 @@ - - */ - public $arrayOfIntegers; - - /** - * @var string[] - */ - public $arrayOfStrings; - - /** - * @var array - */ - public $arrayOfAnnotations; - -} \ No newline at end of file diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Api.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Api.php deleted file mode 100644 index 534ad14279f9..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Api.php +++ /dev/null @@ -1,10 +0,0 @@ -events->filter(function ($item) use ($year, $month, $day) { - $leftDate = new \DateTime($year.'-'.$month.'-'.$day.' 00:00'); - $rigthDate = new \DateTime($year.'-'.$month.'-'.$day.' +1 day 00:00'); - return ( ( $leftDate <= $item->getDateStart() ) && ( $item->getDateStart() < $rigthDate ) ); - - } - ); - return $extractEvents; - } - -} \ No newline at end of file diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithConstants.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithConstants.php deleted file mode 100644 index 719d68f6c5c5..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithConstants.php +++ /dev/null @@ -1,11 +0,0 @@ - - */ -class Controller -{ - /** - * @Route("/", name="_demo") - * @Template() - */ - public function indexAction() - { - return array(); - } - - /** - * @Route("/hello/{name}", name="_demo_hello") - * @Template() - */ - public function helloAction($name) - { - return array('name' => $name); - } - - /** - * @Route("/contact", name="_demo_contact") - * @Template() - */ - public function contactAction() - { - $form = ContactForm::create($this->get('form.context'), 'contact'); - - $form->bind($this->container->get('request'), $form); - if ($form->isValid()) { - $form->send($this->get('mailer')); - - $this->get('session')->setFlash('notice', 'Message sent!'); - - return new RedirectResponse($this->generateUrl('_demo')); - } - - return array('form' => $form); - } - - /** - * Creates the ACL for the passed object identity - * - * @param ObjectIdentityInterface $oid - * @return void - */ - private function createObjectIdentity(ObjectIdentityInterface $oid) - { - $classId = $this->createOrRetrieveClassId($oid->getType()); - - $this->connection->executeQuery($this->getInsertObjectIdentitySql($oid->getIdentifier(), $classId, true)); - } - - /** - * Returns the primary key for the passed class type. - * - * If the type does not yet exist in the database, it will be created. - * - * @param string $classType - * @return integer - */ - private function createOrRetrieveClassId($classType) - { - if (false !== $id = $this->connection->executeQuery($this->getSelectClassIdSql($classType))->fetchColumn()) { - return $id; - } - - $this->connection->executeQuery($this->getInsertClassSql($classType)); - - return $this->connection->executeQuery($this->getSelectClassIdSql($classType))->fetchColumn(); - } - - /** - * Returns the primary key for the passed security identity. - * - * If the security identity does not yet exist in the database, it will be - * created. - * - * @param SecurityIdentityInterface $sid - * @return integer - */ - private function createOrRetrieveSecurityIdentityId(SecurityIdentityInterface $sid) - { - if (false !== $id = $this->connection->executeQuery($this->getSelectSecurityIdentityIdSql($sid))->fetchColumn()) { - return $id; - } - - $this->connection->executeQuery($this->getInsertSecurityIdentitySql($sid)); - - return $this->connection->executeQuery($this->getSelectSecurityIdentityIdSql($sid))->fetchColumn(); - } - - /** - * Deletes all ACEs for the given object identity primary key. - * - * @param integer $oidPK - * @return void - */ - private function deleteAccessControlEntries($oidPK) - { - $this->connection->executeQuery($this->getDeleteAccessControlEntriesSql($oidPK)); - } - - /** - * Deletes the object identity from the database. - * - * @param integer $pk - * @return void - */ - private function deleteObjectIdentity($pk) - { - $this->connection->executeQuery($this->getDeleteObjectIdentitySql($pk)); - } - - /** - * Deletes all entries from the relations table from the database. - * - * @param integer $pk - * @return void - */ - private function deleteObjectIdentityRelations($pk) - { - $this->connection->executeQuery($this->getDeleteObjectIdentityRelationsSql($pk)); - } - - /** - * This regenerates the ancestor table which is used for fast read access. - * - * @param AclInterface $acl - * @return void - */ - private function regenerateAncestorRelations(AclInterface $acl) - { - $pk = $acl->getId(); - $this->connection->executeQuery($this->getDeleteObjectIdentityRelationsSql($pk)); - $this->connection->executeQuery($this->getInsertObjectIdentityRelationSql($pk, $pk)); - - $parentAcl = $acl->getParentAcl(); - while (null !== $parentAcl) { - $this->connection->executeQuery($this->getInsertObjectIdentityRelationSql($pk, $parentAcl->getId())); - - $parentAcl = $parentAcl->getParentAcl(); - } - } - - /** - * This processes changes on an ACE related property (classFieldAces, or objectFieldAces). - * - * @param string $name - * @param array $changes - * @return void - */ - private function updateFieldAceProperty($name, array $changes) - { - $sids = new \SplObjectStorage(); - $classIds = new \SplObjectStorage(); - $currentIds = array(); - foreach ($changes[1] as $field => $new) { - for ($i=0,$c=count($new); $i<$c; $i++) { - $ace = $new[$i]; - - if (null === $ace->getId()) { - if ($sids->contains($ace->getSecurityIdentity())) { - $sid = $sids->offsetGet($ace->getSecurityIdentity()); - } else { - $sid = $this->createOrRetrieveSecurityIdentityId($ace->getSecurityIdentity()); - } - - $oid = $ace->getAcl()->getObjectIdentity(); - if ($classIds->contains($oid)) { - $classId = $classIds->offsetGet($oid); - } else { - $classId = $this->createOrRetrieveClassId($oid->getType()); - } - - $objectIdentityId = $name === 'classFieldAces' ? null : $ace->getAcl()->getId(); - - $this->connection->executeQuery($this->getInsertAccessControlEntrySql($classId, $objectIdentityId, $field, $i, $sid, $ace->getStrategy(), $ace->getMask(), $ace->isGranting(), $ace->isAuditSuccess(), $ace->isAuditFailure())); - $aceId = $this->connection->executeQuery($this->getSelectAccessControlEntryIdSql($classId, $objectIdentityId, $field, $i))->fetchColumn(); - $this->loadedAces[$aceId] = $ace; - - $aceIdProperty = new \ReflectionProperty('Symfony\Component\Security\Acl\Domain\Entry', 'id'); - $aceIdProperty->setAccessible(true); - $aceIdProperty->setValue($ace, intval($aceId)); - } else { - $currentIds[$ace->getId()] = true; - } - } - } - - foreach ($changes[0] as $old) { - for ($i=0,$c=count($old); $i<$c; $i++) { - $ace = $old[$i]; - - if (!isset($currentIds[$ace->getId()])) { - $this->connection->executeQuery($this->getDeleteAccessControlEntrySql($ace->getId())); - unset($this->loadedAces[$ace->getId()]); - } - } - } - } - - /** - * This processes changes on an ACE related property (classAces, or objectAces). - * - * @param string $name - * @param array $changes - * @return void - */ - private function updateAceProperty($name, array $changes) - { - list($old, $new) = $changes; - - $sids = new \SplObjectStorage(); - $classIds = new \SplObjectStorage(); - $currentIds = array(); - for ($i=0,$c=count($new); $i<$c; $i++) { - $ace = $new[$i]; - - if (null === $ace->getId()) { - if ($sids->contains($ace->getSecurityIdentity())) { - $sid = $sids->offsetGet($ace->getSecurityIdentity()); - } else { - $sid = $this->createOrRetrieveSecurityIdentityId($ace->getSecurityIdentity()); - } - - $oid = $ace->getAcl()->getObjectIdentity(); - if ($classIds->contains($oid)) { - $classId = $classIds->offsetGet($oid); - } else { - $classId = $this->createOrRetrieveClassId($oid->getType()); - } - - $objectIdentityId = $name === 'classAces' ? null : $ace->getAcl()->getId(); - - $this->connection->executeQuery($this->getInsertAccessControlEntrySql($classId, $objectIdentityId, null, $i, $sid, $ace->getStrategy(), $ace->getMask(), $ace->isGranting(), $ace->isAuditSuccess(), $ace->isAuditFailure())); - $aceId = $this->connection->executeQuery($this->getSelectAccessControlEntryIdSql($classId, $objectIdentityId, null, $i))->fetchColumn(); - $this->loadedAces[$aceId] = $ace; - - $aceIdProperty = new \ReflectionProperty($ace, 'id'); - $aceIdProperty->setAccessible(true); - $aceIdProperty->setValue($ace, intval($aceId)); - } else { - $currentIds[$ace->getId()] = true; - } - } - - for ($i=0,$c=count($old); $i<$c; $i++) { - $ace = $old[$i]; - - if (!isset($currentIds[$ace->getId()])) { - $this->connection->executeQuery($this->getDeleteAccessControlEntrySql($ace->getId())); - unset($this->loadedAces[$ace->getId()]); - } - } - } - - /** - * Persists the changes which were made to ACEs to the database. - * - * @param \SplObjectStorage $aces - * @return void - */ - private function updateAces(\SplObjectStorage $aces) - { - foreach ($aces as $ace) { - $propertyChanges = $aces->offsetGet($ace); - $sets = array(); - - if (isset($propertyChanges['mask'])) { - $sets[] = sprintf('mask = %d', $propertyChanges['mask'][1]); - } - if (isset($propertyChanges['strategy'])) { - $sets[] = sprintf('granting_strategy = %s', $this->connection->quote($propertyChanges['strategy'])); - } - if (isset($propertyChanges['aceOrder'])) { - $sets[] = sprintf('ace_order = %d', $propertyChanges['aceOrder'][1]); - } - if (isset($propertyChanges['auditSuccess'])) { - $sets[] = sprintf('audit_success = %s', $this->connection->getDatabasePlatform()->convertBooleans($propertyChanges['auditSuccess'][1])); - } - if (isset($propertyChanges['auditFailure'])) { - $sets[] = sprintf('audit_failure = %s', $this->connection->getDatabasePlatform()->convertBooleans($propertyChanges['auditFailure'][1])); - } - - $this->connection->executeQuery($this->getUpdateAccessControlEntrySql($ace->getId(), $sets)); - } - } -} \ No newline at end of file diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/DifferentNamespacesPerFileWithClassAsFirst.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/DifferentNamespacesPerFileWithClassAsFirst.php deleted file mode 100644 index bda2cc21ba1f..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/DifferentNamespacesPerFileWithClassAsFirst.php +++ /dev/null @@ -1,15 +0,0 @@ -test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test2() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test3() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test4() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test5() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test6() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test7() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test8() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - - } - - public function test9() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test10() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test11() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test12() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test13() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test14() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test15() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test16() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test17() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - - } - - public function test18() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test19() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test20() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test21() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test22() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test23() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test24() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test25() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test26() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test27() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - - } - - public function test28() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test29() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test30() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test31() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test32() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test33() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test34() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test35() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test36() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test37() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - - } - - public function test38() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test39() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } -} diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/NoAnnotation.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/NoAnnotation.php deleted file mode 100644 index 1dae104a4439..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/NoAnnotation.php +++ /dev/null @@ -1,5 +0,0 @@ -test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test2() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test3() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test4() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test5() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test6() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test7() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test8() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - - } - - public function test9() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test10() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test11() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test12() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test13() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test14() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test15() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test16() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test17() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - - } - - public function test18() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test19() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test20() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test21() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test22() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test23() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test24() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test25() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test26() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test27() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - - } - - public function test28() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test29() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test30() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test31() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test32() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test33() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test34() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test35() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test36() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test37() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - - } - - public function test38() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } - - public function test39() - { - echo $this->test1; - echo $this->test2; - echo $this->test3; - $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - foreach ($array as $key => $value) { - echo $key . ' => ' . $value; - } - - $val = (string)self::TEST1; - $val .= (string)self::TEST2; - $val .= (string)self::TEST3; - $val .= (string)self::TEST4; - $val .= (string)self::TEST5; - $val .= (string)self::TEST6; - $val .= (string)self::TEST7; - $val .= (string)self::TEST8; - $val .= (string)self::TEST9; - - strtolower($val); - - return $val; - } -} diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/TestInterface.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/TestInterface.php deleted file mode 100644 index 58c5e6af5e3a..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/TestInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -getMethod(); - - $time = microtime(true); - for ($i=0,$c=500; $i<$c; $i++) { - $reader->getMethodAnnotations($method); - } - $time = microtime(true) - $time; - - $this->printResults('cached reader (in-memory)', $time, $c); - } - - /** - * @group performance - */ - public function testCachedReadPerformanceWithFileCache() - { - $method = $this->getMethod(); - - // prime cache - $reader = new FileCacheReader(new AnnotationReader(), sys_get_temp_dir()); - $reader->getMethodAnnotations($method); - - $time = microtime(true); - for ($i=0,$c=500; $i<$c; $i++) { - $reader = new FileCacheReader(new AnnotationReader(), sys_get_temp_dir()); - $reader->getMethodAnnotations($method); - clearstatcache(); - } - $time = microtime(true) - $time; - - $this->printResults('cached reader (file)', $time, $c); - } - - /** - * @group performance - */ - public function testReadPerformance() - { - $method = $this->getMethod(); - - $time = microtime(true); - for ($i=0,$c=150; $i<$c; $i++) { - $reader = new AnnotationReader(); - $reader->getMethodAnnotations($method); - } - $time = microtime(true) - $time; - - $this->printResults('reader', $time, $c); - } - - /** - * @group performance - */ - public function testDocParsePerformance() - { - $imports = array( - 'ignorephpdoc' => 'Annotations\Annotation\IgnorePhpDoc', - 'ignoreannotation' => 'Annotations\Annotation\IgnoreAnnotation', - 'route' => 'Doctrine\Tests\Common\Annotations\Fixtures\Annotation\Route', - 'template' => 'Doctrine\Tests\Common\Annotations\Fixtures\Annotation\Template', - '__NAMESPACE__' => 'Doctrine\Tests\Common\Annotations\Fixtures', - ); - $ignored = array( - 'access', 'author', 'copyright', 'deprecated', 'example', 'ignore', - 'internal', 'link', 'see', 'since', 'tutorial', 'version', 'package', - 'subpackage', 'name', 'global', 'param', 'return', 'staticvar', - 'static', 'var', 'throws', 'inheritdoc', - ); - - $method = $this->getMethod(); - $methodComment = $method->getDocComment(); - $classComment = $method->getDeclaringClass()->getDocComment(); - - $time = microtime(true); - for ($i=0,$c=200; $i<$c; $i++) { - $parser = new DocParser(); - $parser->setImports($imports); - $parser->setIgnoredAnnotationNames($ignored); - $parser->setIgnoreNotImportedAnnotations(true); - - $parser->parse($methodComment); - $parser->parse($classComment); - } - $time = microtime(true) - $time; - - $this->printResults('doc-parser', $time, $c); - } - - /** - * @group performance - */ - public function testDocLexerPerformance() - { - $method = $this->getMethod(); - $methodComment = $method->getDocComment(); - $classComment = $method->getDeclaringClass()->getDocComment(); - - $time = microtime(true); - for ($i=0,$c=500; $i<$c; $i++) { - $lexer = new DocLexer(); - $lexer->setInput($methodComment); - $lexer->setInput($classComment); - } - $time = microtime(true) - $time; - - $this->printResults('doc-lexer', $time, $c); - } - - /** - * @group performance - */ - public function testPhpParserPerformanceWithShortCut() - { - $class = new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\NamespacedSingleClassLOC1000'); - - $time = microtime(true); - for ($i=0,$c=500; $i<$c; $i++) { - $parser = new PhpParser(); - $parser->parseClass($class); - } - $time = microtime(true) - $time; - - $this->printResults('doc-parser-with-short-cut', $time, $c); - } - - /** - * @group performance - */ - public function testPhpParserPerformanceWithoutShortCut() - { - $class = new \ReflectionClass('SingleClassLOC1000'); - - $time = microtime(true); - for ($i=0,$c=500; $i<$c; $i++) { - $parser = new PhpParser(); - $parser->parseClass($class); - } - $time = microtime(true) - $time; - - $this->printResults('doc-parser-without-short-cut', $time, $c); - } - - private function getMethod() - { - return new \ReflectionMethod('Doctrine\Tests\Common\Annotations\Fixtures\Controller', 'helloAction'); - } - - private function printResults($test, $time, $iterations) - { - if (0 == $iterations) { - throw new \InvalidArgumentException('$iterations cannot be zero.'); - } - - $title = $test." results:\n"; - $iterationsText = sprintf("Iterations: %d\n", $iterations); - $totalTime = sprintf("Total Time: %.3f s\n", $time); - $iterationTime = sprintf("Time per iteration: %.3f ms\n", $time/$iterations * 1000); - - $max = max(strlen($title), strlen($iterationTime)) - 1; - - echo "\n".str_repeat('-', $max)."\n"; - echo $title; - echo str_repeat('=', $max)."\n"; - echo $iterationsText; - echo $totalTime; - echo $iterationTime; - echo str_repeat('-', $max)."\n"; - } -} \ No newline at end of file diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/PhpParserTest.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/PhpParserTest.php deleted file mode 100644 index dc01f8b08a99..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/PhpParserTest.php +++ /dev/null @@ -1,207 +0,0 @@ -assertEquals(array( - 'route' => __NAMESPACE__ . '\Fixtures\Annotation\Route', - 'secure' => __NAMESPACE__ . '\Fixtures\Annotation\Secure', - ), $parser->parseClass($class)); - } - - public function testParseClassWithMultipleImportsInUseStatement() - { - $class = new ReflectionClass(__NAMESPACE__ . '\Fixtures\MultipleImportsInUseStatement'); - $parser = new PhpParser(); - - $this->assertEquals(array( - 'route' => __NAMESPACE__ . '\Fixtures\Annotation\Route', - 'secure' => __NAMESPACE__ . '\Fixtures\Annotation\Secure', - ), $parser->parseClass($class)); - } - - public function testParseClassWhenNotUserDefined() - { - $parser = new PhpParser(); - $this->assertEquals(array(), $parser->parseClass(new \ReflectionClass('\stdClass'))); - } - - public function testClassFileDoesNotExist() - { - $class = $this->getMockBuilder('\ReflectionClass') - ->disableOriginalConstructor() - ->getMock(); - $class->expects($this->once()) - ->method('getFilename') - ->will($this->returnValue('/valid/class/Fake.php(35) : eval()d code')); - - $parser = new PhpParser(); - $this->assertEquals(array(), $parser->parseClass($class)); - } - - public function testParseClassWhenClassIsNotNamespaced() - { - $parser = new PhpParser(); - $class = new ReflectionClass('\AnnotationsTestsFixturesNonNamespacedClass'); - - $this->assertEquals(array( - 'route' => __NAMESPACE__ . '\Fixtures\Annotation\Route', - 'template' => __NAMESPACE__ . '\Fixtures\Annotation\Template', - ), $parser->parseClass($class)); - } - - public function testParseClassWhenClassIsInterface() - { - $parser = new PhpParser(); - $class = new ReflectionClass(__NAMESPACE__ . '\Fixtures\TestInterface'); - - $this->assertEquals(array( - 'secure' => __NAMESPACE__ . '\Fixtures\Annotation\Secure', - ), $parser->parseClass($class)); - } - - public function testClassWithFullyQualifiedUseStatements() - { - $parser = new PhpParser(); - $class = new ReflectionClass(__NAMESPACE__ . '\Fixtures\ClassWithFullyQualifiedUseStatements'); - - $this->assertEquals(array( - 'secure' => '\\' . __NAMESPACE__ . '\Fixtures\Annotation\Secure', - 'route' => '\\' . __NAMESPACE__ . '\Fixtures\Annotation\Route', - 'template' => '\\' . __NAMESPACE__ . '\Fixtures\Annotation\Template', - ), $parser->parseClass($class)); - } - - public function testNamespaceAndClassCommentedOut() - { - $parser = new PhpParser(); - $class = new ReflectionClass(__NAMESPACE__ . '\Fixtures\NamespaceAndClassCommentedOut'); - - $this->assertEquals(array( - 'route' => __NAMESPACE__ . '\Fixtures\Annotation\Route', - 'template' => __NAMESPACE__ . '\Fixtures\Annotation\Template', - ), $parser->parseClass($class)); - } - - public function testEqualNamespacesPerFileWithClassAsFirst() - { - $parser = new PhpParser(); - $class = new ReflectionClass(__NAMESPACE__ . '\Fixtures\EqualNamespacesPerFileWithClassAsFirst'); - - $this->assertEquals(array( - 'secure' => __NAMESPACE__ . '\Fixtures\Annotation\Secure', - 'route' => __NAMESPACE__ . '\Fixtures\Annotation\Route', - ), $parser->parseClass($class)); - } - - public function testEqualNamespacesPerFileWithClassAsLast() - { - $parser = new PhpParser(); - $class = new ReflectionClass(__NAMESPACE__ . '\Fixtures\EqualNamespacesPerFileWithClassAsLast'); - - $this->assertEquals(array( - 'route' => __NAMESPACE__ . '\Fixtures\Annotation\Route', - 'template' => __NAMESPACE__ . '\Fixtures\Annotation\Template', - ), $parser->parseClass($class)); - } - - public function testDifferentNamespacesPerFileWithClassAsFirst() - { - $parser = new PhpParser(); - $class = new ReflectionClass(__NAMESPACE__ . '\Fixtures\DifferentNamespacesPerFileWithClassAsFirst'); - - $this->assertEquals(array( - 'secure' => __NAMESPACE__ . '\Fixtures\Annotation\Secure', - ), $parser->parseClass($class)); - } - - public function testDifferentNamespacesPerFileWithClassAsLast() - { - $parser = new PhpParser(); - $class = new ReflectionClass(__NAMESPACE__ . '\Fixtures\DifferentNamespacesPerFileWithClassAsLast'); - - $this->assertEquals(array( - 'template' => __NAMESPACE__ . '\Fixtures\Annotation\Template', - ), $parser->parseClass($class)); - } - - public function testGlobalNamespacesPerFileWithClassAsFirst() - { - $parser = new PhpParser(); - $class = new \ReflectionClass('\GlobalNamespacesPerFileWithClassAsFirst'); - - $this->assertEquals(array( - 'secure' => __NAMESPACE__ . '\Fixtures\Annotation\Secure', - 'route' => __NAMESPACE__ . '\Fixtures\Annotation\Route', - ), $parser->parseClass($class)); - } - - public function testGlobalNamespacesPerFileWithClassAsLast() - { - $parser = new PhpParser(); - $class = new ReflectionClass('\GlobalNamespacesPerFileWithClassAsLast'); - - $this->assertEquals(array( - 'route' => __NAMESPACE__ . '\Fixtures\Annotation\Route', - 'template' => __NAMESPACE__ . '\Fixtures\Annotation\Template', - ), $parser->parseClass($class)); - } - - public function testNamespaceWithClosureDeclaration() - { - $parser = new PhpParser(); - $class = new ReflectionClass(__NAMESPACE__ . '\Fixtures\NamespaceWithClosureDeclaration'); - - $this->assertEquals(array( - 'secure' => __NAMESPACE__ . '\Fixtures\Annotation\Secure', - 'route' => __NAMESPACE__ . '\Fixtures\Annotation\Route', - 'template' => __NAMESPACE__ . '\Fixtures\Annotation\Template', - ), $parser->parseClass($class)); - } - - public function testIfPointerResetsOnMultipleParsingTries() - { - $parser = new PhpParser(); - $class = new ReflectionClass(__NAMESPACE__ . '\Fixtures\NamespaceWithClosureDeclaration'); - - $this->assertEquals(array( - 'secure' => __NAMESPACE__ . '\Fixtures\Annotation\Secure', - 'route' => __NAMESPACE__ . '\Fixtures\Annotation\Route', - 'template' => __NAMESPACE__ . '\Fixtures\Annotation\Template', - ), $parser->parseClass($class)); - - $this->assertEquals(array( - 'secure' => __NAMESPACE__ . '\Fixtures\Annotation\Secure', - 'route' => __NAMESPACE__ . '\Fixtures\Annotation\Route', - 'template' => __NAMESPACE__ . '\Fixtures\Annotation\Template', - ), $parser->parseClass($class)); - } - - /** - * @group DCOM-97 - * @group regression - */ - public function testClassWithClosure() - { - $parser = new PhpParser(); - $class = new ReflectionClass(__NAMESPACE__ . '\Fixtures\ClassWithClosure'); - - $this->assertEquals(array( - 'annotationtargetall' => __NAMESPACE__ . '\Fixtures\AnnotationTargetAll', - 'annotationtargetannotation' => __NAMESPACE__ . '\Fixtures\AnnotationTargetAnnotation', - ), $parser->parseClass($class)); - } -} \ No newline at end of file diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/SimpleAnnotationReaderTest.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/SimpleAnnotationReaderTest.php deleted file mode 100644 index 51b932a617d7..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/SimpleAnnotationReaderTest.php +++ /dev/null @@ -1,102 +0,0 @@ -markTestSkipped('The simplified annotation reader would always autoload annotations'); - } - - /** - * @group DDC-1660 - * @group regression - * - * Contrary to the behavior of the default annotation reader, @version is not ignored - */ - public function testInvalidAnnotationButIgnored() - { - $reader = $this->getReader(); - $class = new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassDDC1660'); - - $this->assertTrue(class_exists('Doctrine\Tests\Common\Annotations\Fixtures\Annotation\Version')); - $this->assertCount(1, $reader->getClassAnnotations($class)); - $this->assertCount(1, $reader->getMethodAnnotations($class->getMethod('bar'))); - $this->assertCount(1, $reader->getPropertyAnnotations($class->getProperty('foo'))); - } - - protected function getReader() - { - $reader = new SimpleAnnotationReader(); - $reader->addNamespace(__NAMESPACE__); - $reader->addNamespace(__NAMESPACE__ . '\Fixtures'); - $reader->addNamespace(__NAMESPACE__ . '\Fixtures\Annotation'); - - return $reader; - } -} \ No newline at end of file diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM55Test.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM55Test.php deleted file mode 100644 index a6159d59afea..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM55Test.php +++ /dev/null @@ -1,66 +0,0 @@ -getClassAnnotations($class); - } - - public function testAnnotation() - { - $class = new \ReflectionClass(__NAMESPACE__ . '\\DCOM55Consumer'); - $reader = new AnnotationReader(); - $annots = $reader->getClassAnnotations($class); - - $this->assertEquals(1, count($annots)); - $this->assertInstanceOf(__NAMESPACE__.'\\DCOM55Annotation', $annots[0]); - } - - public function testParseAnnotationDocblocks() - { - $class = new \ReflectionClass(__NAMESPACE__ . '\\DCOM55Annotation'); - $reader = new AnnotationReader(); - $annots = $reader->getClassAnnotations($class); - - $this->assertEquals(0, count($annots)); - } -} - -/** - * @Controller - */ -class Dummy -{ - -} - -/** - * @Annotation - */ -class DCOM55Annotation -{ - -} - -/** - * @DCOM55Annotation - */ -class DCOM55Consumer -{ - -} \ No newline at end of file diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Entity.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Entity.php deleted file mode 100644 index 708bcc992b05..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Entity.php +++ /dev/null @@ -1,8 +0,0 @@ -getClassAnnotations(new \ReflectionClass(__NAMESPACE__."\MappedClass")); - - foreach ($result as $annot) { - $classAnnotations[get_class($annot)] = $annot; - } - - $this->assertTrue(!isset($classAnnotations['']), 'Class "xxx" is not a valid entity or mapped super class.'); - } - - public function testIssueGlobalNamespace() - { - $docblock = "@Entity"; - $parser = new DocParser(); - $parser->setImports(array( - "__NAMESPACE__" =>"Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM\Mapping" - )); - - $annots = $parser->parse($docblock); - - $this->assertEquals(1, count($annots)); - $this->assertInstanceOf("Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM\Mapping\Entity", $annots[0]); - } - - public function testIssueNamespaces() - { - $docblock = "@Entity"; - $parser = new DocParser(); - $parser->addNamespace("Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM"); - - $annots = $parser->parse($docblock); - - $this->assertEquals(1, count($annots)); - $this->assertInstanceOf("Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM\Entity", $annots[0]); - } - - public function testIssueMultipleNamespaces() - { - $docblock = "@Entity"; - $parser = new DocParser(); - $parser->addNamespace("Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM\Mapping"); - $parser->addNamespace("Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM"); - - $annots = $parser->parse($docblock); - - $this->assertEquals(1, count($annots)); - $this->assertInstanceOf("Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM\Mapping\Entity", $annots[0]); - } - - public function testIssueWithNamespacesOrImports() - { - $docblock = "@Entity"; - $parser = new DocParser(); - $annots = $parser->parse($docblock); - - $this->assertEquals(1, count($annots)); - $this->assertInstanceOf("Entity", $annots[0]); - $this->assertEquals(1, count($annots)); - } - - - public function testIssueSimpleAnnotationReader() - { - $reader = new SimpleAnnotationReader(); - $reader->addNamespace('Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM\Mapping'); - $annots = $reader->getClassAnnotations(new \ReflectionClass(__NAMESPACE__."\MappedClass")); - - $this->assertEquals(1, count($annots)); - $this->assertInstanceOf("Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM\Mapping\Entity", $annots[0]); - } - -} - -/** - * @Entity - */ -class MappedClass -{ - -} - - -namespace Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM\Mapping; -/** -* @Annotation -*/ -class Entity -{ - -} - -namespace Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM; -/** -* @Annotation -*/ -class Entity -{ - -} diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/TopLevelAnnotation.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/TopLevelAnnotation.php deleted file mode 100644 index ff3ca376bca5..000000000000 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/TopLevelAnnotation.php +++ /dev/null @@ -1,8 +0,0 @@ -> ./tests/travis/php.ini ;fi" - composer self-update - - composer --prefer-source --dev install - sh -c "if [ $TRAVIS_PHP_VERSION != 'hhvm' ]; then phpenv config-add ./tests/travis/php.ini; fi" +install: + - composer --prefer-source --dev install + script: - ./vendor/bin/phpunit -c ./tests/travis/phpunit.travis.xml -v diff --git a/core/vendor/doctrine/cache/UPGRADE.md b/core/vendor/doctrine/cache/UPGRADE.md new file mode 100644 index 000000000000..e1f8a503eef6 --- /dev/null +++ b/core/vendor/doctrine/cache/UPGRADE.md @@ -0,0 +1,16 @@ +# Upgrade to 1.4 + +## Minor BC Break: `Doctrine\Common\Cache\FileCache#$extension` is now `private`. + +If you need to override the value of `Doctrine\Common\Cache\FileCache#$extension`, then use the +second parameter of `Doctrine\Common\Cache\FileCache#__construct()` instead of overriding +the property in your own implementation. + +## Minor BC Break: file based caches paths changed + +`Doctrine\Common\Cache\FileCache`, `Doctrine\Common\Cache\PhpFileCache` and +`Doctrine\Common\Cache\FilesystemCache` are using a different cache paths structure. + +If you rely on warmed up caches for deployments, consider that caches generated +with `doctrine/cache` `<1.4` are not compatible with the new directory structure, +and will be ignored. diff --git a/core/vendor/doctrine/cache/composer.json b/core/vendor/doctrine/cache/composer.json index 25b9de8f5309..f3caa7a883ac 100644 --- a/core/vendor/doctrine/cache/composer.json +++ b/core/vendor/doctrine/cache/composer.json @@ -17,7 +17,8 @@ }, "require-dev": { "phpunit/phpunit": ">=3.7", - "satooshi/php-coveralls": "~0.6" + "satooshi/php-coveralls": "~0.6", + "predis/predis": "~1.0" }, "conflict": { "doctrine/common": ">2.2,<2.4" @@ -27,7 +28,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "1.5.x-dev" } } } diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php index 1f19db675b20..abd5e71c2a53 100644 --- a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php @@ -72,12 +72,20 @@ class ApcCache extends CacheProvider return apc_clear_cache() && apc_clear_cache('user'); } + /** + * {@inheritdoc} + */ + protected function doFetchMultiple(array $keys) + { + return apc_fetch($keys); + } + /** * {@inheritdoc} */ protected function doGetStats() { - $info = apc_cache_info(); + $info = apc_cache_info('', true); $sma = apc_sma_info(); // @TODO - Temporary fix @see https://github.com/krakjoe/apcu/pull/42 diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ArrayCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ArrayCache.php index e8243775cd06..31a0729011f6 100644 --- a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ArrayCache.php +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ArrayCache.php @@ -50,6 +50,7 @@ class ArrayCache extends CacheProvider */ protected function doContains($id) { + // isset() is required for performance optimizations, to avoid unnecessary function calls to array_key_exists. return isset($this->data[$id]) || array_key_exists($id, $this->data); } diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php index 0785f263b7ab..205a12327ef9 100644 --- a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php @@ -29,6 +29,7 @@ namespace Doctrine\Common\Cache; * @author Jonathan Wage * @author Roman Borschel * @author Fabio B. Silva + * @author Kévin Dunglas */ interface Cache { @@ -51,7 +52,7 @@ interface Cache * * @return mixed The cached data or FALSE, if no cache entry exists for the given id. */ - function fetch($id); + public function fetch($id); /** * Tests if an entry exists in the cache. @@ -60,7 +61,7 @@ interface Cache * * @return boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise. */ - function contains($id); + public function contains($id); /** * Puts data into the cache. @@ -72,7 +73,7 @@ interface Cache * * @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise. */ - function save($id, $data, $lifeTime = 0); + public function save($id, $data, $lifeTime = 0); /** * Deletes a cache entry. @@ -81,7 +82,7 @@ interface Cache * * @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise. */ - function delete($id); + public function delete($id); /** * Retrieves cached information from the data store. @@ -107,5 +108,5 @@ interface Cache * * @return array|null An associative array with server's statistics if available, NULL otherwise. */ - function getStats(); + public function getStats(); } diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php index f896bc70823b..a172a4ceba07 100644 --- a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php @@ -29,7 +29,7 @@ namespace Doctrine\Common\Cache; * @author Roman Borschel * @author Fabio B. Silva */ -abstract class CacheProvider implements Cache +abstract class CacheProvider implements Cache, FlushableCache, ClearableCache, MultiGetCache { const DOCTRINE_NAMESPACE_CACHEKEY = 'DoctrineNamespaceCacheKey[%s]'; @@ -78,6 +78,27 @@ abstract class CacheProvider implements Cache return $this->doFetch($this->getNamespacedId($id)); } + /** + * {@inheritdoc} + */ + public function fetchMultiple(array $keys) + { + // note: the array_combine() is in place to keep an association between our $keys and the $namespacedKeys + $namespacedKeys = array_combine($keys, array_map(array($this, 'getNamespacedId'), $keys)); + $items = $this->doFetchMultiple($namespacedKeys); + $foundItems = array(); + + // no internal array function supports this sort of mapping: needs to be iterative + // this filters and combines keys in one pass + foreach ($namespacedKeys as $requestedKey => $namespacedKey) { + if (isset($items[$namespacedKey])) { + $foundItems[$requestedKey] = $items[$namespacedKey]; + } + } + + return $foundItems; + } + /** * {@inheritdoc} */ @@ -111,9 +132,7 @@ abstract class CacheProvider implements Cache } /** - * Flushes all cache entries. - * - * @return boolean TRUE if the cache entries were successfully flushed, FALSE otherwise. + * {@inheritDoc} */ public function flushAll() { @@ -121,9 +140,7 @@ abstract class CacheProvider implements Cache } /** - * Deletes all cache entries. - * - * @return boolean TRUE if the cache entries were successfully deleted, FALSE otherwise. + * {@inheritDoc} */ public function deleteAll() { @@ -184,12 +201,31 @@ abstract class CacheProvider implements Cache return $this->namespaceVersion; } + /** + * Default implementation of doFetchMultiple. Each driver that supports multi-get should owerwrite it. + * + * @param array $keys Array of keys to retrieve from cache + * @return array Array of values retrieved for the given keys. + */ + protected function doFetchMultiple(array $keys) + { + $returnValues = array(); + + foreach ($keys as $index => $key) { + if (false !== ($item = $this->doFetch($key))) { + $returnValues[$key] = $item; + } + } + + return $returnValues; + } + /** * Fetches an entry from the cache. * * @param string $id The id of the cache entry to fetch. * - * @return string|boolean The cached data or FALSE, if no cache entry exists for the given id. + * @return mixed|boolean The cached data or FALSE, if no cache entry exists for the given id. */ abstract protected function doFetch($id); @@ -226,7 +262,7 @@ abstract class CacheProvider implements Cache /** * Flushes all cache entries. * - * @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise. + * @return boolean TRUE if the cache entries were successfully flushed, FALSE otherwise. */ abstract protected function doFlush(); diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ChainCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ChainCache.php new file mode 100644 index 000000000000..96c9b5479fbe --- /dev/null +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ChainCache.php @@ -0,0 +1,147 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Cache provider that allows to easily chain multiple cache providers + * + * @author Michaël Gallego + */ +class ChainCache extends CacheProvider +{ + /** + * @var CacheProvider[] + */ + private $cacheProviders = array(); + + /** + * Constructor + * + * @param CacheProvider[] $cacheProviders + */ + public function __construct($cacheProviders = array()) + { + $this->cacheProviders = $cacheProviders; + } + + /** + * {@inheritDoc} + */ + public function setNamespace($namespace) + { + parent::setNamespace($namespace); + + foreach ($this->cacheProviders as $cacheProvider) { + $cacheProvider->setNamespace($namespace); + } + } + + /** + * {@inheritDoc} + */ + protected function doFetch($id) + { + foreach ($this->cacheProviders as $key => $cacheProvider) { + if ($cacheProvider->doContains($id)) { + $value = $cacheProvider->doFetch($id); + + // We populate all the previous cache layers (that are assumed to be faster) + for ($subKey = $key - 1 ; $subKey >= 0 ; $subKey--) { + $this->cacheProviders[$subKey]->doSave($id, $value); + } + + return $value; + } + } + + return false; + } + + /** + * {@inheritDoc} + */ + protected function doContains($id) + { + foreach ($this->cacheProviders as $cacheProvider) { + if ($cacheProvider->doContains($id)) { + return true; + } + } + + return false; + } + + /** + * {@inheritDoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + $stored = true; + + foreach ($this->cacheProviders as $cacheProvider) { + $stored = $cacheProvider->doSave($id, $data, $lifeTime) && $stored; + } + + return $stored; + } + + /** + * {@inheritDoc} + */ + protected function doDelete($id) + { + $deleted = true; + + foreach ($this->cacheProviders as $cacheProvider) { + $deleted = $cacheProvider->doDelete($id) && $deleted; + } + + return $deleted; + } + + /** + * {@inheritDoc} + */ + protected function doFlush() + { + $flushed = true; + + foreach ($this->cacheProviders as $cacheProvider) { + $flushed = $cacheProvider->doFlush() && $flushed; + } + + return $flushed; + } + + /** + * {@inheritDoc} + */ + protected function doGetStats() + { + // We return all the stats from all adapters + $stats = array(); + + foreach ($this->cacheProviders as $cacheProvider) { + $stats[] = $cacheProvider->doGetStats(); + } + + return $stats; + } +} diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ClearableCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ClearableCache.php new file mode 100644 index 000000000000..d7b4358debac --- /dev/null +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ClearableCache.php @@ -0,0 +1,40 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Interface for cache that can be flushed. + * + * Intended to be used for partial clearing of a cache namespace. For a more + * global "flushing", see {@see FlushableCache}. + * + * @link www.doctrine-project.org + * @since 1.4 + * @author Adirelle + */ +interface ClearableCache +{ + /** + * Deletes all cache entries in the current cache namespace. + * + * @return boolean TRUE if the cache entries were successfully deleted, FALSE otherwise. + */ + public function deleteAll(); +} diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php index d91d0bc6d6aa..9ad3ce2c0c73 100644 --- a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php @@ -37,21 +37,48 @@ abstract class FileCache extends CacheProvider /** * The cache file extension. * - * @var string|null + * @var string */ - protected $extension; + private $extension; + + /** + * @var string[] regular expressions for replacing disallowed characters in file name + */ + private $disallowedCharacterPatterns = array( + '/\-/', // replaced to disambiguate original `-` and `-` derived from replacements + '/[^a-zA-Z0-9\-_\[\]]/' // also excludes non-ascii chars (not supported, depending on FS) + ); + + /** + * @var string[] replacements for disallowed file characters + */ + private $replacementCharacters = array('__', '-'); + + /** + * @var int + */ + private $umask; /** * Constructor. * - * @param string $directory The cache directory. - * @param string|null $extension The cache file extension. + * @param string $directory The cache directory. + * @param string $extension The cache file extension. * * @throws \InvalidArgumentException */ - public function __construct($directory, $extension = null) + public function __construct($directory, $extension = '', $umask = 0002) { - if ( ! is_dir($directory) && ! @mkdir($directory, 0777, true)) { + // YES, this needs to be *before* createPathIfNeeded() + if ( ! is_int($umask)) { + throw new \InvalidArgumentException(sprintf( + 'The umask parameter is required to be integer, was: %s', + gettype($umask) + )); + } + $this->umask = $umask; + + if ( ! $this->createPathIfNeeded($directory)) { throw new \InvalidArgumentException(sprintf( 'The directory "%s" does not exist and could not be created.', $directory @@ -65,8 +92,9 @@ abstract class FileCache extends CacheProvider )); } + // YES, this needs to be *after* createPathIfNeeded() $this->directory = realpath($directory); - $this->extension = $extension ?: $this->extension; + $this->extension = (string) $extension; } /** @@ -96,12 +124,12 @@ abstract class FileCache extends CacheProvider */ protected function getFilename($id) { - $hash = hash('sha256', $id); - $path = implode(str_split($hash, 16), DIRECTORY_SEPARATOR); - $path = $this->directory . DIRECTORY_SEPARATOR . $path; - $id = preg_replace('@[\\\/:"*?<>|]+@', '', $id); - - return $path . DIRECTORY_SEPARATOR . $id . $this->extension; + return $this->directory + . DIRECTORY_SEPARATOR + . implode(str_split(hash('sha256', $id), 2), DIRECTORY_SEPARATOR) + . DIRECTORY_SEPARATOR + . preg_replace($this->disallowedCharacterPatterns, $this->replacementCharacters, $id) + . $this->extension; } /** @@ -145,14 +173,65 @@ abstract class FileCache extends CacheProvider ); } + /** + * Create path if needed. + * + * @param string $path + * @return bool TRUE on success or if path already exists, FALSE if path cannot be created. + */ + private function createPathIfNeeded($path) + { + if ( ! is_dir($path)) { + if (false === @mkdir($path, 0777 & (~$this->umask), true) && !is_dir($path)) { + return false; + } + } + + return true; + } + + /** + * Writes a string content to file in an atomic way. + * + * @param string $filename Path to the file where to write the data. + * @param string $content The content to write + * + * @return bool TRUE on success, FALSE if path cannot be created, if path is not writable or an any other error. + */ + protected function writeFile($filename, $content) + { + $filepath = pathinfo($filename, PATHINFO_DIRNAME); + + if ( ! $this->createPathIfNeeded($filepath)) { + return false; + } + + if ( ! is_writable($filepath)) { + return false; + } + + $tmpFile = tempnam($filepath, 'swap'); + @chmod($tmpFile, 0666 & (~$this->umask)); + + if (file_put_contents($tmpFile, $content) !== false) { + if (@rename($tmpFile, $filename)) { + return true; + } + + @unlink($tmpFile); + } + + return false; + } + /** * @return \Iterator */ private function getIterator() { - $pattern = '/^.+\\' . $this->extension . '$/i'; - $iterator = new \RecursiveDirectoryIterator($this->directory); - $iterator = new \RecursiveIteratorIterator($iterator); - return new \RegexIterator($iterator, $pattern); + return new \RegexIterator( + new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->directory)), + '/^.+' . preg_quote($this->extension, '/') . '$/i' + ); } } diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php index 07eda8e87423..29d5e07460c6 100644 --- a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php @@ -32,7 +32,10 @@ class FilesystemCache extends FileCache /** * {@inheritdoc} */ - protected $extension = self::EXTENSION; + public function __construct($directory, $extension = self::EXTENSION, $umask = 0002) + { + parent::__construct($directory, $extension, $umask); + } /** * {@inheritdoc} @@ -100,26 +103,9 @@ class FilesystemCache extends FileCache $lifeTime = time() + $lifeTime; } - $data = serialize($data); - $filename = $this->getFilename($id); - $filepath = pathinfo($filename, PATHINFO_DIRNAME); + $data = serialize($data); + $filename = $this->getFilename($id); - if ( ! is_dir($filepath)) { - if (false === @mkdir($filepath, 0777, true) && !is_dir($filepath)) { - return false; - } - } elseif ( ! is_writable($filepath)) { - return false; - } - - $tmpFile = tempnam($filepath, basename($filename)); - - if ((file_put_contents($tmpFile, $lifeTime . PHP_EOL . $data) !== false) && @rename($tmpFile, $filename)) { - @chmod($filename, 0666 & ~umask()); - - return true; - } - - return false; + return $this->writeFile($filename, $lifeTime . PHP_EOL . $data); } } diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FlushableCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FlushableCache.php new file mode 100644 index 000000000000..e4e606b17281 --- /dev/null +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FlushableCache.php @@ -0,0 +1,37 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Interface for cache that can be flushed. + * + * @link www.doctrine-project.org + * @since 1.4 + * @author Adirelle + */ +interface FlushableCache +{ + /** + * Flushes all cache entries, globally. + * + * @return boolean TRUE if the cache entries were successfully flushed, FALSE otherwise. + */ + public function flushAll(); +} diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcacheCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcacheCache.php index f839a6591832..c5098fd97b86 100644 --- a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcacheCache.php +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcacheCache.php @@ -74,7 +74,11 @@ class MemcacheCache extends CacheProvider */ protected function doContains($id) { - return (bool) $this->memcache->get($id); + $flags = null; + $this->memcache->get($id, $flags); + + //if memcache has changed the value of "flags", it means the value exists + return ($flags !== null); } /** diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php index f7e5500a1c94..040c26c02c7d 100644 --- a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php @@ -69,6 +69,14 @@ class MemcachedCache extends CacheProvider return $this->memcached->get($id); } + /** + * {@inheritdoc} + */ + protected function doFetchMultiple(array $keys) + { + return $this->memcached->getMulti($keys); + } + /** * {@inheritdoc} */ diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiGetCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiGetCache.php new file mode 100644 index 000000000000..df7146d78efd --- /dev/null +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiGetCache.php @@ -0,0 +1,39 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Interface for cache drivers that allows to get many items at once. + * + * @link www.doctrine-project.org + * @since 1.4 + * @author Asmir Mustafic + */ +interface MultiGetCache +{ + /** + * Returns an associative array of values for keys is found in cache. + * + * @param string[] $keys Array of keys to retrieve from cache + * @return mixed[] Array of retrieved values, indexed by the specified keys. + * Values that couldn't be retrieved are not contained in this array. + */ + function fetchMultiple(array $keys); +} diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php index f017d833268c..5e7519674e3e 100644 --- a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php @@ -29,24 +29,25 @@ class PhpFileCache extends FileCache { const EXTENSION = '.doctrinecache.php'; - /** + /** * {@inheritdoc} */ - protected $extension = self::EXTENSION; + public function __construct($directory, $extension = self::EXTENSION, $umask = 0002) + { + parent::__construct($directory, $extension, $umask); + } /** * {@inheritdoc} */ protected function doFetch($id) { - $filename = $this->getFilename($id); + $value = $this->includeFileForId($id); - if ( ! is_file($filename)) { + if (! $value) { return false; } - $value = include $filename; - if ($value['lifetime'] !== 0 && $value['lifetime'] < time()) { return false; } @@ -59,14 +60,12 @@ class PhpFileCache extends FileCache */ protected function doContains($id) { - $filename = $this->getFilename($id); + $value = $this->includeFileForId($id); - if ( ! is_file($filename)) { + if (! $value) { return false; } - $value = include $filename; - return $value['lifetime'] === 0 || $value['lifetime'] > time(); } @@ -87,12 +86,7 @@ class PhpFileCache extends FileCache ); } - $filename = $this->getFilename($id); - $filepath = pathinfo($filename, PATHINFO_DIRNAME); - - if ( ! is_dir($filepath)) { - mkdir($filepath, 0777, true); - } + $filename = $this->getFilename($id); $value = array( 'lifetime' => $lifeTime, @@ -102,6 +96,25 @@ class PhpFileCache extends FileCache $value = var_export($value, true); $code = sprintf('writeFile($filename, $code); + } + + /** + * @param string $id + * + * @return array|false + */ + private function includeFileForId($id) + { + $fileName = $this->getFilename($id); + + // note: error suppression is still faster than `file_exists`, `is_file` and `is_readable` + $value = @include $fileName; + + if (! isset($value['lifetime'])) { + return false; + } + + return $value; } } diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PredisCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PredisCache.php new file mode 100644 index 000000000000..823477e6c401 --- /dev/null +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PredisCache.php @@ -0,0 +1,107 @@ + + */ +class PredisCache extends CacheProvider +{ + /** + * @var Client + */ + private $client; + + /** + * @param Client $client + * + * @return void + */ + public function __construct(Client $client) + { + $this->client = $client; + } + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + $result = $this->client->get($id); + if (null === $result) { + return false; + } + + return unserialize($result); + } + + /** + * {@inheritdoc} + */ + protected function doFetchMultiple(array $keys) + { + $fetchedItems = call_user_func_array(array($this->client, 'mget'), $keys); + + return array_filter(array_combine($keys, array_map('unserialize', $fetchedItems))); + } + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + return $this->client->exists($id); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + $data = serialize($data); + if ($lifeTime > 0) { + $response = $this->client->setex($id, $lifeTime, $data); + } else { + $response = $this->client->set($id, $data); + } + + return $response === true || $response == 'OK'; + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + return $this->client->del($id) > 0; + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + $response = $this->client->flushdb(); + + return $response === true || $response == 'OK'; + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + $info = $this->client->info(); + + return array( + Cache::STATS_HITS => $info['Stats']['keyspace_hits'], + Cache::STATS_MISSES => $info['Stats']['keyspace_misses'], + Cache::STATS_UPTIME => $info['Server']['uptime_in_seconds'], + Cache::STATS_MEMORY_USAGE => $info['Memory']['used_memory'], + Cache::STATS_MEMORY_AVAILABLE => false + ); + } +} diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php index 8d00a3b9562e..50d7c917e07b 100644 --- a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php @@ -66,6 +66,14 @@ class RedisCache extends CacheProvider return $this->redis->get($id); } + /** + * {@inheritdoc} + */ + protected function doFetchMultiple(array $keys) + { + return array_filter(array_combine($keys, $this->redis->mget($keys))); + } + /** * {@inheritdoc} */ @@ -109,8 +117,8 @@ class RedisCache extends CacheProvider { $info = $this->redis->info(); return array( - Cache::STATS_HITS => false, - Cache::STATS_MISSES => false, + Cache::STATS_HITS => $info['keyspace_hits'], + Cache::STATS_MISSES => $info['keyspace_misses'], Cache::STATS_UPTIME => $info['uptime_in_seconds'], Cache::STATS_MEMORY_USAGE => $info['used_memory'], Cache::STATS_MEMORY_AVAILABLE => false @@ -126,6 +134,9 @@ class RedisCache extends CacheProvider */ protected function getSerializerValue() { + if (defined('HHVM_VERSION')) { + return Redis::SERIALIZER_PHP; + } return defined('Redis::SERIALIZER_IGBINARY') ? Redis::SERIALIZER_IGBINARY : Redis::SERIALIZER_PHP; } } diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/SQLite3Cache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/SQLite3Cache.php new file mode 100644 index 000000000000..b12978c49a1c --- /dev/null +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/SQLite3Cache.php @@ -0,0 +1,219 @@ +. + */ + +namespace Doctrine\Common\Cache; + +use SQLite3; +use SQLite3Result; + +/** + * SQLite3 cache provider. + * + * @since 1.4 + * @author Jake Bell + */ +class SQLite3Cache extends CacheProvider +{ + /** + * The ID field will store the cache key. + */ + const ID_FIELD = 'k'; + + /** + * The data field will store the serialized PHP value. + */ + const DATA_FIELD = 'd'; + + /** + * The expiration field will store a date value indicating when the + * cache entry should expire. + */ + const EXPIRATION_FIELD = 'e'; + + /** + * @var SQLite3 + */ + private $sqlite; + + /** + * @var string + */ + private $table; + + /** + * Constructor. + * + * Calling the constructor will ensure that the database file and table + * exist and will create both if they don't. + * + * @param SQLite3 $sqlite + * @param string $table + */ + public function __construct(SQLite3 $sqlite, $table) + { + $this->sqlite = $sqlite; + $this->table = (string) $table; + + list($id, $data, $exp) = $this->getFields(); + + return $this->sqlite->exec(sprintf( + 'CREATE TABLE IF NOT EXISTS %s(%s TEXT PRIMARY KEY NOT NULL, %s BLOB, %s INTEGER)', + $table, + $id, + $data, + $exp + )); + } + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + if ($item = $this->findById($id)) { + return unserialize($item[self::DATA_FIELD]); + } + + return false; + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + return (boolean) $this->findById($id, false); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + $statement = $this->sqlite->prepare(sprintf( + 'INSERT OR REPLACE INTO %s (%s) VALUES (:id, :data, :expire)', + $this->table, + implode(',', $this->getFields()) + )); + + $statement->bindValue(':id', $id); + $statement->bindValue(':data', serialize($data), SQLITE3_BLOB); + $statement->bindValue(':expire', $lifeTime > 0 ? time() + $lifeTime : null); + + return $statement->execute() instanceof SQLite3Result; + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + list($idField) = $this->getFields(); + + $statement = $this->sqlite->prepare(sprintf( + 'DELETE FROM %s WHERE %s = :id', + $this->table, + $idField + )); + + $statement->bindValue(':id', $id); + + return $statement->execute() instanceof SQLite3Result; + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + return $this->sqlite->exec(sprintf('DELETE FROM %s', $this->table)); + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + // no-op. + } + + /** + * Find a single row by ID. + * + * @param mixed $id + * @param boolean $includeData + * + * @return array|null + */ + private function findById($id, $includeData = true) + { + list($idField) = $fields = $this->getFields(); + + if (!$includeData) { + $key = array_search(static::DATA_FIELD, $fields); + unset($fields[$key]); + } + + $statement = $this->sqlite->prepare(sprintf( + 'SELECT %s FROM %s WHERE %s = :id LIMIT 1', + implode(',', $fields), + $this->table, + $idField + )); + + $statement->bindValue(':id', $id, SQLITE3_TEXT); + + $item = $statement->execute()->fetchArray(SQLITE3_ASSOC); + + if ($item === false) { + return null; + } + + if ($this->isExpired($item)) { + $this->doDelete($id); + + return null; + } + + return $item; + } + + /** + * Gets an array of the fields in our table. + * + * @return array + */ + private function getFields() + { + return array(static::ID_FIELD, static::DATA_FIELD, static::EXPIRATION_FIELD); + } + + /** + * Check if the item is expired. + * + * @param array $item + * @return boolean + */ + private function isExpired(array $item) + { + return isset($item[static::EXPIRATION_FIELD]) && + $item[self::EXPIRATION_FIELD] !== null && + $item[self::EXPIRATION_FIELD] < time(); + } +} diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/VoidCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/VoidCache.php new file mode 100644 index 000000000000..65e8456faad0 --- /dev/null +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/VoidCache.php @@ -0,0 +1,78 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Void cache driver. The cache could be of use in tests where you don`t need to cache anything. + * + * @link www.doctrine-project.org + * @since 1.5 + * @author Kotlyar Maksim + */ +class VoidCache extends CacheProvider +{ + /** + * {@inheritDoc} + */ + protected function doFetch($id) + { + return false; + } + + /** + * {@inheritDoc} + */ + protected function doContains($id) + { + return false; + } + + /** + * {@inheritDoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + return true; + } + + /** + * {@inheritDoc} + */ + protected function doDelete($id) + { + return true; + } + + /** + * {@inheritDoc} + */ + protected function doFlush() + { + return true; + } + + /** + * {@inheritDoc} + */ + protected function doGetStats() + { + return; + } +} diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/XcacheCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/XcacheCache.php index 833b02a89bfe..a2c4ca5662e2 100644 --- a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/XcacheCache.php +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/XcacheCache.php @@ -71,7 +71,7 @@ class XcacheCache extends CacheProvider { $this->checkAuthorization(); - xcache_clear_cache(XC_TYPE_VAR, 0); + xcache_clear_cache(XC_TYPE_VAR); return true; } @@ -86,7 +86,10 @@ class XcacheCache extends CacheProvider protected function checkAuthorization() { if (ini_get('xcache.admin.enable_auth')) { - throw new \BadMethodCallException('To use all features of \Doctrine\Common\Cache\XcacheCache, you must set "xcache.admin.enable_auth" to "Off" in your php.ini.'); + throw new \BadMethodCallException( + 'To use all features of \Doctrine\Common\Cache\XcacheCache, ' + . 'you must set "xcache.admin.enable_auth" to "Off" in your php.ini.' + ); } } diff --git a/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php index 59ca4dc77579..3c7f619b6475 100644 --- a/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php +++ b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php @@ -29,6 +29,59 @@ abstract class CacheTest extends \Doctrine\Tests\DoctrineTestCase $this->assertFalse($cache->contains('key')); } + public function testFetchMulti() + { + $cache = $this->_getCacheDriver(); + + $cache->deleteAll(); + + // Test saving some values, checking if it exists, and fetching it back with multiGet + $this->assertTrue($cache->save('key1', 'value1')); + $this->assertTrue($cache->save('key2', 'value2')); + + $this->assertEquals( + array('key1' => 'value1', 'key2' => 'value2'), + $cache->fetchMultiple(array('key1', 'key2')) + ); + $this->assertEquals( + array('key1' => 'value1', 'key2' => 'value2'), + $cache->fetchMultiple(array('key1', 'key3', 'key2')) + ); + $this->assertEquals( + array('key1' => 'value1', 'key2' => 'value2'), + $cache->fetchMultiple(array('key1', 'key2', 'key3')) + ); + } + + public function testFetchMultiWillFilterNonRequestedKeys() + { + /* @var $cache \Doctrine\Common\Cache\CacheProvider|\PHPUnit_Framework_MockObject_MockObject */ + $cache = $this->getMockForAbstractClass( + 'Doctrine\Common\Cache\CacheProvider', + array(), + '', + true, + true, + true, + array('doFetchMultiple') + ); + + $cache + ->expects($this->once()) + ->method('doFetchMultiple') + ->will($this->returnValue(array( + '[foo][]' => 'bar', + '[bar][]' => 'baz', + '[baz][]' => 'tab', + ))); + + $this->assertEquals( + array('foo' => 'bar', 'bar' => 'baz'), + $cache->fetchMultiple(array('foo', 'bar')) + ); + } + + public function provideCrudValues() { return array( @@ -223,6 +276,84 @@ abstract class CacheTest extends \Doctrine\Tests\DoctrineTestCase $this->assertNotNull($result); } + /** + * Check to see that, even if the user saves a value that can be interpreted as false, + * the cache adapter will still recognize its existence there. + * + * @dataProvider falseCastedValuesProvider + */ + public function testFalseCastedValues($value) + { + $cache = $this->_getCacheDriver(); + + $this->assertTrue($cache->save('key', $value)); + $this->assertTrue($cache->contains('key')); + $this->assertEquals($value, $cache->fetch('key')); + } + + /** + * The following values get converted to FALSE if you cast them to a boolean. + * @see http://php.net/manual/en/types.comparisons.php + */ + public function falseCastedValuesProvider() + { + return array( + array(false), + array(null), + array(array()), + array('0'), + array(0), + array(0.0), + array('') + ); + } + + /** + * Check to see that objects are correctly serialized and unserialized by the cache + * provider. + */ + public function testCachedObject() + { + $cache = $this->_getCacheDriver(); + $cache->deleteAll(); + $obj = new \stdClass(); + $obj->foo = "bar"; + $obj2 = new \stdClass(); + $obj2->bar = "foo"; + $obj2->obj = $obj; + $obj->obj2 = $obj2; + $cache->save("obj", $obj); + + $fetched = $cache->fetch("obj"); + + $this->assertInstanceOf("stdClass", $obj); + $this->assertInstanceOf("stdClass", $obj->obj2); + $this->assertInstanceOf("stdClass", $obj->obj2->obj); + $this->assertEquals("bar", $fetched->foo); + $this->assertEquals("foo", $fetched->obj2->bar); + } + + /** + * Check to see that objects fetched via fetchMultiple are properly unserialized + */ + public function testFetchMultipleObjects() + { + $cache = $this->_getCacheDriver(); + $cache->deleteAll(); + $obj1 = new \stdClass(); + $obj1->foo = "bar"; + $cache->save("obj1", $obj1); + $obj2 = new \stdClass(); + $obj2->bar = "baz"; + $cache->save("obj2", $obj2); + + $fetched = $cache->fetchMultiple(array("obj1", "obj2")); + $this->assertInstanceOf("stdClass", $fetched["obj1"]); + $this->assertInstanceOf("stdClass", $fetched["obj2"]); + $this->assertEquals("bar", $fetched["obj1"]->foo); + $this->assertEquals("baz", $fetched["obj2"]->bar); + } + /** * Return whether multiple cache providers share the same storage. * diff --git a/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ChainCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ChainCacheTest.php new file mode 100644 index 000000000000..46d78c129d99 --- /dev/null +++ b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ChainCacheTest.php @@ -0,0 +1,94 @@ +_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertInternalType('array', $stats); + } + + public function testOnlyFetchFirstOne() + { + $cache1 = new ArrayCache(); + $cache2 = $this->getMockForAbstractClass('Doctrine\Common\Cache\CacheProvider'); + + $cache2->expects($this->never())->method('doFetch'); + + $chainCache = new ChainCache(array($cache1, $cache2)); + $chainCache->save('id', 'bar'); + + $this->assertEquals('bar', $chainCache->fetch('id')); + } + + public function testFetchPropagateToFastestCache() + { + $cache1 = new ArrayCache(); + $cache2 = new ArrayCache(); + + $cache2->save('bar', 'value'); + + $chainCache = new ChainCache(array($cache1, $cache2)); + + $this->assertFalse($cache1->contains('bar')); + + $result = $chainCache->fetch('bar'); + + $this->assertEquals('value', $result); + $this->assertTrue($cache2->contains('bar')); + } + + public function testNamespaceIsPropagatedToAllProviders() + { + $cache1 = new ArrayCache(); + $cache2 = new ArrayCache(); + + $chainCache = new ChainCache(array($cache1, $cache2)); + $chainCache->setNamespace('bar'); + + $this->assertEquals('bar', $cache1->getNamespace()); + $this->assertEquals('bar', $cache2->getNamespace()); + } + + public function testDeleteToAllProviders() + { + $cache1 = $this->getMockForAbstractClass('Doctrine\Common\Cache\CacheProvider'); + $cache2 = $this->getMockForAbstractClass('Doctrine\Common\Cache\CacheProvider'); + + $cache1->expects($this->once())->method('doDelete'); + $cache2->expects($this->once())->method('doDelete'); + + $chainCache = new ChainCache(array($cache1, $cache2)); + $chainCache->delete('bar'); + } + + public function testFlushToAllProviders() + { + $cache1 = $this->getMockForAbstractClass('Doctrine\Common\Cache\CacheProvider'); + $cache2 = $this->getMockForAbstractClass('Doctrine\Common\Cache\CacheProvider'); + + $cache1->expects($this->once())->method('doFlush'); + $cache2->expects($this->once())->method('doFlush'); + + $chainCache = new ChainCache(array($cache1, $cache2)); + $chainCache->flushAll(); + } + + protected function isSharedStorage() + { + return false; + } +} \ No newline at end of file diff --git a/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FileCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FileCacheTest.php index 6f9df8158e43..886832141964 100644 --- a/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FileCacheTest.php +++ b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FileCacheTest.php @@ -2,6 +2,8 @@ namespace Doctrine\Tests\Common\Cache; +use Doctrine\Common\Cache\Cache; + /** * @group DCOM-101 */ @@ -25,16 +27,19 @@ class FileCacheTest extends \Doctrine\Tests\DoctrineTestCase { return array( //The characters :\/<>"*?| are not valid in Windows filenames. - array('key:1', 'key1'), - array('key\2', 'key2'), - array('key/3', 'key3'), - array('key<4', 'key4'), - array('key>5', 'key5'), - array('key"6', 'key6'), - array('key*7', 'key7'), - array('key?8', 'key8'), - array('key|9', 'key9'), - array('key[0]','key[0]'), + array('key:1', 'key-1'), + array('key\2', 'key-2'), + array('key/3', 'key-3'), + array('key<4', 'key-4'), + array('key>5', 'key-5'), + array('key"6', 'key-6'), + array('key*7', 'key-7'), + array('key?8', 'key-8'), + array('key|9', 'key-9'), + array('key[10]', 'key[10]'), + array('keyä11', 'key--11'), + array('../key12', '---key12'), + array('key-13', 'key__13'), ); } @@ -56,15 +61,19 @@ class FileCacheTest extends \Doctrine\Tests\DoctrineTestCase public function testFilenameCollision() { - $data['key:0'] = 'key0'; - $data['key\0'] = 'key0'; - $data['key/0'] = 'key0'; - $data['key<0'] = 'key0'; - $data['key>0'] = 'key0'; - $data['key"0'] = 'key0'; - $data['key*0'] = 'key0'; - $data['key?0'] = 'key0'; - $data['key|0'] = 'key0'; + $data = array( + 'key:0' => 'key-0', + 'key\0' => 'key-0', + 'key/0' => 'key-0', + 'key<0' => 'key-0', + 'key>0' => 'key-0', + 'key"0' => 'key-0', + 'key*0' => 'key-0', + 'key?0' => 'key-0', + 'key|0' => 'key-0', + 'key-0' => 'key__0', + 'keyä0' => 'key--0', + ); $paths = array(); $cache = $this->driver; @@ -88,10 +97,11 @@ class FileCacheTest extends \Doctrine\Tests\DoctrineTestCase $cache = $this->driver; $method = new \ReflectionMethod($cache, 'getFilename'); $key = 'item-key'; - $expectedDir[] = '84e0e2e893febb73'; - $expectedDir[] = '7a0fee0c89d53f4b'; - $expectedDir[] = 'b7fcb44c57cdf3d3'; - $expectedDir[] = '2ce7363f5d597760'; + $expectedDir = array( + '84', 'e0', 'e2', 'e8', '93', 'fe', 'bb', '73', '7a', '0f', 'ee', + '0c', '89', 'd5', '3f', '4b', 'b7', 'fc', 'b4', '4c', '57', 'cd', + 'f3', 'd3', '2c', 'e7', '36', '3f', '5d', '59', '77', '60' + ); $expectedDir = implode(DIRECTORY_SEPARATOR, $expectedDir); $method->setAccessible(true); @@ -100,8 +110,52 @@ class FileCacheTest extends \Doctrine\Tests\DoctrineTestCase $filename = pathinfo($path, PATHINFO_FILENAME); $dirname = pathinfo($path, PATHINFO_DIRNAME); - $this->assertEquals('item-key', $filename); + $this->assertEquals('item__key', $filename); $this->assertEquals(DIRECTORY_SEPARATOR . $expectedDir, $dirname); - $this->assertEquals(DIRECTORY_SEPARATOR . $expectedDir . DIRECTORY_SEPARATOR . $key, $path); + $this->assertEquals(DIRECTORY_SEPARATOR . $expectedDir . DIRECTORY_SEPARATOR . 'item__key', $path); } -} \ No newline at end of file + + public function testFileExtensionCorrectlyEscaped() + { + $driver1 = $this->getMock( + 'Doctrine\Common\Cache\FileCache', + array('doFetch', 'doContains', 'doSave'), + array(__DIR__, '.*') + ); + $driver2 = $this->getMock( + 'Doctrine\Common\Cache\FileCache', + array('doFetch', 'doContains', 'doSave'), + array(__DIR__, '.php') + ); + + $doGetStats = new \ReflectionMethod($driver1, 'doGetStats'); + + $doGetStats->setAccessible(true); + + $stats1 = $doGetStats->invoke($driver1); + $stats2 = $doGetStats->invoke($driver2); + + $this->assertSame(0, $stats1[Cache::STATS_MEMORY_USAGE]); + $this->assertGreaterThan(0, $stats2[Cache::STATS_MEMORY_USAGE]); + } + + /** + * @group DCOM-266 + */ + public function testFileExtensionSlashCorrectlyEscaped() + { + $driver = $this->getMock( + 'Doctrine\Common\Cache\FileCache', + array('doFetch', 'doContains', 'doSave'), + array(__DIR__ . '/../', '/' . basename(__FILE__)) + ); + + $doGetStats = new \ReflectionMethod($driver, 'doGetStats'); + + $doGetStats->setAccessible(true); + + $stats = $doGetStats->invoke($driver); + + $this->assertGreaterThan(0, $stats[Cache::STATS_MEMORY_USAGE]); + } +} diff --git a/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php index 071329fbcf80..2028acc2568f 100644 --- a/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php +++ b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php @@ -53,4 +53,18 @@ class MemcachedCacheTest extends CacheTest $driver->setMemcached($this->memcached); return $driver; } + + /** + * {@inheritDoc} + * + * @dataProvider falseCastedValuesProvider + */ + public function testFalseCastedValues($value) + { + if (false === $value) { + $this->markTestIncomplete('Memcached currently doesn\'t support saving `false` values. '); + } + + parent::testFalseCastedValues($value); + } } diff --git a/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php index f49ce25e4e30..f83a6e4d376a 100644 --- a/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php +++ b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php @@ -85,6 +85,16 @@ class PhpFileCacheTest extends BaseFileCacheTest $this->assertGreaterThan(0, $stats[Cache::STATS_MEMORY_AVAILABLE]); } + public function testCachedObject() + { + $this->markTestSkipped("PhpFileCache cannot handle objects that don't implement __set_state."); + } + + public function testFetchMultipleObjects() + { + $this->markTestSkipped("PhpFileCache cannot handle objects that don't implement __set_state."); + } + protected function _getCacheDriver() { return new PhpFileCache($this->directory); diff --git a/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PredisCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PredisCacheTest.php new file mode 100644 index 000000000000..fecc92b4a1d5 --- /dev/null +++ b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PredisCacheTest.php @@ -0,0 +1,62 @@ +markTestSkipped('Predis\Client is missing. Make sure to "composer install" to have all dev dependencies.'); + } + + $this->client = new Client(); + + try { + $this->client->connect(); + } catch (ConnectionException $e) { + $this->markTestSkipped('The ' . __CLASS__ .' requires the use of redis'); + } + } + + public function testHitMissesStatsAreProvided() + { + $cache = $this->_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertNotNull($stats[Cache::STATS_HITS]); + $this->assertNotNull($stats[Cache::STATS_MISSES]); + } + + /** + * @return PredisCache + */ + protected function _getCacheDriver() + { + return new PredisCache($this->client); + } + + /** + * {@inheritDoc} + * + * @dataProvider falseCastedValuesProvider + */ + public function testFalseCastedValues($value) + { + if (array() === $value) { + $this->markTestIncomplete( + 'Predis currently doesn\'t support saving empty array values. ' + . 'See https://github.com/nrk/predis/issues/241' + ); + } + + parent::testFalseCastedValues($value); + } +} diff --git a/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php index 45bbc752af25..35d9f5ed16f2 100644 --- a/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php +++ b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php @@ -3,6 +3,7 @@ namespace Doctrine\Tests\Common\Cache; use Doctrine\Common\Cache\RedisCache; +use Doctrine\Common\Cache\Cache; class RedisCacheTest extends CacheTest { @@ -21,6 +22,15 @@ class RedisCacheTest extends CacheTest } } + public function testHitMissesStatsAreProvided() + { + $cache = $this->_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertNotNull($stats[Cache::STATS_HITS]); + $this->assertNotNull($stats[Cache::STATS_MISSES]); + } + protected function _getCacheDriver() { $driver = new RedisCache(); diff --git a/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/SQLite3CacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/SQLite3CacheTest.php new file mode 100644 index 000000000000..44ccce9275d5 --- /dev/null +++ b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/SQLite3CacheTest.php @@ -0,0 +1,48 @@ +file = tempnam(null, 'doctrine-cache-test-'); + unlink($this->file); + $this->sqlite = new SQLite3($this->file); + } + + protected function tearDown() + { + $this->sqlite = null; // DB must be closed before + unlink($this->file); + } + + public function testGetStats() + { + $this->assertNull($this->_getCacheDriver()->getStats()); + } + + public function testFetchSingle() + { + $id = uniqid('sqlite3_id_'); + $data = "\0"; // produces null bytes in serialized format + + $this->_getCacheDriver()->save($id, $data, 30); + + $this->assertEquals($data, $this->_getCacheDriver()->fetch($id)); + } + + protected function _getCacheDriver() + { + return new SQLite3Cache($this->sqlite, 'test_table'); + } +} diff --git a/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/VoidCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/VoidCacheTest.php new file mode 100644 index 000000000000..ca87f166172c --- /dev/null +++ b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/VoidCacheTest.php @@ -0,0 +1,51 @@ +assertFalse($cache->contains('foo')); + $this->assertFalse($cache->contains('bar')); + } + + public function testShouldAlwaysReturnFalseOnFetch() + { + $cache = new VoidCache(); + + $this->assertFalse($cache->fetch('foo')); + $this->assertFalse($cache->fetch('bar')); + } + + public function testShouldAlwaysReturnTrueOnSaveButNotStoreAnything() + { + $cache = new VoidCache(); + + $this->assertTrue($cache->save('foo', 'fooVal')); + + $this->assertFalse($cache->contains('foo')); + $this->assertFalse($cache->fetch('foo')); + } + + public function testShouldAlwaysReturnTrueOnDelete() + { + $cache = new VoidCache(); + + $this->assertTrue($cache->delete('foo')); + } + + public function testShouldAlwaysReturnNullOnGetStatus() + { + $cache = new VoidCache(); + + $this->assertNull($cache->getStats()); + } +} diff --git a/core/vendor/doctrine/cache/tests/travis/php.ini b/core/vendor/doctrine/cache/tests/travis/php.ini index ef5d9a1b7b58..105af36da06e 100644 --- a/core/vendor/doctrine/cache/tests/travis/php.ini +++ b/core/vendor/doctrine/cache/tests/travis/php.ini @@ -1,6 +1,7 @@ extension="mongo.so" extension="memcache.so" extension="memcached.so" +extension="redis.so" apc.enabled=1 apc.enable_cli=1 diff --git a/core/vendor/doctrine/collections/.travis.yml b/core/vendor/doctrine/collections/.travis.yml index 470c9879a1d7..60f479277d08 100644 --- a/core/vendor/doctrine/collections/.travis.yml +++ b/core/vendor/doctrine/collections/.travis.yml @@ -4,7 +4,18 @@ php: - 5.3 - 5.4 - 5.5 + - 5.6 + - 7.0 - hhvm + - hhvm-nightly + +matrix: + fast_finish: true + allow_failures: + - php: 7.0 before_script: - - composer --prefer-source --dev install + - composer --prefer-source install + +script: + - phpunit diff --git a/core/vendor/doctrine/collections/README.md b/core/vendor/doctrine/collections/README.md index 627d45bbb29c..161cab63c73a 100644 --- a/core/vendor/doctrine/collections/README.md +++ b/core/vendor/doctrine/collections/README.md @@ -1,14 +1,22 @@ # Doctrine Collections +[![Build Status](https://travis-ci.org/doctrine/collections.svg?branch=master)](https://travis-ci.org/doctrine/collections) + Collections Abstraction library ## Changelog -### v1.2 +### v1.3.0 + +* [Explicit casting of first and max results in criteria API](https://github.com/doctrine/collections/pull/26) +* [Keep keys when using `ArrayCollection#matching()` with sorting](https://github.com/doctrine/collections/pull/49) +* [Made `AbstractLazyCollection#$initialized` protected for extensibility](https://github.com/doctrine/collections/pull/52) + +### v1.2.0 * Add a new ``AbstractLazyCollection`` -### v1.1 +### v1.1.0 * Deprecated ``Comparison::IS``, because it's only there for SQL semantics. These are fixed in the ORM instead. diff --git a/core/vendor/doctrine/collections/composer.json b/core/vendor/doctrine/collections/composer.json index dd30961c82de..155cac48f97a 100644 --- a/core/vendor/doctrine/collections/composer.json +++ b/core/vendor/doctrine/collections/composer.json @@ -15,6 +15,9 @@ "require": { "php": ">=5.3.2" }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, "autoload": { "psr-0": { "Doctrine\\Common\\Collections\\": "lib/" } }, diff --git a/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/AbstractLazyCollection.php b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/AbstractLazyCollection.php index 0052a29c7c95..b907f8b02a00 100644 --- a/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/AbstractLazyCollection.php +++ b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/AbstractLazyCollection.php @@ -37,9 +37,9 @@ abstract class AbstractLazyCollection implements Collection protected $collection; /** - * @var bool + * @var boolean */ - private $initialized = false; + protected $initialized = false; /** * {@inheritDoc} @@ -328,7 +328,7 @@ abstract class AbstractLazyCollection implements Collection */ protected function initialize() { - if (!$this->initialized) { + if ( ! $this->initialized) { $this->doInitialize(); $this->initialized = true; } diff --git a/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ArrayCollection.php b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ArrayCollection.php index 9c2c8e147481..bce575120ea7 100644 --- a/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ArrayCollection.php +++ b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ArrayCollection.php @@ -19,7 +19,8 @@ namespace Doctrine\Common\Collections; -use Closure, ArrayIterator; +use ArrayIterator; +use Closure; use Doctrine\Common\Collections\Expr\ClosureExpressionVisitor; /** @@ -37,7 +38,7 @@ class ArrayCollection implements Collection, Selectable * * @var array */ - private $_elements; + private $elements; /** * Initializes a new ArrayCollection. @@ -46,7 +47,7 @@ class ArrayCollection implements Collection, Selectable */ public function __construct(array $elements = array()) { - $this->_elements = $elements; + $this->elements = $elements; } /** @@ -54,7 +55,7 @@ class ArrayCollection implements Collection, Selectable */ public function toArray() { - return $this->_elements; + return $this->elements; } /** @@ -62,7 +63,7 @@ class ArrayCollection implements Collection, Selectable */ public function first() { - return reset($this->_elements); + return reset($this->elements); } /** @@ -70,7 +71,7 @@ class ArrayCollection implements Collection, Selectable */ public function last() { - return end($this->_elements); + return end($this->elements); } /** @@ -78,7 +79,7 @@ class ArrayCollection implements Collection, Selectable */ public function key() { - return key($this->_elements); + return key($this->elements); } /** @@ -86,7 +87,7 @@ class ArrayCollection implements Collection, Selectable */ public function next() { - return next($this->_elements); + return next($this->elements); } /** @@ -94,7 +95,7 @@ class ArrayCollection implements Collection, Selectable */ public function current() { - return current($this->_elements); + return current($this->elements); } /** @@ -102,14 +103,14 @@ class ArrayCollection implements Collection, Selectable */ public function remove($key) { - if (isset($this->_elements[$key]) || array_key_exists($key, $this->_elements)) { - $removed = $this->_elements[$key]; - unset($this->_elements[$key]); - - return $removed; + if ( ! isset($this->elements[$key]) && ! array_key_exists($key, $this->elements)) { + return null; } - return null; + $removed = $this->elements[$key]; + unset($this->elements[$key]); + + return $removed; } /** @@ -117,15 +118,15 @@ class ArrayCollection implements Collection, Selectable */ public function removeElement($element) { - $key = array_search($element, $this->_elements, true); + $key = array_search($element, $this->elements, true); - if ($key !== false) { - unset($this->_elements[$key]); - - return true; + if ($key === false) { + return false; } - return false; + unset($this->elements[$key]); + + return true; } /** @@ -158,7 +159,8 @@ class ArrayCollection implements Collection, Selectable if ( ! isset($offset)) { return $this->add($value); } - return $this->set($offset, $value); + + $this->set($offset, $value); } /** @@ -176,7 +178,7 @@ class ArrayCollection implements Collection, Selectable */ public function containsKey($key) { - return isset($this->_elements[$key]) || array_key_exists($key, $this->_elements); + return isset($this->elements[$key]) || array_key_exists($key, $this->elements); } /** @@ -184,7 +186,7 @@ class ArrayCollection implements Collection, Selectable */ public function contains($element) { - return in_array($element, $this->_elements, true); + return in_array($element, $this->elements, true); } /** @@ -192,11 +194,12 @@ class ArrayCollection implements Collection, Selectable */ public function exists(Closure $p) { - foreach ($this->_elements as $key => $element) { + foreach ($this->elements as $key => $element) { if ($p($key, $element)) { return true; } } + return false; } @@ -205,7 +208,7 @@ class ArrayCollection implements Collection, Selectable */ public function indexOf($element) { - return array_search($element, $this->_elements, true); + return array_search($element, $this->elements, true); } /** @@ -213,10 +216,7 @@ class ArrayCollection implements Collection, Selectable */ public function get($key) { - if (isset($this->_elements[$key])) { - return $this->_elements[$key]; - } - return null; + return isset($this->elements[$key]) ? $this->elements[$key] : null; } /** @@ -224,7 +224,7 @@ class ArrayCollection implements Collection, Selectable */ public function getKeys() { - return array_keys($this->_elements); + return array_keys($this->elements); } /** @@ -232,7 +232,7 @@ class ArrayCollection implements Collection, Selectable */ public function getValues() { - return array_values($this->_elements); + return array_values($this->elements); } /** @@ -240,7 +240,7 @@ class ArrayCollection implements Collection, Selectable */ public function count() { - return count($this->_elements); + return count($this->elements); } /** @@ -248,7 +248,7 @@ class ArrayCollection implements Collection, Selectable */ public function set($key, $value) { - $this->_elements[$key] = $value; + $this->elements[$key] = $value; } /** @@ -256,7 +256,8 @@ class ArrayCollection implements Collection, Selectable */ public function add($value) { - $this->_elements[] = $value; + $this->elements[] = $value; + return true; } @@ -265,7 +266,7 @@ class ArrayCollection implements Collection, Selectable */ public function isEmpty() { - return ! $this->_elements; + return empty($this->elements); } /** @@ -275,7 +276,7 @@ class ArrayCollection implements Collection, Selectable */ public function getIterator() { - return new ArrayIterator($this->_elements); + return new ArrayIterator($this->elements); } /** @@ -283,7 +284,7 @@ class ArrayCollection implements Collection, Selectable */ public function map(Closure $func) { - return new static(array_map($func, $this->_elements)); + return new static(array_map($func, $this->elements)); } /** @@ -291,7 +292,7 @@ class ArrayCollection implements Collection, Selectable */ public function filter(Closure $p) { - return new static(array_filter($this->_elements, $p)); + return new static(array_filter($this->elements, $p)); } /** @@ -299,7 +300,7 @@ class ArrayCollection implements Collection, Selectable */ public function forAll(Closure $p) { - foreach ($this->_elements as $key => $element) { + foreach ($this->elements as $key => $element) { if ( ! $p($key, $element)) { return false; } @@ -313,15 +314,17 @@ class ArrayCollection implements Collection, Selectable */ public function partition(Closure $p) { - $coll1 = $coll2 = array(); - foreach ($this->_elements as $key => $element) { + $matches = $noMatches = array(); + + foreach ($this->elements as $key => $element) { if ($p($key, $element)) { - $coll1[$key] = $element; + $matches[$key] = $element; } else { - $coll2[$key] = $element; + $noMatches[$key] = $element; } } - return array(new static($coll1), new static($coll2)); + + return array(new static($matches), new static($noMatches)); } /** @@ -339,7 +342,7 @@ class ArrayCollection implements Collection, Selectable */ public function clear() { - $this->_elements = array(); + $this->elements = array(); } /** @@ -347,7 +350,7 @@ class ArrayCollection implements Collection, Selectable */ public function slice($offset, $length = null) { - return array_slice($this->_elements, $offset, $length, true); + return array_slice($this->elements, $offset, $length, true); } /** @@ -356,7 +359,7 @@ class ArrayCollection implements Collection, Selectable public function matching(Criteria $criteria) { $expr = $criteria->getWhereExpression(); - $filtered = $this->_elements; + $filtered = $this->elements; if ($expr) { $visitor = new ClosureExpressionVisitor(); @@ -365,12 +368,11 @@ class ArrayCollection implements Collection, Selectable } if ($orderings = $criteria->getOrderings()) { - $next = null; foreach (array_reverse($orderings) as $field => $ordering) { - $next = ClosureExpressionVisitor::sortByField($field, $ordering == 'DESC' ? -1 : 1, $next); + $next = ClosureExpressionVisitor::sortByField($field, $ordering == Criteria::DESC ? -1 : 1); } - usort($filtered, $next); + uasort($filtered, $next); } $offset = $criteria->getFirstResult(); diff --git a/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Collection.php b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Collection.php index a0808b38c2a9..8792f7a5b663 100644 --- a/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Collection.php +++ b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Collection.php @@ -19,7 +19,10 @@ namespace Doctrine\Common\Collections; -use Closure, Countable, IteratorAggregate, ArrayAccess; +use ArrayAccess; +use Closure; +use Countable; +use IteratorAggregate; /** * The missing (SPL) Collection/Array/OrderedMap interface. @@ -29,7 +32,7 @@ use Closure, Countable, IteratorAggregate, ArrayAccess; * like a list. * * A Collection has an internal iterator just like a PHP array. In addition, - * a Collection can be iterated with external iterators, which is preferrable. + * a Collection can be iterated with external iterators, which is preferable. * To use an external iterator simply use the foreach language construct to * iterate over the collection (which calls {@link getIterator()} internally) or * explicitly retrieve an iterator though {@link getIterator()} which can then be @@ -52,14 +55,14 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess * * @return boolean Always TRUE. */ - function add($element); + public function add($element); /** * Clears the collection, removing all elements. * * @return void */ - function clear(); + public function clear(); /** * Checks whether an element is contained in the collection. @@ -69,14 +72,14 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess * * @return boolean TRUE if the collection contains the element, FALSE otherwise. */ - function contains($element); + public function contains($element); /** * Checks whether the collection is empty (contains no elements). * * @return boolean TRUE if the collection is empty, FALSE otherwise. */ - function isEmpty(); + public function isEmpty(); /** * Removes the element at the specified index from the collection. @@ -85,7 +88,7 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess * * @return mixed The removed element or NULL, if the collection did not contain the element. */ - function remove($key); + public function remove($key); /** * Removes the specified element from the collection, if it is found. @@ -94,7 +97,7 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess * * @return boolean TRUE if this collection contained the specified element, FALSE otherwise. */ - function removeElement($element); + public function removeElement($element); /** * Checks whether the collection contains an element with the specified key/index. @@ -104,7 +107,7 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess * @return boolean TRUE if the collection contains an element with the specified key/index, * FALSE otherwise. */ - function containsKey($key); + public function containsKey($key); /** * Gets the element at the specified key/index. @@ -113,7 +116,7 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess * * @return mixed */ - function get($key); + public function get($key); /** * Gets all keys/indices of the collection. @@ -121,7 +124,7 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess * @return array The keys/indices of the collection, in the order of the corresponding * elements in the collection. */ - function getKeys(); + public function getKeys(); /** * Gets all values of the collection. @@ -129,7 +132,7 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess * @return array The values of all elements in the collection, in the order they * appear in the collection. */ - function getValues(); + public function getValues(); /** * Sets an element in the collection at the specified key/index. @@ -139,49 +142,49 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess * * @return void */ - function set($key, $value); + public function set($key, $value); /** * Gets a native PHP array representation of the collection. * * @return array */ - function toArray(); + public function toArray(); /** * Sets the internal iterator to the first element in the collection and returns this element. * * @return mixed */ - function first(); + public function first(); /** * Sets the internal iterator to the last element in the collection and returns this element. * * @return mixed */ - function last(); + public function last(); /** * Gets the key/index of the element at the current iterator position. * * @return int|string */ - function key(); + public function key(); /** * Gets the element of the collection at the current iterator position. * * @return mixed */ - function current(); + public function current(); /** * Moves the internal iterator position to the next element and returns this element. * * @return mixed */ - function next(); + public function next(); /** * Tests for the existence of an element that satisfies the given predicate. @@ -190,7 +193,7 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess * * @return boolean TRUE if the predicate is TRUE for at least one element, FALSE otherwise. */ - function exists(Closure $p); + public function exists(Closure $p); /** * Returns all the elements of this collection that satisfy the predicate p. @@ -200,16 +203,16 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess * * @return Collection A collection with the results of the filter operation. */ - function filter(Closure $p); + public function filter(Closure $p); /** * Tests whether the given predicate p holds for all elements of this collection. - * + * * @param Closure $p The predicate. * * @return boolean TRUE, if the predicate yields TRUE for all elements, FALSE otherwise. */ - function forAll(Closure $p); + public function forAll(Closure $p); /** * Applies the given function to each element in the collection and returns @@ -219,7 +222,7 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess * * @return Collection */ - function map(Closure $func); + public function map(Closure $func); /** * Partitions this collection in two collections according to a predicate. @@ -231,7 +234,7 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess * of elements where the predicate returned TRUE, the second element * contains the collection of elements where the predicate returned FALSE. */ - function partition(Closure $p); + public function partition(Closure $p); /** * Gets the index/key of a given element. The comparison of two elements is strict, @@ -242,7 +245,7 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess * * @return int|string|bool The key/index of the element or FALSE if the element was not found. */ - function indexOf($element); + public function indexOf($element); /** * Extracts a slice of $length elements starting at position $offset from the Collection. @@ -256,5 +259,5 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess * * @return array */ - function slice($offset, $length = null); + public function slice($offset, $length = null); } diff --git a/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Criteria.php b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Criteria.php index 42929bdcaa2c..3f9d43a8294e 100644 --- a/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Criteria.php +++ b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Criteria.php @@ -51,9 +51,9 @@ class Criteria private $expression; /** - * @var array|null + * @var string[] */ - private $orderings; + private $orderings = array(); /** * @var int|null @@ -85,23 +85,28 @@ class Criteria if (self::$expressionBuilder === null) { self::$expressionBuilder = new ExpressionBuilder(); } + return self::$expressionBuilder; } /** * Construct a new Criteria. * - * @param Expression $expression - * @param array|null $orderings - * @param int|null $firstResult - * @param int|null $maxResults + * @param Expression $expression + * @param string[]|null $orderings + * @param int|null $firstResult + * @param int|null $maxResults */ public function __construct(Expression $expression = null, array $orderings = null, $firstResult = null, $maxResults = null) { - $this->expression = $expression; - $this->orderings = $orderings; - $this->firstResult = $firstResult; - $this->maxResults = $maxResults; + $this->expression = $expression; + + $this->setFirstResult($firstResult); + $this->setMaxResults($maxResults); + + if (null !== $orderings) { + $this->orderBy($orderings); + } } /** @@ -114,6 +119,7 @@ class Criteria public function where(Expression $expression) { $this->expression = $expression; + return $this; } @@ -172,7 +178,7 @@ class Criteria /** * Gets the current orderings of this Criteria. * - * @return array + * @return string[] */ public function getOrderings() { @@ -187,13 +193,19 @@ class Criteria * @see Criteria::ASC * @see Criteria::DESC * - * @param array $orderings + * @param string[] $orderings * * @return Criteria */ public function orderBy(array $orderings) { - $this->orderings = $orderings; + $this->orderings = array_map( + function ($ordering) { + return strtoupper($ordering) === Criteria::ASC ? Criteria::ASC : Criteria::DESC; + }, + $orderings + ); + return $this; } @@ -216,7 +228,8 @@ class Criteria */ public function setFirstResult($firstResult) { - $this->firstResult = $firstResult; + $this->firstResult = null === $firstResult ? null : (int) $firstResult; + return $this; } @@ -239,7 +252,8 @@ class Criteria */ public function setMaxResults($maxResults) { - $this->maxResults = $maxResults; + $this->maxResults = null === $maxResults ? null : (int) $maxResults; + return $this; } } diff --git a/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php index 50994584c481..994085f914f0 100644 --- a/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php +++ b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php @@ -83,7 +83,7 @@ class ClosureExpressionVisitor extends ExpressionVisitor */ public static function sortByField($name, $orientation = 1, \Closure $next = null) { - if (!$next) { + if ( ! $next) { $next = function() { return 0; }; diff --git a/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Selectable.php b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Selectable.php index 401d46e4df49..57660ed7fcb0 100644 --- a/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Selectable.php +++ b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Selectable.php @@ -44,5 +44,5 @@ interface Selectable * * @return Collection */ - function matching(Criteria $criteria); + public function matching(Criteria $criteria); } diff --git a/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ArrayCollectionTest.php b/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ArrayCollectionTest.php new file mode 100644 index 000000000000..1b8a906fdaf8 --- /dev/null +++ b/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ArrayCollectionTest.php @@ -0,0 +1,296 @@ +. + */ + +namespace Doctrine\Tests\Common\Collections; + +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Criteria; + +/** + * Tests for {@see \Doctrine\Common\Collections\ArrayCollection} + * + * @covers \Doctrine\Common\Collections\ArrayCollection + */ +class ArrayCollectionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @dataProvider provideDifferentElements + */ + public function testToArray($elements) + { + $collection = new ArrayCollection($elements); + + $this->assertSame($elements, $collection->toArray()); + } + + /** + * @dataProvider provideDifferentElements + */ + public function testFirst($elements) + { + $collection = new ArrayCollection($elements); + $this->assertSame(reset($elements), $collection->first()); + } + + /** + * @dataProvider provideDifferentElements + */ + public function testLast($elements) + { + $collection = new ArrayCollection($elements); + $this->assertSame(end($elements), $collection->last()); + } + + /** + * @dataProvider provideDifferentElements + */ + public function testKey($elements) + { + $collection = new ArrayCollection($elements); + + $this->assertSame(key($elements), $collection->key()); + + next($elements); + $collection->next(); + + $this->assertSame(key($elements), $collection->key()); + } + + /** + * @dataProvider provideDifferentElements + */ + public function testNext($elements) + { + $collection = new ArrayCollection($elements); + + while (true) { + $collectionNext = $collection->next(); + $arrayNext = next($elements); + + if(!$collectionNext || !$arrayNext) { + break; + } + + $this->assertSame($arrayNext, $collectionNext, "Returned value of ArrayCollection::next() and next() not match"); + $this->assertSame(key($elements), $collection->key(), "Keys not match"); + $this->assertSame(current($elements), $collection->current(), "Current values not match"); + } + } + + /** + * @dataProvider provideDifferentElements + */ + public function testCurrent($elements) + { + $collection = new ArrayCollection($elements); + + $this->assertSame(current($elements), $collection->current()); + + next($elements); + $collection->next(); + + $this->assertSame(current($elements), $collection->current()); + } + + /** + * @dataProvider provideDifferentElements + */ + public function testGetKeys($elements) + { + $collection = new ArrayCollection($elements); + + $this->assertSame(array_keys($elements), $collection->getKeys()); + } + + /** + * @dataProvider provideDifferentElements + */ + public function testGetValues($elements) + { + $collection = new ArrayCollection($elements); + + $this->assertSame(array_values($elements), $collection->getValues()); + } + + /** + * @dataProvider provideDifferentElements + */ + public function testCount($elements) + { + $collection = new ArrayCollection($elements); + + $this->assertSame(count($elements), $collection->count()); + } + + /** + * @dataProvider provideDifferentElements + */ + public function testIterator($elements) + { + $collection = new ArrayCollection($elements); + + $iterations = 0; + foreach($collection->getIterator() as $key => $item) { + $this->assertSame($elements[$key], $item, "Item {$key} not match"); + $iterations++; + } + + $this->assertEquals(count($elements), $iterations, "Number of iterations not match"); + } + + /** + * @return array + */ + public function provideDifferentElements() + { + return array( + 'indexed' => array(array(1, 2, 3, 4, 5)), + 'associative' => array(array('A' => 'a', 'B' => 'b', 'C' => 'c')), + 'mixed' => array(array('A' => 'a', 1, 'B' => 'b', 2, 3)), + ); + } + + public function testRemove() + { + $elements = array(1, 'A' => 'a', 2, 'B' => 'b', 3); + $collection = new ArrayCollection($elements); + + $this->assertEquals(1, $collection->remove(0)); + unset($elements[0]); + + $this->assertEquals(null, $collection->remove('non-existent')); + unset($elements['non-existent']); + + $this->assertEquals(2, $collection->remove(1)); + unset($elements[1]); + + $this->assertEquals('a', $collection->remove('A')); + unset($elements['A']); + + $this->assertEquals($elements, $collection->toArray()); + } + + public function testRemoveElement() + { + $elements = array(1, 'A' => 'a', 2, 'B' => 'b', 3, 'A2' => 'a', 'B2' => 'b'); + $collection = new ArrayCollection($elements); + + $this->assertTrue($collection->removeElement(1)); + unset($elements[0]); + + $this->assertFalse($collection->removeElement('non-existent')); + + $this->assertTrue($collection->removeElement('a')); + unset($elements['A']); + + $this->assertTrue($collection->removeElement('a')); + unset($elements['A2']); + + $this->assertEquals($elements, $collection->toArray()); + } + + public function testContainsKey() + { + $elements = array(1, 'A' => 'a', 2, 'null' => null, 3, 'A2' => 'a', 'B2' => 'b'); + $collection = new ArrayCollection($elements); + + $this->assertTrue($collection->containsKey(0), "Contains index 0"); + $this->assertTrue($collection->containsKey('A'), "Contains key \"A\""); + $this->assertTrue($collection->containsKey('null'), "Contains key \"null\", with value null"); + $this->assertFalse($collection->containsKey('non-existent'), "Doesn't contain key"); + } + + public function testEmpty() + { + $collection = new ArrayCollection(); + $this->assertTrue($collection->isEmpty(), "Empty collection"); + + $collection->add(1); + $this->assertFalse($collection->isEmpty(), "Not empty collection"); + } + + public function testContains() + { + $elements = array(1, 'A' => 'a', 2, 'null' => null, 3, 'A2' => 'a', 'zero' => 0); + $collection = new ArrayCollection($elements); + + $this->assertTrue($collection->contains(0), "Contains Zero"); + $this->assertTrue($collection->contains('a'), "Contains \"a\""); + $this->assertTrue($collection->contains(null), "Contains Null"); + $this->assertFalse($collection->contains('non-existent'), "Doesn't contain an element"); + } + + public function testExists() + { + $elements = array(1, 'A' => 'a', 2, 'null' => null, 3, 'A2' => 'a', 'zero' => 0); + $collection = new ArrayCollection($elements); + + $this->assertTrue($collection->exists(function($key, $element) { + return $key == 'A' && $element == 'a'; + }), "Element exists"); + + $this->assertFalse($collection->exists(function($key, $element) { + return $key == 'non-existent' && $element == 'non-existent'; + }), "Element not exists"); + } + + public function testIndexOf() + { + $elements = array(1, 'A' => 'a', 2, 'null' => null, 3, 'A2' => 'a', 'zero' => 0); + $collection = new ArrayCollection($elements); + + $this->assertSame(array_search(2, $elements, true), $collection->indexOf(2), 'Index of 2'); + $this->assertSame(array_search(null, $elements, true), $collection->indexOf(null), 'Index of null'); + $this->assertSame(array_search('non-existent', $elements, true), $collection->indexOf('non-existent'), 'Index of non existent'); + } + + public function testGet() + { + $elements = array(1, 'A' => 'a', 2, 'null' => null, 3, 'A2' => 'a', 'zero' => 0); + $collection = new ArrayCollection($elements); + + $this->assertSame(2, $collection->get(1), 'Get element by index'); + $this->assertSame('a', $collection->get('A'), 'Get element by name'); + $this->assertSame(null, $collection->get('non-existent'), 'Get non existent element'); + } + + public function testMatchingWithSortingPreservesyKeys() + { + $object1 = new \stdClass(); + $object2 = new \stdClass(); + + $object1->sortField = 2; + $object2->sortField = 1; + + $collection = new ArrayCollection(array( + 'object1' => $object1, + 'object2' => $object2, + )); + + $this->assertSame( + array( + 'object2' => $object2, + 'object1' => $object1, + ), + $collection + ->matching(new Criteria(null, array('sortField' => Criteria::ASC))) + ->toArray() + ); + } +} diff --git a/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php b/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php index b640043e6eaf..21c2e3dfc52c 100644 --- a/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php +++ b/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php @@ -27,10 +27,17 @@ use Doctrine\Common\Collections\ExpressionBuilder; */ class ClosureExpressionVisitorTest extends \PHPUnit_Framework_TestCase { + /** + * @var ClosureExpressionVisitor + */ private $visitor; + + /** + * @var ExpressionBuilder + */ private $builder; - public function setUp() + protected function setUp() { $this->visitor = new ClosureExpressionVisitor(); $this->builder = new ExpressionBuilder(); diff --git a/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CollectionTest.php b/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CollectionTest.php index d98246c42944..f3f91ad3f13c 100644 --- a/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CollectionTest.php +++ b/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CollectionTest.php @@ -2,195 +2,196 @@ namespace Doctrine\Tests\Common\Collections; -use Doctrine\Tests; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Criteria; -class CollectionTest extends \Doctrine\Tests\DoctrineTestCase +class CollectionTest extends \PHPUnit_Framework_TestCase { /** - * @var \Doctrine\Common\Collections\Collection + * @var Collection */ - private $_coll; + private $collection; protected function setUp() { - $this->_coll = new \Doctrine\Common\Collections\ArrayCollection; + $this->collection = new ArrayCollection(); } public function testIssetAndUnset() { - $this->assertFalse(isset($this->_coll[0])); - $this->_coll->add('testing'); - $this->assertTrue(isset($this->_coll[0])); - unset($this->_coll[0]); - $this->assertFalse(isset($this->_coll[0])); + $this->assertFalse(isset($this->collection[0])); + $this->collection->add('testing'); + $this->assertTrue(isset($this->collection[0])); + unset($this->collection[0]); + $this->assertFalse(isset($this->collection[0])); } public function testToString() { - $this->_coll->add('testing'); - $this->assertTrue(is_string((string) $this->_coll)); + $this->collection->add('testing'); + $this->assertTrue(is_string((string) $this->collection)); } public function testRemovingNonExistentEntryReturnsNull() { - $this->assertEquals(null, $this->_coll->remove('testing_does_not_exist')); + $this->assertEquals(null, $this->collection->remove('testing_does_not_exist')); } public function testExists() { - $this->_coll->add("one"); - $this->_coll->add("two"); - $exists = $this->_coll->exists(function($k, $e) { return $e == "one"; }); + $this->collection->add("one"); + $this->collection->add("two"); + $exists = $this->collection->exists(function($k, $e) { return $e == "one"; }); $this->assertTrue($exists); - $exists = $this->_coll->exists(function($k, $e) { return $e == "other"; }); + $exists = $this->collection->exists(function($k, $e) { return $e == "other"; }); $this->assertFalse($exists); } public function testMap() { - $this->_coll->add(1); - $this->_coll->add(2); - $res = $this->_coll->map(function($e) { return $e * 2; }); + $this->collection->add(1); + $this->collection->add(2); + $res = $this->collection->map(function($e) { return $e * 2; }); $this->assertEquals(array(2, 4), $res->toArray()); } public function testFilter() { - $this->_coll->add(1); - $this->_coll->add("foo"); - $this->_coll->add(3); - $res = $this->_coll->filter(function($e) { return is_numeric($e); }); + $this->collection->add(1); + $this->collection->add("foo"); + $this->collection->add(3); + $res = $this->collection->filter(function($e) { return is_numeric($e); }); $this->assertEquals(array(0 => 1, 2 => 3), $res->toArray()); } public function testFirstAndLast() { - $this->_coll->add('one'); - $this->_coll->add('two'); + $this->collection->add('one'); + $this->collection->add('two'); - $this->assertEquals($this->_coll->first(), 'one'); - $this->assertEquals($this->_coll->last(), 'two'); + $this->assertEquals($this->collection->first(), 'one'); + $this->assertEquals($this->collection->last(), 'two'); } public function testArrayAccess() { - $this->_coll[] = 'one'; - $this->_coll[] = 'two'; + $this->collection[] = 'one'; + $this->collection[] = 'two'; - $this->assertEquals($this->_coll[0], 'one'); - $this->assertEquals($this->_coll[1], 'two'); + $this->assertEquals($this->collection[0], 'one'); + $this->assertEquals($this->collection[1], 'two'); - unset($this->_coll[0]); - $this->assertEquals($this->_coll->count(), 1); + unset($this->collection[0]); + $this->assertEquals($this->collection->count(), 1); } public function testContainsKey() { - $this->_coll[5] = 'five'; - $this->assertTrue($this->_coll->containsKey(5)); + $this->collection[5] = 'five'; + $this->assertTrue($this->collection->containsKey(5)); } public function testContains() { - $this->_coll[0] = 'test'; - $this->assertTrue($this->_coll->contains('test')); + $this->collection[0] = 'test'; + $this->assertTrue($this->collection->contains('test')); } public function testSearch() { - $this->_coll[0] = 'test'; - $this->assertEquals(0, $this->_coll->indexOf('test')); + $this->collection[0] = 'test'; + $this->assertEquals(0, $this->collection->indexOf('test')); } public function testGet() { - $this->_coll[0] = 'test'; - $this->assertEquals('test', $this->_coll->get(0)); + $this->collection[0] = 'test'; + $this->assertEquals('test', $this->collection->get(0)); } public function testGetKeys() { - $this->_coll[] = 'one'; - $this->_coll[] = 'two'; - $this->assertEquals(array(0, 1), $this->_coll->getKeys()); + $this->collection[] = 'one'; + $this->collection[] = 'two'; + $this->assertEquals(array(0, 1), $this->collection->getKeys()); } public function testGetValues() { - $this->_coll[] = 'one'; - $this->_coll[] = 'two'; - $this->assertEquals(array('one', 'two'), $this->_coll->getValues()); + $this->collection[] = 'one'; + $this->collection[] = 'two'; + $this->assertEquals(array('one', 'two'), $this->collection->getValues()); } public function testCount() { - $this->_coll[] = 'one'; - $this->_coll[] = 'two'; - $this->assertEquals($this->_coll->count(), 2); - $this->assertEquals(count($this->_coll), 2); + $this->collection[] = 'one'; + $this->collection[] = 'two'; + $this->assertEquals($this->collection->count(), 2); + $this->assertEquals(count($this->collection), 2); } public function testForAll() { - $this->_coll[] = 'one'; - $this->_coll[] = 'two'; - $this->assertEquals($this->_coll->forAll(function($k, $e) { return is_string($e); }), true); - $this->assertEquals($this->_coll->forAll(function($k, $e) { return is_array($e); }), false); + $this->collection[] = 'one'; + $this->collection[] = 'two'; + $this->assertEquals($this->collection->forAll(function($k, $e) { return is_string($e); }), true); + $this->assertEquals($this->collection->forAll(function($k, $e) { return is_array($e); }), false); } public function testPartition() { - $this->_coll[] = true; - $this->_coll[] = false; - $partition = $this->_coll->partition(function($k, $e) { return $e == true; }); + $this->collection[] = true; + $this->collection[] = false; + $partition = $this->collection->partition(function($k, $e) { return $e == true; }); $this->assertEquals($partition[0][0], true); $this->assertEquals($partition[1][0], false); } public function testClear() { - $this->_coll[] = 'one'; - $this->_coll[] = 'two'; - $this->_coll->clear(); - $this->assertEquals($this->_coll->isEmpty(), true); + $this->collection[] = 'one'; + $this->collection[] = 'two'; + $this->collection->clear(); + $this->assertEquals($this->collection->isEmpty(), true); } public function testRemove() { - $this->_coll[] = 'one'; - $this->_coll[] = 'two'; - $el = $this->_coll->remove(0); + $this->collection[] = 'one'; + $this->collection[] = 'two'; + $el = $this->collection->remove(0); $this->assertEquals('one', $el); - $this->assertEquals($this->_coll->contains('one'), false); - $this->assertNull($this->_coll->remove(0)); + $this->assertEquals($this->collection->contains('one'), false); + $this->assertNull($this->collection->remove(0)); } public function testRemoveElement() { - $this->_coll[] = 'one'; - $this->_coll[] = 'two'; + $this->collection[] = 'one'; + $this->collection[] = 'two'; - $this->assertTrue($this->_coll->removeElement('two')); - $this->assertFalse($this->_coll->contains('two')); - $this->assertFalse($this->_coll->removeElement('two')); + $this->assertTrue($this->collection->removeElement('two')); + $this->assertFalse($this->collection->contains('two')); + $this->assertFalse($this->collection->removeElement('two')); } public function testSlice() { - $this->_coll[] = 'one'; - $this->_coll[] = 'two'; - $this->_coll[] = 'three'; + $this->collection[] = 'one'; + $this->collection[] = 'two'; + $this->collection[] = 'three'; - $slice = $this->_coll->slice(0, 1); + $slice = $this->collection->slice(0, 1); $this->assertInternalType('array', $slice); $this->assertEquals(array('one'), $slice); - $slice = $this->_coll->slice(1); + $slice = $this->collection->slice(1); $this->assertEquals(array(1 => 'two', 2 => 'three'), $slice); - $slice = $this->_coll->slice(1, 1); + $slice = $this->collection->slice(1, 1); $this->assertEquals(array(1 => 'two'), $slice); } @@ -198,11 +199,11 @@ class CollectionTest extends \Doctrine\Tests\DoctrineTestCase { $std1 = new \stdClass(); $std1->foo = "bar"; - $this->_coll[] = $std1; + $this->collection[] = $std1; $std2 = new \stdClass(); $std2->foo = "baz"; - $this->_coll[] = $std2; + $this->collection[] = $std2; } /** @@ -212,9 +213,9 @@ class CollectionTest extends \Doctrine\Tests\DoctrineTestCase { $this->fillMatchingFixture(); - $col = $this->_coll->matching(new Criteria(Criteria::expr()->eq("foo", "bar"))); + $col = $this->collection->matching(new Criteria(Criteria::expr()->eq("foo", "bar"))); $this->assertInstanceOf('Doctrine\Common\Collections\Collection', $col); - $this->assertNotSame($col, $this->_coll); + $this->assertNotSame($col, $this->collection); $this->assertEquals(1, count($col)); } @@ -225,13 +226,13 @@ class CollectionTest extends \Doctrine\Tests\DoctrineTestCase { $this->fillMatchingFixture(); - $col = $this->_coll->matching(new Criteria(null, array('foo' => 'DESC'))); + $col = $this->collection->matching(new Criteria(null, array('foo' => 'DESC'))); $this->assertInstanceOf('Doctrine\Common\Collections\Collection', $col); - $this->assertNotSame($col, $this->_coll); + $this->assertNotSame($col, $this->collection); $this->assertEquals(2, count($col)); - $this->assertEquals('baz', $col[0]->foo); - $this->assertEquals('bar', $col[1]->foo); + $this->assertEquals('baz', $col->first()->foo); + $this->assertEquals('bar', $col->last()->foo); } /** @@ -241,24 +242,24 @@ class CollectionTest extends \Doctrine\Tests\DoctrineTestCase { $this->fillMatchingFixture(); - $col = $this->_coll->matching(new Criteria(null, null, 1, 1)); + $col = $this->collection->matching(new Criteria(null, null, 1, 1)); $this->assertInstanceOf('Doctrine\Common\Collections\Collection', $col); - $this->assertNotSame($col, $this->_coll); + $this->assertNotSame($col, $this->collection); $this->assertEquals(1, count($col)); $this->assertEquals('baz', $col[0]->foo); } public function testCanRemoveNullValuesByKey() { - $this->_coll->add(null); - $this->_coll->remove(0); - $this->assertTrue($this->_coll->isEmpty()); + $this->collection->add(null); + $this->collection->remove(0); + $this->assertTrue($this->collection->isEmpty()); } public function testCanVerifyExistingKeysWithNullValues() { - $this->_coll->set('key', null); - $this->assertTrue($this->_coll->containsKey('key')); + $this->collection->set('key', null); + $this->assertTrue($this->collection->containsKey('key')); } } diff --git a/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CriteriaTest.php b/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CriteriaTest.php index 03fb6cae0aef..1ab058a9b8c7 100644 --- a/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CriteriaTest.php +++ b/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CriteriaTest.php @@ -1,4 +1,5 @@ assertInstanceOf("Doctrine\Common\Collections\Criteria", $criteria); + $this->assertInstanceOf('Doctrine\Common\Collections\Criteria', $criteria); } public function testConstructor() diff --git a/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php b/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php index 06d415570ed4..5f6b4ce2f011 100644 --- a/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php +++ b/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php @@ -1,4 +1,5 @@ builder = new ExpressionBuilder(); } @@ -21,7 +25,7 @@ class ExpressionBuilderTest extends \PHPUnit_Framework_TestCase { $expr = $this->builder->andX($this->builder->eq("a", "b")); - $this->assertInstanceOf("Doctrine\Common\Collections\Expr\CompositeExpression", $expr); + $this->assertInstanceOf('Doctrine\Common\Collections\Expr\CompositeExpression', $expr); $this->assertEquals(CompositeExpression::TYPE_AND, $expr->getType()); } @@ -29,7 +33,7 @@ class ExpressionBuilderTest extends \PHPUnit_Framework_TestCase { $expr = $this->builder->orX($this->builder->eq("a", "b")); - $this->assertInstanceOf("Doctrine\Common\Collections\Expr\CompositeExpression", $expr); + $this->assertInstanceOf('Doctrine\Common\Collections\Expr\CompositeExpression', $expr); $this->assertEquals(CompositeExpression::TYPE_OR, $expr->getType()); } @@ -43,7 +47,7 @@ class ExpressionBuilderTest extends \PHPUnit_Framework_TestCase { $expr = $this->builder->eq("a", "b"); - $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); $this->assertEquals(Comparison::EQ, $expr->getOperator()); } @@ -51,7 +55,7 @@ class ExpressionBuilderTest extends \PHPUnit_Framework_TestCase { $expr = $this->builder->neq("a", "b"); - $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); $this->assertEquals(Comparison::NEQ, $expr->getOperator()); } @@ -59,7 +63,7 @@ class ExpressionBuilderTest extends \PHPUnit_Framework_TestCase { $expr = $this->builder->lt("a", "b"); - $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); $this->assertEquals(Comparison::LT, $expr->getOperator()); } @@ -67,7 +71,7 @@ class ExpressionBuilderTest extends \PHPUnit_Framework_TestCase { $expr = $this->builder->gt("a", "b"); - $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); $this->assertEquals(Comparison::GT, $expr->getOperator()); } @@ -75,7 +79,7 @@ class ExpressionBuilderTest extends \PHPUnit_Framework_TestCase { $expr = $this->builder->gte("a", "b"); - $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); $this->assertEquals(Comparison::GTE, $expr->getOperator()); } @@ -83,7 +87,7 @@ class ExpressionBuilderTest extends \PHPUnit_Framework_TestCase { $expr = $this->builder->lte("a", "b"); - $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); $this->assertEquals(Comparison::LTE, $expr->getOperator()); } @@ -91,7 +95,7 @@ class ExpressionBuilderTest extends \PHPUnit_Framework_TestCase { $expr = $this->builder->in("a", array("b")); - $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); $this->assertEquals(Comparison::IN, $expr->getOperator()); } @@ -99,7 +103,7 @@ class ExpressionBuilderTest extends \PHPUnit_Framework_TestCase { $expr = $this->builder->notIn("a", array("b")); - $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); $this->assertEquals(Comparison::NIN, $expr->getOperator()); } @@ -107,7 +111,7 @@ class ExpressionBuilderTest extends \PHPUnit_Framework_TestCase { $expr = $this->builder->isNull("a"); - $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); $this->assertEquals(Comparison::EQ, $expr->getOperator()); } @@ -115,8 +119,7 @@ class ExpressionBuilderTest extends \PHPUnit_Framework_TestCase { $expr = $this->builder->contains("a", "b"); - $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); $this->assertEquals(Comparison::CONTAINS, $expr->getOperator()); } } - diff --git a/core/vendor/doctrine/collections/tests/Doctrine/Tests/DoctrineTestCase.php b/core/vendor/doctrine/collections/tests/Doctrine/Tests/DoctrineTestCase.php deleted file mode 100644 index e8323d294092..000000000000 --- a/core/vendor/doctrine/collections/tests/Doctrine/Tests/DoctrineTestCase.php +++ /dev/null @@ -1,10 +0,0 @@ - * @since 2.0 + * + * @deprecated the ClassLoader is deprecated and will be removed in version 3.0 of doctrine/common. */ class ClassLoader { @@ -173,7 +175,11 @@ class ClassLoader */ public function loadClass($className) { - if ($this->namespace !== null && strpos($className, $this->namespace.$this->namespaceSeparator) !== 0) { + if (self::typeExists($className)) { + return true; + } + + if (! $this->canLoadClass($className)) { return false; } @@ -181,7 +187,7 @@ class ClassLoader . str_replace($this->namespaceSeparator, DIRECTORY_SEPARATOR, $className) . $this->fileExtension; - return true; + return self::typeExists($className); } /** @@ -231,37 +237,7 @@ class ClassLoader */ public static function classExists($className) { - if (class_exists($className, false) || interface_exists($className, false)) { - return true; - } - - foreach (spl_autoload_functions() as $loader) { - if (is_array($loader)) { // array(???, ???) - if (is_object($loader[0])) { - if ($loader[0] instanceof ClassLoader) { // array($obj, 'methodName') - if ($loader[0]->canLoadClass($className)) { - return true; - } - } else if ($loader[0]->{$loader[1]}($className)) { - return true; - } - } else if ($loader[0]::$loader[1]($className)) { // array('ClassName', 'methodName') - return true; - } - } else if ($loader instanceof \Closure) { // function($className) {..} - if ($loader($className)) { - return true; - } - } else if (is_string($loader) && $loader($className)) { // "MyClass::loadClass" - return true; - } - - if (class_exists($className, false) || interface_exists($className, false)) { - return true; - } - } - - return false; + return self::typeExists($className, true); } /** @@ -276,13 +252,29 @@ class ClassLoader { foreach (spl_autoload_functions() as $loader) { if (is_array($loader) - && $loader[0] instanceof ClassLoader - && $loader[0]->canLoadClass($className) + && ($classLoader = reset($loader)) + && $classLoader instanceof ClassLoader + && $classLoader->canLoadClass($className) ) { - return $loader[0]; + return $classLoader; } } return null; } + + /** + * Checks whether a given type exists + * + * @param string $type + * @param bool $autoload + * + * @return bool + */ + private static function typeExists($type, $autoload = false) + { + return class_exists($type, $autoload) + || interface_exists($type, $autoload) + || (function_exists('trait_exists') && trait_exists($type, $autoload)); + } } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php index 15b5aa32cf22..33770f9010e7 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php @@ -19,8 +19,6 @@ namespace Doctrine\Common\Persistence; -use Doctrine\Common\Persistence\ManagerRegistry; - /** * Abstract implementation of the ManagerRegistry contract. * @@ -192,7 +190,7 @@ abstract class AbstractManagerRegistry implements ManagerRegistry { // Check for namespace alias if (strpos($class, ':') !== false) { - list($namespaceAlias, $simpleClassName) = explode(':', $class); + list($namespaceAlias, $simpleClassName) = explode(':', $class, 2); $class = $this->getAliasNamespace($namespaceAlias) . '\\' . $simpleClassName; } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LoadClassMetadataEventArgs.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LoadClassMetadataEventArgs.php index 07770bb7cc1b..3d8abbe23837 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LoadClassMetadataEventArgs.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LoadClassMetadataEventArgs.php @@ -20,8 +20,8 @@ namespace Doctrine\Common\Persistence\Event; use Doctrine\Common\EventArgs; -use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Common\Persistence\Mapping\ClassMetadata; +use Doctrine\Common\Persistence\ObjectManager; /** * Class that holds event arguments for a loadMetadata event. diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/PreUpdateEventArgs.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/PreUpdateEventArgs.php index d34de841e481..facce64710d5 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/PreUpdateEventArgs.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/PreUpdateEventArgs.php @@ -19,7 +19,6 @@ namespace Doctrine\Common\Persistence\Event; -use Doctrine\Common\EventArgs; use Doctrine\Common\Persistence\ObjectManager; /** diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php index 01ad58fd04d9..404fea91a30b 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php @@ -21,6 +21,7 @@ namespace Doctrine\Common\Persistence\Mapping; use Doctrine\Common\Cache\Cache; use Doctrine\Common\Util\ClassUtils; +use ReflectionException; /** * The ClassMetadataFactory is used to create ClassMetadata objects that contain all the @@ -50,7 +51,7 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory private $cacheDriver; /** - * @var array + * @var ClassMetadata[] */ private $loadedMetadata = array(); @@ -89,7 +90,7 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory /** * Returns an array of all the loaded metadata currently in memory. * - * @return array + * @return ClassMetadata[] */ public function getLoadedMetadata() { @@ -178,7 +179,10 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory * * @param string $className The name of the class. * - * @return \Doctrine\Common\Persistence\Mapping\ClassMetadata + * @return ClassMetadata + * + * @throws ReflectionException + * @throws MappingException */ public function getMetadataFor($className) { @@ -186,39 +190,49 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory return $this->loadedMetadata[$className]; } - $realClassName = $className; - // Check for namespace alias if (strpos($className, ':') !== false) { - list($namespaceAlias, $simpleClassName) = explode(':', $className); + list($namespaceAlias, $simpleClassName) = explode(':', $className, 2); + $realClassName = $this->getFqcnFromAlias($namespaceAlias, $simpleClassName); } else { - $realClassName = ClassUtils::getRealClass($realClassName); + $realClassName = ClassUtils::getRealClass($className); } if (isset($this->loadedMetadata[$realClassName])) { // We do not have the alias name in the map, include it - $this->loadedMetadata[$className] = $this->loadedMetadata[$realClassName]; - - return $this->loadedMetadata[$realClassName]; + return $this->loadedMetadata[$className] = $this->loadedMetadata[$realClassName]; } - if ($this->cacheDriver) { - if (($cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt)) !== false) { - $this->loadedMetadata[$realClassName] = $cached; - $this->wakeupReflection($cached, $this->getReflectionService()); - } else { - foreach ($this->loadMetadata($realClassName) as $loadedClassName) { - $this->cacheDriver->save( - $loadedClassName . $this->cacheSalt, $this->loadedMetadata[$loadedClassName], null - ); + $loadingException = null; + + try { + if ($this->cacheDriver) { + if (($cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt)) !== false) { + $this->loadedMetadata[$realClassName] = $cached; + + $this->wakeupReflection($cached, $this->getReflectionService()); + } else { + foreach ($this->loadMetadata($realClassName) as $loadedClassName) { + $this->cacheDriver->save( + $loadedClassName . $this->cacheSalt, + $this->loadedMetadata[$loadedClassName], + null + ); + } } + } else { + $this->loadMetadata($realClassName); } - } else { - $this->loadMetadata($realClassName); + } catch (MappingException $loadingException) { + if (! $fallbackMetadataResponse = $this->onNotFoundMetadata($realClassName)) { + throw $loadingException; + } + + $this->loadedMetadata[$realClassName] = $fallbackMetadataResponse; } - if ($className != $realClassName) { + if ($className !== $realClassName) { // We do not have the alias name in the map, include it $this->loadedMetadata[$className] = $this->loadedMetadata[$realClassName]; } @@ -334,6 +348,20 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory return $loaded; } + /** + * Provides a fallback hook for loading metadata when loading failed due to reflection/mapping exceptions + * + * Override this method to implement a fallback strategy for failed metadata loading + * + * @param string $className + * + * @return \Doctrine\Common\Persistence\Mapping\ClassMetadata|null + */ + protected function onNotFoundMetadata($className) + { + return null; + } + /** * Actually loads the metadata from the underlying metadata. * @@ -367,7 +395,7 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory // Check for namespace alias if (strpos($class, ':') !== false) { - list($namespaceAlias, $simpleClassName) = explode(':', $class); + list($namespaceAlias, $simpleClassName) = explode(':', $class, 2); $class = $this->getFqcnFromAlias($namespaceAlias, $simpleClassName); } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php index 6668e610e060..8bb574d92e93 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php @@ -20,7 +20,6 @@ namespace Doctrine\Common\Persistence\Mapping\Driver; use Doctrine\Common\Annotations\AnnotationReader; -use Doctrine\Common\Annotations\AnnotationRegistry; use Doctrine\Common\Persistence\Mapping\MappingException; /** diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php index 6a9e27647c7f..58a740b57071 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php @@ -51,7 +51,7 @@ class DefaultFileLocator implements FileLocator * documents and operates in the specified operating mode. * * @param string|array $paths One or multiple paths where mapping documents can be found. - * @param string|null $fileExtension The file extension of mapping documents. + * @param string|null $fileExtension The file extension of mapping documents, usually prefixed with a dot. */ public function __construct($paths, $fileExtension = null) { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php index 5fa9a7a8016f..26a9f3e2cbfd 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php @@ -19,7 +19,6 @@ namespace Doctrine\Common\Persistence\Mapping\Driver; -use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver; use Doctrine\Common\Persistence\Mapping\ClassMetadata; use Doctrine\Common\Persistence\Mapping\MappingException; diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/PHPDriver.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/PHPDriver.php index 31651f3ea6e2..6df54b0f7a23 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/PHPDriver.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/PHPDriver.php @@ -35,7 +35,7 @@ use Doctrine\Common\Persistence\Mapping\ClassMetadata; class PHPDriver extends FileDriver { /** - * {@inheritDoc} + * @var ClassMetadata */ protected $metadata; diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/SymfonyFileLocator.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/SymfonyFileLocator.php index dd4d741507d7..f334265605b7 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/SymfonyFileLocator.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/SymfonyFileLocator.php @@ -53,16 +53,30 @@ class SymfonyFileLocator implements FileLocator */ protected $fileExtension; + /** + * Represents PHP namespace delimiters when looking for files + * + * @var string + */ + private $nsSeparator; + /** * Constructor. * * @param array $prefixes * @param string|null $fileExtension + * @param string $nsSeparator String which would be used when converting FQCN to filename and vice versa. Should not be empty */ - public function __construct(array $prefixes, $fileExtension = null) + public function __construct(array $prefixes, $fileExtension = null, $nsSeparator = '.') { $this->addNamespacePrefixes($prefixes); $this->fileExtension = $fileExtension; + + if (empty($nsSeparator)) { + throw new \InvalidArgumentException('Namespace separator should not be empty'); + } + + $this->nsSeparator = (string) $nsSeparator; } /** @@ -121,7 +135,7 @@ class SymfonyFileLocator implements FileLocator */ public function fileExists($className) { - $defaultFileName = str_replace('\\', '.', $className).$this->fileExtension; + $defaultFileName = str_replace('\\', $this->nsSeparator, $className).$this->fileExtension; foreach ($this->paths as $path) { if (!isset($this->prefixes[$path])) { // global namespace class @@ -138,7 +152,7 @@ class SymfonyFileLocator implements FileLocator continue; } - $filename = $path.'/'.strtr(substr($className, strlen($prefix)+1), '\\', '.').$this->fileExtension; + $filename = $path.'/'.strtr(substr($className, strlen($prefix)+1), '\\', $this->nsSeparator).$this->fileExtension; return is_file($filename); } @@ -172,9 +186,17 @@ class SymfonyFileLocator implements FileLocator // NOTE: All files found here means classes are not transient! if (isset($this->prefixes[$path])) { - $classes[] = $this->prefixes[$path].'\\'.str_replace('.', '\\', $fileName); + + // Calculate namespace suffix for given prefix as a relative path from basepath to file path + $nsSuffix = strtr( + substr(realpath($file->getPath()), strlen(realpath($path))), + $this->nsSeparator, + '\\' + ); + + $classes[] = $this->prefixes[$path] . $nsSuffix . '\\' .str_replace($this->nsSeparator, '\\', $fileName); } else { - $classes[] = str_replace('.', '\\', $fileName); + $classes[] = str_replace($this->nsSeparator, '\\', $fileName); } } } @@ -188,7 +210,7 @@ class SymfonyFileLocator implements FileLocator */ public function findMappingFile($className) { - $defaultFileName = str_replace('\\', '.', $className).$this->fileExtension; + $defaultFileName = str_replace('\\', $this->nsSeparator, $className).$this->fileExtension; foreach ($this->paths as $path) { if (!isset($this->prefixes[$path])) { if (is_file($path.DIRECTORY_SEPARATOR.$defaultFileName)) { @@ -204,7 +226,7 @@ class SymfonyFileLocator implements FileLocator continue; } - $filename = $path.'/'.strtr(substr($className, strlen($prefix)+1), '\\', '.').$this->fileExtension; + $filename = $path.'/'.strtr(substr($className, strlen($prefix)+1), '\\', $this->nsSeparator ).$this->fileExtension; if (is_file($filename)) { return $filename; } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php index c8c32b2900bb..6e97485ebe28 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php @@ -30,7 +30,7 @@ class MappingException extends \Exception * @param string $className * @param array $namespaces * - * @return MappingException + * @return self */ public static function classNotFoundInNamespaces($className, $namespaces) { @@ -39,7 +39,7 @@ class MappingException extends \Exception } /** - * @return MappingException + * @return self */ public static function pathRequired() { @@ -50,7 +50,7 @@ class MappingException extends \Exception /** * @param string|null $path * - * @return MappingException + * @return self */ public static function fileMappingDriversRequireConfiguredDirectoryPath($path = null) { @@ -68,7 +68,7 @@ class MappingException extends \Exception * @param string $entityName * @param string $fileName * - * @return MappingException + * @return self */ public static function mappingFileNotFound($entityName, $fileName) { @@ -79,7 +79,7 @@ class MappingException extends \Exception * @param string $entityName * @param string $fileName * - * @return MappingException + * @return self */ public static function invalidMappingFile($entityName, $fileName) { @@ -89,7 +89,7 @@ class MappingException extends \Exception /** * @param string $className * - * @return \Doctrine\Common\Persistence\Mapping\MappingException + * @return self */ public static function nonExistingClass($className) { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php index b9acf9c4877b..4598d5aff24c 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php @@ -19,13 +19,11 @@ namespace Doctrine\Common\Persistence\Mapping; -use ReflectionClass; -use ReflectionProperty; -use ReflectionMethod; -use ReflectionException; - use Doctrine\Common\Reflection\RuntimePublicReflectionProperty; -use Doctrine\Common\Persistence\Mapping\MappingException; +use ReflectionClass; +use ReflectionException; +use ReflectionMethod; +use ReflectionProperty; /** * PHP Runtime Reflection Service. diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php index 08c69427a288..a35b71a2883a 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php @@ -19,9 +19,9 @@ namespace Doctrine\Common\Persistence; -use Doctrine\Common\Persistence\Mapping\ClassMetadata; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; +use Doctrine\Common\Persistence\Mapping\ClassMetadata; /** * PersistentObject base class that implements getter/setter methods for all mapped fields and associations diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php index dd1ae1b9b697..bc546902e1ba 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php @@ -19,11 +19,11 @@ namespace Doctrine\Common\Proxy; +use Doctrine\Common\Persistence\Mapping\ClassMetadata; use Doctrine\Common\Persistence\Mapping\ClassMetadataFactory; use Doctrine\Common\Proxy\Exception\InvalidArgumentException; use Doctrine\Common\Proxy\Exception\OutOfBoundsException; use Doctrine\Common\Util\ClassUtils; -use Doctrine\Common\Persistence\Mapping\ClassMetadata; /** * Abstract factory for proxy objects. @@ -189,6 +189,8 @@ abstract class AbstractProxyFactory /** * Get a proxy definition for the given class name. * + * @param string $className + * * @return ProxyDefinition */ private function getProxyDefinition($className) @@ -232,13 +234,15 @@ abstract class AbstractProxyFactory * Determine if this class should be skipped during proxy generation. * * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $metadata + * * @return bool */ abstract protected function skipClass(ClassMetadata $metadata); /** + * @param string $className + * * @return ProxyDefinition */ abstract protected function createProxyDefinition($className); } - diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/InvalidArgumentException.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/InvalidArgumentException.php index 24a219430871..dff54d9fd2fa 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/InvalidArgumentException.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/InvalidArgumentException.php @@ -69,6 +69,8 @@ class InvalidArgumentException extends BaseInvalidArgumentException implements P } /** + * @param Proxy $proxy + * * @return self */ public static function unitializedProxyExpected(Proxy $proxy) diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/OutOfBoundsException.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/OutOfBoundsException.php index 348cfcb2579f..3c7415c65789 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/OutOfBoundsException.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/OutOfBoundsException.php @@ -19,7 +19,6 @@ namespace Doctrine\Common\Proxy\Exception; -use Doctrine\Common\Persistence\Proxy; use OutOfBoundsException as BaseOutOfBoundsException; /** diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/UnexpectedValueException.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/UnexpectedValueException.php index 2b8e6386115e..154b91779956 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/UnexpectedValueException.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/UnexpectedValueException.php @@ -31,6 +31,8 @@ use UnexpectedValueException as BaseUnexpectedValueException; class UnexpectedValueException extends BaseUnexpectedValueException implements ProxyException { /** + * @param string $proxyDirectory + * * @return self */ public static function proxyDirectoryNotWritable($proxyDirectory) diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Proxy.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Proxy.php index 83684306a693..bd2b0887478d 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Proxy.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Proxy.php @@ -19,8 +19,8 @@ namespace Doctrine\Common\Proxy; -use Doctrine\Common\Persistence\Proxy as BaseProxy; use Closure; +use Doctrine\Common\Persistence\Proxy as BaseProxy; /** * Interface for proxy classes. diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php index 4c5a239a4a5e..c9d0e2cf96a3 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php @@ -20,9 +20,9 @@ namespace Doctrine\Common\Proxy; use Doctrine\Common\Persistence\Mapping\ClassMetadata; -use Doctrine\Common\Util\ClassUtils; use Doctrine\Common\Proxy\Exception\InvalidArgumentException; use Doctrine\Common\Proxy\Exception\UnexpectedValueException; +use Doctrine\Common\Util\ClassUtils; /** * This factory is used to generate proxy classes. @@ -37,7 +37,7 @@ class ProxyGenerator * Used to match very simple id methods that don't need * to be decorated since the identifier is known. */ - const PATTERN_MATCH_ID_METHOD = '((public\s)?(function\s{1,}%s\s?\(\)\s{1,})\s{0,}{\s{0,}return\s{0,}\$this->%s;\s{0,}})i'; + const PATTERN_MATCH_ID_METHOD = '((public\s+)?(function\s+%s\s*\(\)\s*)\s*{\s*return\s*\$this->%s;\s*})i'; /** * The namespace that contains all proxy classes. @@ -302,6 +302,7 @@ class extends \ implements \getParameters() as $param) { - if ($firstParam) { - $firstParam = false; - } else { - $parameterString .= ', '; - $argumentString .= ', '; - } - - try { - $paramClass = $param->getClass(); - } catch (\ReflectionException $previous) { - throw UnexpectedValueException::invalidParameterTypeHint( - $class->getName(), - $method->getName(), - $param->getName(), - $previous - ); - } - - // We need to pick the type hint class too - if (null !== $paramClass) { - $parameterString .= '\\' . $paramClass->getName() . ' '; - } elseif ($param->isArray()) { - $parameterString .= 'array '; - } elseif (method_exists($param, 'isCallable') && $param->isCallable()) { - $parameterString .= 'callable '; - } - - if ($param->isPassedByReference()) { - $parameterString .= '&'; - } - - $parameters[] = '$' . $param->getName(); - $parameterString .= '$' . $param->getName(); - $argumentString .= '$' . $param->getName(); - - if ($param->isDefaultValueAvailable()) { - $parameterString .= ' = ' . var_export($param->getDefaultValue(), true); - } - } - - $methods .= $parameterString . ')'; + $methods .= $name . '(' . $this->buildParametersString($class, $method, $method->getParameters()) . ')'; $methods .= "\n" . ' {' . "\n"; if ($this->isShortIdentifierGetter($method, $class)) { @@ -837,10 +790,13 @@ EOT; $methods .= ' }' . "\n\n"; } + $invokeParamsString = implode(', ', $this->getParameterNamesForInvoke($method->getParameters())); + $callParamsString = implode(', ', $this->getParameterNamesForParentCall($method->getParameters())); + $methods .= "\n \$this->__initializer__ " . "&& \$this->__initializer__->__invoke(\$this, " . var_export($name, true) - . ", array(" . implode(', ', $parameters) . "));" - . "\n\n return parent::" . $name . '(' . $argumentString . ');' + . ", array(" . $invokeParamsString . "));" + . "\n\n return parent::" . $name . '(' . $callParamsString . ');' . "\n" . ' }' . "\n"; } @@ -928,5 +884,123 @@ EOT; return $properties; } -} + /** + * @param ClassMetadata $class + * @param \ReflectionMethod $method + * @param \ReflectionParameter[] $parameters + * + * @return string + */ + private function buildParametersString(ClassMetadata $class, \ReflectionMethod $method, array $parameters) + { + $parameterDefinitions = array(); + + /* @var $param \ReflectionParameter */ + foreach ($parameters as $param) { + $parameterDefinition = ''; + + if ($parameterType = $this->getParameterType($class, $method, $param)) { + $parameterDefinition .= $parameterType . ' '; + } + + if ($param->isPassedByReference()) { + $parameterDefinition .= '&'; + } + + if (method_exists($param, 'isVariadic')) { + if ($param->isVariadic()) { + $parameterDefinition .= '...'; + } + } + + $parameters[] = '$' . $param->getName(); + $parameterDefinition .= '$' . $param->getName(); + + if ($param->isDefaultValueAvailable()) { + $parameterDefinition .= ' = ' . var_export($param->getDefaultValue(), true); + } + + $parameterDefinitions[] = $parameterDefinition; + } + + return implode(', ', $parameterDefinitions); + } + + /** + * @param ClassMetadata $class + * @param \ReflectionMethod $method + * @param \ReflectionParameter $parameter + * + * @return string|null + */ + private function getParameterType(ClassMetadata $class, \ReflectionMethod $method, \ReflectionParameter $parameter) + { + + // We need to pick the type hint class too + if ($parameter->isArray()) { + return 'array'; + } + + if (method_exists($parameter, 'isCallable') && $parameter->isCallable()) { + return 'callable'; + } + + try { + $parameterClass = $parameter->getClass(); + + if ($parameterClass) { + return '\\' . $parameterClass->getName(); + } + } catch (\ReflectionException $previous) { + throw UnexpectedValueException::invalidParameterTypeHint( + $class->getName(), + $method->getName(), + $parameter->getName(), + $previous + ); + } + + return null; + } + + /** + * @param \ReflectionParameter[] $parameters + * + * @return string[] + */ + private function getParameterNamesForInvoke(array $parameters) + { + return array_map( + function (\ReflectionParameter $parameter) { + return '$' . $parameter->getName(); + }, + $parameters + ); + } + + /** + * @param \ReflectionParameter[] $parameters + * + * @return string[] + */ + private function getParameterNamesForParentCall(array $parameters) + { + return array_map( + function (\ReflectionParameter $parameter) { + $name = ''; + + if (method_exists($parameter, 'isVariadic')) { + if ($parameter->isVariadic()) { + $name .= '...'; + } + } + + $name .= '$' . $parameter->getName(); + + return $name; + }, + $parameters + ); + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/RuntimePublicReflectionProperty.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/RuntimePublicReflectionProperty.php index f155c45d6841..4e8ef5303ab3 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/RuntimePublicReflectionProperty.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/RuntimePublicReflectionProperty.php @@ -19,8 +19,8 @@ namespace Doctrine\Common\Reflection; -use ReflectionProperty; use Doctrine\Common\Proxy\Proxy; +use ReflectionProperty; /** * PHP Runtime Reflection Public Property - special overrides for public properties. diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php index 311e13044e65..8d5380b322ca 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php @@ -19,8 +19,8 @@ namespace Doctrine\Common\Reflection; -use ReflectionMethod; use ReflectionException; +use ReflectionMethod; class StaticReflectionMethod extends ReflectionMethod { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php index aac1f9090efe..922404d987ff 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php @@ -19,8 +19,8 @@ namespace Doctrine\Common\Reflection; -use ReflectionException; use Doctrine\Common\Annotations\TokenParser; +use ReflectionException; /** * Parses a file for namespaces/use/class declarations. diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionProperty.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionProperty.php index 1664822033af..79b40d4a0cae 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionProperty.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionProperty.php @@ -19,8 +19,8 @@ namespace Doctrine\Common\Reflection; -use ReflectionProperty; use ReflectionException; +use ReflectionProperty; class StaticReflectionProperty extends ReflectionProperty { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php index 8f25c9ab20c8..0959ce5d5b5d 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php @@ -48,10 +48,17 @@ final class Debug * @param mixed $var The variable to dump. * @param integer $maxDepth The maximum nesting level for object properties. * @param boolean $stripTags Whether output should strip HTML tags. + * @param boolean $echo Send the dumped value to the output buffer + * + * @return string */ - public static function dump($var, $maxDepth = 2, $stripTags = true) + public static function dump($var, $maxDepth = 2, $stripTags = true, $echo = true) { - ini_set('html_errors', 'On'); + $html = ini_get('html_errors'); + + if ($html !== true) { + ini_set('html_errors', true); + } if (extension_loaded('xdebug')) { ini_set('xdebug.var_display_max_depth', $maxDepth); @@ -61,12 +68,20 @@ final class Debug ob_start(); var_dump($var); + $dump = ob_get_contents(); + ob_end_clean(); - echo ($stripTags ? strip_tags(html_entity_decode($dump)) : $dump); + $dumpText = ($stripTags ? strip_tags(html_entity_decode($dump)) : $dump); - ini_set('html_errors', 'Off'); + ini_set('html_errors', $html); + + if ($echo) { + echo $dumpText; + } + + return $dumpText; } /** diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php index ea1760ad6a6b..80c1fbf76a86 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php @@ -34,7 +34,7 @@ class Version /** * Current Doctrine Version. */ - const VERSION = '2.4.2'; + const VERSION = '2.6.0-DEV'; /** * Compares a Doctrine version with the current one. diff --git a/core/vendor/doctrine/common/phpunit.xml.dist b/core/vendor/doctrine/common/phpunit.xml.dist index b9d3b3401c47..f6fcf84984b5 100644 --- a/core/vendor/doctrine/common/phpunit.xml.dist +++ b/core/vendor/doctrine/common/phpunit.xml.dist @@ -22,10 +22,4 @@ ./lib/Doctrine/ - - - - performance - - diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest.php index 1eb2216b69b7..801a685835b0 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest.php @@ -61,4 +61,73 @@ class ClassLoaderTest extends \Doctrine\Tests\DoctrineTestCase spl_autoload_unregister($additionalLoader); spl_autoload_unregister($silentLoader); } + + public function testClassExistsWhenLoaderIsProtected() + { + require_once __DIR__ . '/ClassLoaderTest/ExternalLoader.php'; + + // Test static call + \ClassLoaderTest\ExternalLoader::registerStatic(); + $this->assertFalse(ClassLoader::classExists('ClassLoaderTest\Class\That\Does\Not\Exist')); + \ClassLoaderTest\ExternalLoader::unregisterStatic(); + + // Test object + $loader = new \ClassLoaderTest\ExternalLoader(); + $loader->register(); + $this->assertFalse(ClassLoader::classExists('ClassLoaderTest\Class\That\Does\Not\Exist')); + $loader->unregister(); + } + + public function testLoadNonExistingClass() + { + $classLoader = new ClassLoader('ClassLoaderTest', __DIR__); + + $this->assertFalse($classLoader->loadClass('ClassLoaderTest\Non\Existing\ClassName')); + } + + public function testLoadFileNotContainingClassClass() + { + $classLoader = new ClassLoader('ClassLoaderTest', __DIR__); + + $classLoader->setFileExtension('.class.php'); + + $this->assertFalse($classLoader->loadClass('ClassLoaderTest\EmptyFile')); + } + + public function testSupportsInterfaceAutoloading() + { + $classLoader = new ClassLoader(); + $classLoader->setIncludePath(__DIR__); + $classLoader->setFileExtension('.class.php'); + $classLoader->setNamespaceSeparator('_'); + + $this->assertTrue($classLoader->loadClass('ClassLoaderTest_InterfaceA')); + $this->assertTrue(interface_exists('ClassLoaderTest_InterfaceA', false)); + } + + public function testSupportsTraitAutoloading() + { + if (! function_exists('trait_exists')) { + $this->markTestSkipped('You need a PHP version that supports traits in order to run this test'); + } + + $classLoader = new ClassLoader(); + $classLoader->setIncludePath(__DIR__); + $classLoader->setFileExtension('.class.php'); + $classLoader->setNamespaceSeparator('_'); + + $this->assertTrue($classLoader->loadClass('ClassLoaderTest_TraitA')); + $this->assertTrue(trait_exists('ClassLoaderTest_TraitA', false)); + } + + public function testMultipleAutoloadRequestsWillProduceSameResult() + { + $classLoader = new ClassLoader(); + $classLoader->setIncludePath(__DIR__); + $classLoader->setFileExtension('.class.php'); + $classLoader->setNamespaceSeparator('_'); + + $this->assertTrue($classLoader->loadClass('ClassLoaderTest_ClassA')); + $this->assertTrue($classLoader->loadClass('ClassLoaderTest_ClassA')); + } } diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest/EmptyFile.class.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest/EmptyFile.class.php new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest/ExternalLoader.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest/ExternalLoader.php new file mode 100644 index 000000000000..782c20860d2d --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest/ExternalLoader.php @@ -0,0 +1,38 @@ +mr = new TestManagerRegistry( + 'ORM', + array('default_connection'), + array('default_manager'), + 'default', + 'default', + 'Doctrine\Common\Persistence\ObjectManagerAware' + ); + } + + public function testGetManagerForClass() + { + $this->mr->getManagerForClass('Doctrine\Tests\Common\Persistence\TestObject'); + } + + public function testGetManagerForInvalidClass() + { + $this->setExpectedException( + 'ReflectionException', + 'Class Doctrine\Tests\Common\Persistence\TestObjectInexistent does not exist' + ); + + $this->mr->getManagerForClass('prefix:TestObjectInexistent'); + } + + public function testGetManagerForAliasedClass() + { + $this->mr->getManagerForClass('prefix:TestObject'); + } + + public function testGetManagerForInvalidAliasedClass() + { + $this->setExpectedException( + 'ReflectionException', + 'Class Doctrine\Tests\Common\Persistence\TestObject:Foo does not exist' + ); + + $this->mr->getManagerForClass('prefix:TestObject:Foo'); + } +} + +class TestManager extends PHPUnit_Framework_TestCase +{ + public function getMetadataFactory() + { + $driver = $this->getMock('Doctrine\Common\Persistence\Mapping\Driver\MappingDriver'); + $metadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata'); + + return new TestClassMetadataFactory($driver, $metadata); + } +} + +class TestManagerRegistry extends AbstractManagerRegistry +{ + protected function getService($name) + { + return new TestManager(); + } + + /** + * {@inheritdoc} + */ + protected function resetService($name) + { + + } + + public function getAliasNamespace($alias) + { + return __NAMESPACE__; + } +} \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ClassMetadataFactoryTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ClassMetadataFactoryTest.php index c5a457f6820f..b3815de97cd8 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ClassMetadataFactoryTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ClassMetadataFactoryTest.php @@ -78,11 +78,58 @@ class ClassMetadataFactoryTest extends DoctrineTestCase public function testGetAliasedMetadata() { - $loadedMetadata = $this->cmf->getMetadataFor('prefix:ChildEntity'); + $this->cmf->getMetadataFor('prefix:ChildEntity'); $this->assertTrue($this->cmf->hasMetadataFor(__NAMESPACE__ . '\ChildEntity')); $this->assertTrue($this->cmf->hasMetadataFor('prefix:ChildEntity')); } + + /** + * @group DCOM-270 + */ + public function testGetInvalidAliasedMetadata() + { + $this->setExpectedException( + 'Doctrine\Common\Persistence\Mapping\MappingException', + 'Class \'Doctrine\Tests\Common\Persistence\Mapping\ChildEntity:Foo\' does not exist' + ); + + $this->cmf->getMetadataFor('prefix:ChildEntity:Foo'); + } + + /** + * @group DCOM-270 + */ + public function testClassIsTransient() + { + $this->assertTrue($this->cmf->isTransient('prefix:ChildEntity:Foo')); + } + + public function testWillFallbackOnNotLoadedMetadata() + { + $classMetadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata'); + + $this->cmf->fallbackCallback = function () use ($classMetadata) { + return $classMetadata; + }; + + $this->cmf->metadata = null; + + $this->assertSame($classMetadata, $this->cmf->getMetadataFor('Foo')); + } + + public function testWillFailOnFallbackFailureWithNotLoadedMetadata() + { + $this->cmf->fallbackCallback = function () { + return null; + }; + + $this->cmf->metadata = null; + + $this->setExpectedException('Doctrine\Common\Persistence\Mapping\MappingException'); + + $this->cmf->getMetadataFor('Foo'); + } } class TestClassMetadataFactory extends AbstractClassMetadataFactory @@ -90,6 +137,9 @@ class TestClassMetadataFactory extends AbstractClassMetadataFactory public $driver; public $metadata; + /** @var callable|null */ + public $fallbackCallback; + public function __construct($driver, $metadata) { $this->driver = $driver; @@ -132,6 +182,20 @@ class TestClassMetadataFactory extends AbstractClassMetadataFactory { return true; } + + protected function onNotFoundMetadata($className) + { + if (! $fallback = $this->fallbackCallback) { + return null; + } + + return $fallback(); + } + + public function isTransient($class) + { + return true; + } } class RootEntity diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/SymfonyFileLocatorTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/SymfonyFileLocatorTest.php index b51162e6886a..e79b8f45d93f 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/SymfonyFileLocatorTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/SymfonyFileLocatorTest.php @@ -62,6 +62,91 @@ class SymfonyFileLocatorTest extends DoctrineTestCase $this->assertEquals(array("Foo\\stdClass"), $locator->getAllClassNames("global")); } + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Namespace separator should not be empty + */ + public function testInvalidCustomNamespaceSeparator() + { + $path = __DIR__ . "/_files"; + $prefix = "Foo"; + + new SymfonyFileLocator(array($path => $prefix), ".yml", null); + } + + public function customNamespaceSeparatorProvider() + { + return array( + 'directory separator' => array(DIRECTORY_SEPARATOR, "/_custom_ns/dir"), + 'default dot separator' => array('.', "/_custom_ns/dot"), + ); + } + + /** + * @dataProvider customNamespaceSeparatorProvider + * + * @param $separator string Directory separator to test against + * @param $dir string Path to load mapping data from + * + * @throws \Doctrine\Common\Persistence\Mapping\MappingException + */ + public function testGetClassNamesWithCustomNsSeparator($separator, $dir) + { + $path = __DIR__ . $dir; + $prefix = "Foo"; + + $locator = new SymfonyFileLocator(array($path => $prefix), ".yml", $separator); + $classes = $locator->getAllClassNames(null); + sort($classes); + + $this->assertEquals(array("Foo\\stdClass", "Foo\\sub\\subClass", "Foo\\sub\\subsub\\subSubClass"), $classes); + } + + public function customNamespaceLookupQueryProvider() + { + return array( + 'directory separator' => array( + DIRECTORY_SEPARATOR, + "/_custom_ns/dir", + array( + "stdClass.yml" => "Foo\\stdClass", + "sub/subClass.yml" => "Foo\\sub\\subClass", + "sub/subsub/subSubClass.yml" => "Foo\\sub\\subsub\\subSubClass", + ) + ), + 'default dot separator' => array( + '.', + "/_custom_ns/dot", + array( + "stdClass.yml" => "Foo\\stdClass", + "sub.subClass.yml" => "Foo\\sub\\subClass", + "sub.subsub.subSubClass.yml" => "Foo\\sub\\subsub\\subSubClass", + ) + ), + ); + } + + /** @dataProvider customNamespaceLookupQueryProvider + * @param $separator string Directory separator to test against + * @param $dir string Path to load mapping data from + * @param $files array Files to lookup classnames + * + * @throws \Doctrine\Common\Persistence\Mapping\MappingException + */ + public function testFindMappingFileWithCustomNsSeparator($separator, $dir, $files) + { + $path = __DIR__ . $dir; + $prefix = "Foo"; + + $locator = new SymfonyFileLocator(array($path => $prefix), ".yml", $separator); + + foreach ($files as $filePath => $className) { + $this->assertEquals(realpath($path .'/'. $filePath), realpath($locator->findMappingFile($className))); + } + + } + + public function testFindMappingFile() { $path = __DIR__ . "/_files"; diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dir/stdClass.yml b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dir/stdClass.yml new file mode 100644 index 000000000000..9daeafb9864c --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dir/stdClass.yml @@ -0,0 +1 @@ +test diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dir/sub/subClass.yml b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dir/sub/subClass.yml new file mode 100644 index 000000000000..9daeafb9864c --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dir/sub/subClass.yml @@ -0,0 +1 @@ +test diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dir/sub/subsub/subSubClass.yml b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dir/sub/subsub/subSubClass.yml new file mode 100644 index 000000000000..9daeafb9864c --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dir/sub/subsub/subSubClass.yml @@ -0,0 +1 @@ +test diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dot/stdClass.yml b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dot/stdClass.yml new file mode 100644 index 000000000000..9daeafb9864c --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dot/stdClass.yml @@ -0,0 +1 @@ +test diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dot/sub.subClass.yml b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dot/sub.subClass.yml new file mode 100644 index 000000000000..9daeafb9864c --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dot/sub.subClass.yml @@ -0,0 +1 @@ +test diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dot/sub.subsub.subSubClass.yml b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dot/sub.subsub.subSubClass.yml new file mode 100644 index 000000000000..9daeafb9864c --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/_custom_ns/dot/sub.subsub.subSubClass.yml @@ -0,0 +1 @@ +test diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyClassGeneratorTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyClassGeneratorTest.php index 45d45e5d6a37..5de83a180b1f 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyClassGeneratorTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyClassGeneratorTest.php @@ -163,6 +163,27 @@ class ProxyClassGeneratorTest extends PHPUnit_Framework_TestCase $this->assertEquals(1, substr_count($classCode, 'call(callable $foo)')); } + public function testClassWithVariadicArgumentOnProxiedMethod() + { + if (PHP_VERSION_ID < 50600) { + $this->markTestSkipped('`...` is only supported in PHP >=5.6.0'); + } + + if (!class_exists('Doctrine\Tests\Common\ProxyProxy\__CG__\VariadicTypeHintClass', false)) { + $className = 'Doctrine\Tests\Common\Proxy\VariadicTypeHintClass'; + $metadata = $this->createClassMetadata($className, array('id')); + + $proxyGenerator = new ProxyGenerator(__DIR__ . '/generated', __NAMESPACE__ . 'Proxy', true); + $this->generateAndRequire($proxyGenerator, $metadata); + } + + $classCode = file_get_contents(__DIR__ . '/generated/__CG__DoctrineTestsCommonProxyVariadicTypeHintClass.php'); + + $this->assertEquals(1, substr_count($classCode, 'function addType(...$types)')); + $this->assertEquals(1, substr_count($classCode, '__invoke($this, \'addType\', array($types))')); + $this->assertEquals(1, substr_count($classCode, 'parent::addType(...$types)')); + } + public function testClassWithInvalidTypeHintOnProxiedMethod() { $className = 'Doctrine\Tests\Common\Proxy\InvalidTypeHintClass'; diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php index 9a5173c1db26..c97ac79f27b4 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php @@ -591,6 +591,62 @@ class ProxyLogicTest extends PHPUnit_Framework_TestCase $this->assertSame('newPersistentFieldValue', $this->lazyObject->publicPersistentField); } + public function testCallingVariadicMethodCausesLazyLoading() + { + if (PHP_VERSION_ID < 50600) { + $this->markTestSkipped('Test applies only to PHP 5.6+'); + } + + $proxyClassName = 'Doctrine\Tests\Common\ProxyProxy\__CG__\Doctrine\Tests\Common\Proxy\VariadicTypeHintClass'; + + /* @var $metadata \Doctrine\Common\Persistence\Mapping\ClassMetadata|\PHPUnit_Framework_MockObject_MockObject */ + $metadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata'); + + $metadata + ->expects($this->any()) + ->method('getName') + ->will($this->returnValue('Doctrine\Tests\Common\Proxy\VariadicTypeHintClass')); + $metadata + ->expects($this->any()) + ->method('getReflectionClass') + ->will($this->returnValue(new \ReflectionClass('Doctrine\Tests\Common\Proxy\VariadicTypeHintClass'))); + + // creating the proxy class + if (!class_exists($proxyClassName, false)) { + $proxyGenerator = new ProxyGenerator(__DIR__ . '/generated', __NAMESPACE__ . 'Proxy', true); + $proxyGenerator->generateProxyClass($metadata); + require_once $proxyGenerator->getProxyFileName($metadata->getName()); + } + + /* @var $invocationMock callable|\PHPUnit_Framework_MockObject_MockObject */ + $invocationMock = $this->getMock('stdClass', array('__invoke')); + + /* @var $lazyObject \Doctrine\Tests\Common\Proxy\VariadicTypeHintClass */ + $lazyObject = new $proxyClassName( + function ($proxy, $method, $parameters) use ($invocationMock) { + $invocationMock($proxy, $method, $parameters); + }, + function () {} + ); + + $invocationMock + ->expects($this->at(0)) + ->method('__invoke') + ->with($lazyObject, 'addType', array(array('type1', 'type2'))); + $invocationMock + ->expects($this->at(1)) + ->method('__invoke') + ->with($lazyObject, 'addTypeWithMultipleParameters', array('foo', 'bar', array('baz1', 'baz2'))); + + $lazyObject->addType('type1', 'type2'); + $this->assertSame(array('type1', 'type2'), $lazyObject->types); + + $lazyObject->addTypeWithMultipleParameters('foo', 'bar', 'baz1', 'baz2'); + $this->assertSame('foo', $lazyObject->foo); + $this->assertSame('bar', $lazyObject->bar); + $this->assertSame(array('baz1', 'baz2'), $lazyObject->baz); + } + /** * Converts a given callable into a closure * diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/VariadicTypeHintClass.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/VariadicTypeHintClass.php new file mode 100644 index 000000000000..3333d177acf6 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/VariadicTypeHintClass.php @@ -0,0 +1,29 @@ +types = $types; + } + + public function addTypeWithMultipleParameters($foo, $bar, ...$baz) + { + $this->foo = $foo; + $this->bar = $bar; + $this->baz = $baz; + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Util/DebugTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Util/DebugTest.php index f6fc069772d7..66e83376f9d1 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Util/DebugTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Util/DebugTest.php @@ -37,4 +37,29 @@ class DebugTest extends DoctrineTestCase $var = Debug::export($it, 5); $this->assertContains('foobar', $var->__STORAGE__); } + + public function testReturnsOutput() + { + ob_start(); + + $dump = Debug::dump('foo'); + $outputValue = ob_get_contents(); + + ob_end_clean(); + + $this->assertSame($outputValue, $dump); + } + + public function testDisablesOutput() + { + ob_start(); + + $dump = Debug::dump('foo', 2, true, false); + $outputValue = ob_get_contents(); + + ob_end_clean(); + + $this->assertEmpty($outputValue); + $this->assertNotSame($outputValue, $dump); + } } diff --git a/core/vendor/doctrine/annotations/.gitignore b/core/vendor/doctrine/inflector/.gitignore similarity index 75% rename from core/vendor/doctrine/annotations/.gitignore rename to core/vendor/doctrine/inflector/.gitignore index 164c3466290a..f2cb7f83eee2 100644 --- a/core/vendor/doctrine/annotations/.gitignore +++ b/core/vendor/doctrine/inflector/.gitignore @@ -1,3 +1,4 @@ vendor/ composer.lock composer.phar +phpunit.xml diff --git a/core/vendor/doctrine/annotations/.travis.yml b/core/vendor/doctrine/inflector/.travis.yml similarity index 50% rename from core/vendor/doctrine/annotations/.travis.yml rename to core/vendor/doctrine/inflector/.travis.yml index 7f6c0efe4570..6b1d8ffd8ef4 100644 --- a/core/vendor/doctrine/annotations/.travis.yml +++ b/core/vendor/doctrine/inflector/.travis.yml @@ -7,5 +7,5 @@ php: - 5.6 - hhvm -before_script: - - composer --prefer-source --dev install +install: + - composer --prefer-source install diff --git a/core/vendor/doctrine/inflector/LICENSE b/core/vendor/doctrine/inflector/LICENSE new file mode 100644 index 000000000000..5e781fce4bb5 --- /dev/null +++ b/core/vendor/doctrine/inflector/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2006-2013 Doctrine Project + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/core/vendor/doctrine/inflector/README.md b/core/vendor/doctrine/inflector/README.md index f2d18d0f165f..acb55a014bd7 100644 --- a/core/vendor/doctrine/inflector/README.md +++ b/core/vendor/doctrine/inflector/README.md @@ -2,3 +2,5 @@ Doctrine Inflector is a small library that can perform string manipulations with regard to upper-/lowercase and singular/plural forms of words. + +[![Build Status](https://travis-ci.org/doctrine/inflector.svg?branch=master)](https://travis-ci.org/doctrine/inflector) diff --git a/core/vendor/doctrine/inflector/composer.json b/core/vendor/doctrine/inflector/composer.json index 3d3c3f90f35a..a29c68cfb798 100644 --- a/core/vendor/doctrine/inflector/composer.json +++ b/core/vendor/doctrine/inflector/composer.json @@ -2,7 +2,7 @@ "name": "doctrine/inflector", "type": "library", "description": "Common String Manipulations with regard to casing and singular/plural rules.", - "keywords": ["string", "inflection", "singuarlize", "pluarlize"], + "keywords": ["string", "inflection", "singularize", "pluralize"], "homepage": "http://www.doctrine-project.org", "license": "MIT", "authors": [ @@ -15,7 +15,15 @@ "require": { "php": ">=5.3.2" }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, "autoload": { "psr-0": { "Doctrine\\Common\\Inflector\\": "lib/" } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } } } diff --git a/core/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php b/core/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php index f4e38e765f73..b007b2179491 100644 --- a/core/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php +++ b/core/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php @@ -20,23 +20,23 @@ namespace Doctrine\Common\Inflector; /** - * Doctrine inflector has static methods for inflecting text + * Doctrine inflector has static methods for inflecting text. * * The methods in these classes are from several different sources collected * across several different php projects and several different authors. The * original author names and emails are not known. * - * Plurialize & Singularize implementation are borrowed from CakePHP with some modifications. + * Pluralize & Singularize implementation are borrowed from CakePHP with some modifications. * - * @link www.doctrine-project.org - * @since 1.0 - * @author Konsta Vesterinen - * @author Jonathan H. Wage + * @link www.doctrine-project.org + * @since 1.0 + * @author Konsta Vesterinen + * @author Jonathan H. Wage */ class Inflector { /** - * Plural inflector rules + * Plural inflector rules. * * @var array */ @@ -77,11 +77,13 @@ class Inflector 'cookie' => 'cookies', 'corpus' => 'corpuses', 'cow' => 'cows', + 'criteria' => 'criterion', 'ganglion' => 'ganglions', 'genie' => 'genies', 'genus' => 'genera', 'graffito' => 'graffiti', 'hoof' => 'hoofs', + 'human' => 'humans', 'loaf' => 'loaves', 'man' => 'men', 'money' => 'monies', @@ -100,12 +102,12 @@ class Inflector 'soliloquy' => 'soliloquies', 'testis' => 'testes', 'trilby' => 'trilbys', - 'turf' => 'turfs' + 'turf' => 'turfs', ) ); /** - * Singular inflector rules + * Singular inflector rules. * * @var array */ @@ -144,20 +146,28 @@ class Inflector '/(n)ews$/i' => '\1\2ews', '/eaus$/' => 'eau', '/^(.*us)$/' => '\\1', - '/s$/i' => '' + '/s$/i' => '', ), 'uninflected' => array( - '.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox', '.*sheep', '.*ss' + '.*[nrlm]ese', + '.*deer', + '.*fish', + '.*measles', + '.*ois', + '.*pox', + '.*sheep', + '.*ss', ), 'irregular' => array( + 'criterion' => 'criteria', + 'curves' => 'curve', 'foes' => 'foe', 'waves' => 'wave', - 'curves' => 'curve' ) ); /** - * Words that should not be inflected + * Words that should not be inflected. * * @var array */ @@ -171,9 +181,9 @@ class Inflector 'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese', 'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'pliers', 'Portuguese', 'proceedings', 'rabies', 'rice', 'rhinoceros', 'salmon', 'Sarawakese', 'scissors', - 'sea[- ]bass', 'series', 'Shavese', 'shears', 'siemens', 'species', 'swine', 'testes', - 'trousers', 'trout', 'tuna', 'Vermontese', 'Wenchowese', 'whiting', 'wildebeest', - 'Yengeese' + 'sea[- ]bass', 'series', 'Shavese', 'shears', 'siemens', 'species', 'staff', 'swine', + 'testes', 'trousers', 'trout', 'tuna', 'Vermontese', 'Wenchowese', 'whiting', + 'wildebeest', 'Yengeese' ); /** @@ -191,10 +201,11 @@ class Inflector private static $initialState = array(); /** - * Convert word in to the format for a Doctrine table name. Converts 'ModelName' to 'model_name' + * Converts a word into the format for a Doctrine table name. Converts 'ModelName' to 'model_name'. * - * @param string $word Word to tableize - * @return string $word Tableized word + * @param string $word The word to tableize. + * + * @return string The tableized word. */ public static function tableize($word) { @@ -202,10 +213,11 @@ class Inflector } /** - * Convert a word in to the format for a Doctrine class name. Converts 'table_name' to 'TableName' + * Converts a word into the format for a Doctrine class name. Converts 'table_name' to 'TableName'. * - * @param string $word Word to classify - * @return string $word Classified word + * @param string $word The word to classify. + * + * @return string The classified word. */ public static function classify($word) { @@ -213,10 +225,11 @@ class Inflector } /** - * Camelize a word. This uses the classify() method and turns the first character to lowercase + * Camelizes a word. This uses the classify() method and turns the first character to lowercase. * - * @param string $word - * @return string $word + * @param string $word The word to camelize. + * + * @return string The camelized word. */ public static function camelize($word) { @@ -224,7 +237,7 @@ class Inflector } /** - * Clears Inflectors inflected value caches. And resets the inflection + * Clears Inflectors inflected value caches, and resets the inflection * rules to the initial values. * * @return void @@ -233,8 +246,10 @@ class Inflector { if (empty(self::$initialState)) { self::$initialState = get_class_vars('Inflector'); + return; } + foreach (self::$initialState as $key => $val) { if ($key != 'initialState') { self::${$key} = $val; @@ -256,44 +271,50 @@ class Inflector * )); * }}} * - * @param string $type The type of inflection, either 'plural' or 'singular' - * @param array $rules Array of rules to be added. + * @param string $type The type of inflection, either 'plural' or 'singular' + * @param array $rules An array of rules to be added. * @param boolean $reset If true, will unset default inflections for all - * new rules that are being defined in $rules. + * new rules that are being defined in $rules. + * * @return void */ public static function rules($type, $rules, $reset = false) { foreach ($rules as $rule => $pattern) { - if (is_array($pattern)) { - if ($reset) { - self::${$type}[$rule] = $pattern; - } else { - if ($rule === 'uninflected') { - self::${$type}[$rule] = array_merge($pattern, self::${$type}[$rule]); - } else { - self::${$type}[$rule] = $pattern + self::${$type}[$rule]; - } - } - unset($rules[$rule], self::${$type}['cache' . ucfirst($rule)]); - if (isset(self::${$type}['merged'][$rule])) { - unset(self::${$type}['merged'][$rule]); - } - if ($type === 'plural') { - self::$cache['pluralize'] = self::$cache['tableize'] = array(); - } elseif ($type === 'singular') { - self::$cache['singularize'] = array(); - } + if ( ! is_array($pattern)) { + continue; + } + + if ($reset) { + self::${$type}[$rule] = $pattern; + } else { + self::${$type}[$rule] = ($rule === 'uninflected') + ? array_merge($pattern, self::${$type}[$rule]) + : $pattern + self::${$type}[$rule]; + } + + unset($rules[$rule], self::${$type}['cache' . ucfirst($rule)]); + + if (isset(self::${$type}['merged'][$rule])) { + unset(self::${$type}['merged'][$rule]); + } + + if ($type === 'plural') { + self::$cache['pluralize'] = self::$cache['tableize'] = array(); + } elseif ($type === 'singular') { + self::$cache['singularize'] = array(); } } + self::${$type}['rules'] = $rules + self::${$type}['rules']; } /** - * Return $word in plural form. + * Returns a word in plural form. * - * @param string $word Word in singular - * @return string Word in plural + * @param string $word The word in singular form. + * + * @return string The word in plural form. */ public static function pluralize($word) { @@ -311,32 +332,36 @@ class Inflector if (!isset(self::$plural['cacheUninflected']) || !isset(self::$plural['cacheIrregular'])) { self::$plural['cacheUninflected'] = '(?:' . implode('|', self::$plural['merged']['uninflected']) . ')'; - self::$plural['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$plural['merged']['irregular'])) . ')'; + self::$plural['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$plural['merged']['irregular'])) . ')'; } if (preg_match('/(.*)\\b(' . self::$plural['cacheIrregular'] . ')$/i', $word, $regs)) { self::$cache['pluralize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$plural['merged']['irregular'][strtolower($regs[2])], 1); + return self::$cache['pluralize'][$word]; } if (preg_match('/^(' . self::$plural['cacheUninflected'] . ')$/i', $word, $regs)) { self::$cache['pluralize'][$word] = $word; + return $word; } foreach (self::$plural['rules'] as $rule => $replacement) { if (preg_match($rule, $word)) { self::$cache['pluralize'][$word] = preg_replace($rule, $replacement, $word); + return self::$cache['pluralize'][$word]; } } } /** - * Return $word in singular form. + * Returns a word in singular form. * - * @param string $word Word in plural - * @return string Word in singular + * @param string $word The word in plural form. + * + * @return string The word in singular form. */ public static function singularize($word) { @@ -365,21 +390,26 @@ class Inflector if (preg_match('/(.*)\\b(' . self::$singular['cacheIrregular'] . ')$/i', $word, $regs)) { self::$cache['singularize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$singular['merged']['irregular'][strtolower($regs[2])], 1); + return self::$cache['singularize'][$word]; } if (preg_match('/^(' . self::$singular['cacheUninflected'] . ')$/i', $word, $regs)) { self::$cache['singularize'][$word] = $word; + return $word; } foreach (self::$singular['rules'] as $rule => $replacement) { if (preg_match($rule, $word)) { self::$cache['singularize'][$word] = preg_replace($rule, $replacement, $word); + return self::$cache['singularize'][$word]; } } + self::$cache['singularize'][$word] = $word; + return $word; } } diff --git a/core/vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php b/core/vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php index 487c2cd449bd..a8a075daa7c7 100644 --- a/core/vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php +++ b/core/vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php @@ -7,14 +7,15 @@ use Doctrine\Common\Inflector\Inflector; class InflectorTest extends DoctrineTestCase { - /** * Singular & Plural test data. Returns an array of sample words. * * @return array */ - public function dataSampleWords() { + public function dataSampleWords() + { Inflector::reset(); + // in the format array('singular', 'plural') return array( array('categoria', 'categorias'), @@ -57,6 +58,9 @@ class InflectorTest extends DoctrineTestCase array('roof', 'roofs'), array('foe', 'foes'), array('cookie', 'cookies'), + array('identity', 'identities'), + array('criteria', 'criterion'), + array('curve', 'curves'), array('', ''), ); } @@ -67,8 +71,13 @@ class InflectorTest extends DoctrineTestCase * @dataProvider dataSampleWords * @return void */ - public function testInflectingSingulars($singular, $plural) { - $this->assertEquals($singular, Inflector::singularize($plural), "'$plural' should be singularized to '$singular'"); + public function testInflectingSingulars($singular, $plural) + { + $this->assertEquals( + $singular, + Inflector::singularize($plural), + "'$plural' should be singularized to '$singular'" + ); } /** @@ -77,8 +86,13 @@ class InflectorTest extends DoctrineTestCase * @dataProvider dataSampleWords * @return void */ - public function testInflectingPlurals($singular, $plural) { - $this->assertEquals($plural, Inflector::pluralize($singular), "'$singular' should be pluralized to '$plural'"); + public function testInflectingPlurals($singular, $plural) + { + $this->assertEquals( + $plural, + Inflector::pluralize($singular), + "'$singular' should be pluralized to '$plural'" + ); } /** @@ -86,12 +100,15 @@ class InflectorTest extends DoctrineTestCase * * @return void */ - public function testCustomPluralRule() { + public function testCustomPluralRule() + { Inflector::reset(); Inflector::rules('plural', array('/^(custom)$/i' => '\1izables')); + $this->assertEquals(Inflector::pluralize('custom'), 'customizables'); Inflector::rules('plural', array('uninflected' => array('uninflectable'))); + $this->assertEquals(Inflector::pluralize('uninflectable'), 'uninflectable'); Inflector::rules('plural', array( @@ -99,6 +116,7 @@ class InflectorTest extends DoctrineTestCase 'uninflected' => array('noflect', 'abtuse'), 'irregular' => array('amaze' => 'amazable', 'phone' => 'phonezes') )); + $this->assertEquals(Inflector::pluralize('noflect'), 'noflect'); $this->assertEquals(Inflector::pluralize('abtuse'), 'abtuse'); $this->assertEquals(Inflector::pluralize('alert'), 'alertables'); @@ -111,7 +129,8 @@ class InflectorTest extends DoctrineTestCase * * @return void */ - public function testCustomSingularRule() { + public function testCustomSingularRule() + { Inflector::reset(); Inflector::rules('singular', array('/(eple)r$/i' => '\1', '/(jente)r$/i' => '\1')); @@ -135,20 +154,24 @@ class InflectorTest extends DoctrineTestCase * * @return void */ - public function testRulesClearsCaches() { + public function testRulesClearsCaches() + { Inflector::reset(); + $this->assertEquals(Inflector::singularize('Bananas'), 'Banana'); $this->assertEquals(Inflector::pluralize('Banana'), 'Bananas'); Inflector::rules('singular', array( 'rules' => array('/(.*)nas$/i' => '\1zzz') )); + $this->assertEquals('Banazzz', Inflector::singularize('Bananas'), 'Was inflected with old rules.'); Inflector::rules('plural', array( 'rules' => array('/(.*)na$/i' => '\1zzz'), 'irregular' => array('corpus' => 'corpora') )); + $this->assertEquals(Inflector::pluralize('Banana'), 'Banazzz', 'Was inflected with old rules.'); $this->assertEquals(Inflector::pluralize('corpus'), 'corpora', 'Was inflected with old irregular form.'); } @@ -158,8 +181,10 @@ class InflectorTest extends DoctrineTestCase * * @return void */ - public function testCustomRuleWithReset() { + public function testCustomRuleWithReset() + { Inflector::reset(); + $uninflected = array('atlas', 'lapis', 'onibus', 'pires', 'virus', '.*x'); $pluralIrregular = array('as' => 'ases'); diff --git a/core/vendor/doctrine/instantiator/.gitignore b/core/vendor/doctrine/instantiator/.gitignore index 9a639322c557..e3e368dd9d58 100644 --- a/core/vendor/doctrine/instantiator/.gitignore +++ b/core/vendor/doctrine/instantiator/.gitignore @@ -2,4 +2,4 @@ phpunit.xml composer.lock build vendor -coverage.clover \ No newline at end of file +coverage.clover diff --git a/core/vendor/doctrine/instantiator/.travis.install.sh b/core/vendor/doctrine/instantiator/.travis.install.sh index e4f1cb2db82d..2819188c936a 100755 --- a/core/vendor/doctrine/instantiator/.travis.install.sh +++ b/core/vendor/doctrine/instantiator/.travis.install.sh @@ -1,3 +1,4 @@ +#!/bin/sh set -x if [ "$TRAVIS_PHP_VERSION" = 'hhvm' ] || [ "$TRAVIS_PHP_VERSION" = 'hhvm-nightly' ] ; then curl -sS https://getcomposer.org/installer > composer-installer.php diff --git a/core/vendor/doctrine/instantiator/.travis.yml b/core/vendor/doctrine/instantiator/.travis.yml index 0f686a9c7269..7f1ec5f98d3d 100644 --- a/core/vendor/doctrine/instantiator/.travis.yml +++ b/core/vendor/doctrine/instantiator/.travis.yml @@ -7,20 +7,16 @@ php: - 5.5 - 5.6 - hhvm - - hhvm-nightly before_script: - ./.travis.install.sh + - if [ $TRAVIS_PHP_VERSION = '5.6' ]; then PHPUNIT_FLAGS="--coverage-clover coverage.clover"; else PHPUNIT_FLAGS=""; fi script: - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.3.3' ]; then phpunit; fi" - - sh -c "if [ '$TRAVIS_PHP_VERSION' != '5.3.3' ]; then ./vendor/bin/phpunit; fi" - - sh -c "if [ '$TRAVIS_PHP_VERSION' != '5.3.3' ]; then ./vendor/bin/phpcs --standard=PSR2 ./src/ ./tests/; fi" - - sh -c "if [[ '$TRAVIS_PHP_VERSION' != '5.3.3' && '$TRAVIS_PHP_VERSION' != '5.4.29' && '$TRAVIS_PHP_VERSION' != '5.5.13' ]]; then php -n ./vendor/bin/athletic -p ./tests/DoctrineTest/InstantiatorPerformance/ -f GroupedFormatter; fi" + - if [ $TRAVIS_PHP_VERSION = '5.3.3' ]; then phpunit; fi + - if [ $TRAVIS_PHP_VERSION != '5.3.3' ]; then ./vendor/bin/phpunit $PHPUNIT_FLAGS; fi + - if [ $TRAVIS_PHP_VERSION != '5.3.3' ]; then ./vendor/bin/phpcs --standard=PSR2 ./src/ ./tests/; fi + - if [[ $TRAVIS_PHP_VERSION != '5.3.3' && $TRAVIS_PHP_VERSION != '5.4.29' && $TRAVIS_PHP_VERSION != '5.5.13' ]]; then php -n ./vendor/bin/athletic -p ./tests/DoctrineTest/InstantiatorPerformance/ -f GroupedFormatter; fi after_script: - - sh -c "if [ '$TRAVIS_PHP_VERSION' != '5.3.3' ]; then wget https://scrutinizer-ci.com/ocular.phar; php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi" - -matrix: - allow_failures: - - php: hhvm-nightly + - if [ $TRAVIS_PHP_VERSION = '5.6' ]; then wget https://scrutinizer-ci.com/ocular.phar; php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi diff --git a/core/vendor/doctrine/instantiator/composer.json b/core/vendor/doctrine/instantiator/composer.json index 89d59f600d31..4823890b4c70 100644 --- a/core/vendor/doctrine/instantiator/composer.json +++ b/core/vendor/doctrine/instantiator/composer.json @@ -22,12 +22,12 @@ "ext-phar": "*", "ext-pdo": "*", "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "2.0.*@ALPHA", + "squizlabs/php_codesniffer": "~2.0", "athletic/athletic": "~0.1.8" }, "autoload": { - "psr-0": { - "Doctrine\\Instantiator\\": "src" + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" } }, "autoload-dev": { diff --git a/core/vendor/doctrine/instantiator/phpunit.xml.dist b/core/vendor/doctrine/instantiator/phpunit.xml.dist index 178ba17fe42b..0a8d5709b7ea 100644 --- a/core/vendor/doctrine/instantiator/phpunit.xml.dist +++ b/core/vendor/doctrine/instantiator/phpunit.xml.dist @@ -19,7 +19,4 @@ ./src - - - diff --git a/core/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php b/core/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php index 98868cfa1956..6d5b3b656750 100644 --- a/core/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php +++ b/core/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php @@ -65,11 +65,22 @@ final class Instantiator implements InstantiatorInterface return $factory(); } - $factory = self::$cachedInstantiators[$className] = $this->buildFactory($className); - $instance = $factory(); - $reflection = new ReflectionClass($instance); + return $this->buildAndCacheFromFactory($className); + } - if ($this->isSafeToClone($reflection)) { + /** + * Builds the requested object and caches it in static properties for performance + * + * @param string $className + * + * @return object + */ + private function buildAndCacheFromFactory($className) + { + $factory = self::$cachedInstantiators[$className] = $this->buildFactory($className); + $instance = $factory(); + + if ($this->isSafeToClone(new ReflectionClass($instance))) { self::$cachedCloneables[$className] = clone $instance; } @@ -77,19 +88,14 @@ final class Instantiator implements InstantiatorInterface } /** - * @internal - * @private - * * Builds a {@see \Closure} capable of instantiating the given $className without * invoking its constructor. - * This method is only exposed as public because of PHP 5.3 compatibility. Do not - * use this method in your own code * * @param string $className * * @return Closure */ - public function buildFactory($className) + private function buildFactory($className) { $reflectionClass = $this->getReflectionClass($className); @@ -106,7 +112,7 @@ final class Instantiator implements InstantiatorInterface $className ); - $this->attemptInstantiationViaUnSerialization($reflectionClass, $serializedString); + $this->checkIfUnSerializationIsSupported($reflectionClass, $serializedString); return function () use ($serializedString) { return unserialize($serializedString); @@ -143,7 +149,7 @@ final class Instantiator implements InstantiatorInterface * * @return void */ - private function attemptInstantiationViaUnSerialization(ReflectionClass $reflectionClass, $serializedString) + private function checkIfUnSerializationIsSupported(ReflectionClass $reflectionClass, $serializedString) { set_error_handler(function ($code, $message, $file, $line) use ($reflectionClass, & $error) { $error = UnexpectedValueException::fromUncleanUnSerialization( @@ -155,6 +161,25 @@ final class Instantiator implements InstantiatorInterface ); }); + $this->attemptInstantiationViaUnSerialization($reflectionClass, $serializedString); + + restore_error_handler(); + + if ($error) { + throw $error; + } + } + + /** + * @param ReflectionClass $reflectionClass + * @param string $serializedString + * + * @throws UnexpectedValueException + * + * @return void + */ + private function attemptInstantiationViaUnSerialization(ReflectionClass $reflectionClass, $serializedString) + { try { unserialize($serializedString); } catch (Exception $exception) { @@ -162,12 +187,6 @@ final class Instantiator implements InstantiatorInterface throw UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $exception); } - - restore_error_handler(); - - if ($error) { - throw $error; - } } /** @@ -178,7 +197,7 @@ final class Instantiator implements InstantiatorInterface private function isInstantiableViaReflection(ReflectionClass $reflectionClass) { if (\PHP_VERSION_ID >= 50600) { - return ! ($reflectionClass->isInternal() && $reflectionClass->isFinal()); + return ! ($this->hasInternalAncestors($reflectionClass) && $reflectionClass->isFinal()); } return \PHP_VERSION_ID >= 50400 && ! $this->hasInternalAncestors($reflectionClass); diff --git a/core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/InstantiatorTest.php b/core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/InstantiatorTest.php index e7f6e944bf80..0a2cb9313d29 100644 --- a/core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/InstantiatorTest.php +++ b/core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/InstantiatorTest.php @@ -165,8 +165,11 @@ class InstantiatorTest extends PHPUnit_Framework_TestCase array('stdClass'), array(__CLASS__), array('Doctrine\\Instantiator\\Instantiator'), + array('Exception'), array('PharException'), array('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset'), + array('DoctrineTest\\InstantiatorTestAsset\\ExceptionAsset'), + array('DoctrineTest\\InstantiatorTestAsset\\FinalExceptionAsset'), array('DoctrineTest\\InstantiatorTestAsset\\PharExceptionAsset'), array('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset'), array('DoctrineTest\\InstantiatorTestAsset\\XMLReaderAsset'), diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Annotation/TargetTest.php b/core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/ExceptionAsset.php similarity index 54% rename from core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Annotation/TargetTest.php rename to core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/ExceptionAsset.php index 7627f76368de..43bbe46b715d 100644 --- a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Annotation/TargetTest.php +++ b/core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/ExceptionAsset.php @@ -17,31 +17,25 @@ * . */ -namespace Doctrine\Tests\Common\Annotations\Annotation; +namespace DoctrineTest\InstantiatorTestAsset; -use Doctrine\Common\Annotations\Annotation\Target; +use BadMethodCallException; +use Exception; /** - * Tests for {@see \Doctrine\Common\Annotations\Annotation\Target} + * Test asset that extends an internal PHP base exception * - * @covers \Doctrine\Common\Annotations\Annotation\Target + * @author Marco Pivetta */ -class TargetTest extends \PHPUnit_Framework_TestCase +class ExceptionAsset extends Exception { /** - * @group DDC-3006 + * Constructor - should not be called + * + * @throws BadMethodCallException */ - public function testValidMixedTargets() + public function __construct() { - $target = new Target(array("value" => array("ALL"))); - $this->assertEquals(Target::TARGET_ALL, $target->targets); - - $target = new Target(array("value" => array("METHOD", "METHOD"))); - $this->assertEquals(Target::TARGET_METHOD, $target->targets); - $this->assertNotEquals(Target::TARGET_PROPERTY, $target->targets); - - $target = new Target(array("value" => array("PROPERTY", "METHOD"))); - $this->assertEquals(Target::TARGET_METHOD | Target::TARGET_PROPERTY, $target->targets); + throw new BadMethodCallException('Not supposed to be called!'); } } - diff --git a/core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/FinalExceptionAsset.php b/core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/FinalExceptionAsset.php new file mode 100644 index 000000000000..7d268f5b3b7f --- /dev/null +++ b/core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/FinalExceptionAsset.php @@ -0,0 +1,41 @@ +. + */ + +namespace DoctrineTest\InstantiatorTestAsset; + +use BadMethodCallException; +use Exception; + +/** + * Test asset that extends an internal PHP base exception + * + * @author Marco Pivetta + */ +final class FinalExceptionAsset extends Exception +{ + /** + * Constructor - should not be called + * + * @throws BadMethodCallException + */ + public function __construct() + { + throw new BadMethodCallException('Not supposed to be called!'); + } +}