diff --git a/.travis.php b/.travis.php index 1334f14ad4ace..511e05008a335 100644 --- a/.travis.php +++ b/.travis.php @@ -19,8 +19,11 @@ } echo "$dir\n"; - $json = file_get_contents($dir.'/composer.json'); - $package = json_decode($json); + $json = ltrim(file_get_contents($dir.'/composer.json')); + if (null === $package = json_decode($json)) { + passthru("composer validate $dir/composer.json"); + exit(1); + } $package->repositories = array(array( 'type' => 'composer', diff --git a/.travis.yml b/.travis.yml index 91dcfa03fadec..62754a68af3a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,14 +32,16 @@ env: before_install: - if [[ "$deps" = "no" ]] && [[ "$TRAVIS_PHP_VERSION" =~ 5.[45] ]] && [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then export deps=skip; fi; + - if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi; + - echo "memory_limit = -1" >> $INI_FILE + - echo "session.gc_probability = 0" >> $INI_FILE - if [ "$deps" != "skip" ]; then composer self-update; fi; - - if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi; - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then phpenv config-rm xdebug.ini; fi; - - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi; - - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi; - - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.7 && echo "apc.enable_cli = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini) || echo "Let's continue without apcu extension"; fi; + - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = mongo.so" >> $INI_FILE; fi; + - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = memcache.so" >> $INI_FILE; fi; + - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.7 && echo "apc.enable_cli = 1" >> $INI_FILE) || echo "Let's continue without apcu extension"; fi; - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then pecl install -f memcached-2.1.0 || echo "Let's continue without memcached extension"; fi; - - if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php -i; fi; + - if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi; - if [ "$deps" != "skip" ]; then ./phpunit install; fi; - export PHPUNIT="$(readlink -f ./phpunit)" diff --git a/CHANGELOG-2.3.md b/CHANGELOG-2.3.md index 9c9d593aa08c7..4974aa08b3a2c 100644 --- a/CHANGELOG-2.3.md +++ b/CHANGELOG-2.3.md @@ -7,6 +7,25 @@ in 2.3 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.3.0...v2.3.1 +* 2.3.35 (2015-11-23) + + * security #16631 CVE-2015-8124: Session Fixation in the "Remember Me" Login Feature (xabbuh) + * security #16630 CVE-2015-8125: Potential Remote Timing Attack Vulnerability in Security Remember-Me Service (xabbuh) + * bug #16588 Sent out a status text for unknown HTTP headers. (dawehner) + * bug #16295 [DependencyInjection] Unescape parameters for all types of injection (Nicofuma) + * bug #16574 [Process] Fix PhpProcess with phpdbg runtime (nicolas-grekas) + * bug #16352 Fix the server variables in the router_*.php files (leofeyer) + * bug #16537 [Validator] Allow an empty path with a non empty fragment or a query (jakzal) + * bug #16528 [Translation] Add support for Armenian pluralization. (marcosdsanchez) + * bug #16510 [Process] fix Proccess run with pts enabled (ewgRa) + * bug #16292 fix race condition at mkdir (#16258) (ewgRa) + * bug #16462 [PropertyAccess] Fix dynamic property accessing. (dunglas) + * bug #16294 [PropertyAccess] Major performance improvement (dunglas) + * bug #16331 fixed Twig deprecation notices (fabpot) + * bug #16306 [DoctrineBridge] Fix issue which prevent the profiler to explain a query (Baachi) + * bug #16359 Use mb_detect_encoding with $strict = true (nicolas-grekas) + * bug #16144 [Security] don't allow to install the split Security packages (xabbuh) + * 2.3.34 (2015-10-27) * bug #16288 [Process] Inherit env vars by default in PhpProcess (nicolas-grekas) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index b78fd1ff5ee94..9b30d35c1a0ae 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -51,19 +51,19 @@ Symfony is the result of the work of many people who made the code better - Florin Patan (florinpatan) - Eric Clemmons (ericclemmons) - Andrej Hudec (pulzarraider) - - Deni - Maxime Steinhausser (ogizanagi) + - Deni - Henrik Westphal (snc) - Dariusz Górecki (canni) - Gábor Egyed (1ed) - Christian Raue - Arnout Boks (aboks) - - Michel Weimerskirch (mweimerskirch) - Kevin Bond (kbond) + - Michel Weimerskirch (mweimerskirch) + - Douglas Greenshields (shieldo) - Lee McDermott - Brandon Turner - Luis Cordova (cordoval) - - Douglas Greenshields (shieldo) - Daniel Holmes (dholmes) - Bart van den Burg (burgov) - Jordan Alliot (jalliot) @@ -85,15 +85,17 @@ Symfony is the result of the work of many people who made the code better - Adrien Brault (adrienbrault) - excelwebzone - Jacob Dreesen (jdreesen) + - Michal Piotrowski (eventhorizon) + - Peter Kokot (maastermedia) - Fabien Pennequin (fabienpennequin) - Peter Rehm (rpet) - - Peter Kokot (maastermedia) + - Pierre du Plessis (pierredup) - Alexander Schwenn (xelaris) - Gordon Franke (gimler) - Robert Schönthal (digitalkaoz) - Jérémy DERUSSÉ (jderusse) - Dariusz Ruminski - - Michal Piotrowski (eventhorizon) + - Joshua Thijssen - Stefano Sala (stefano.sala) - David Buchmann (dbu) - Issei Murasawa (issei_m) @@ -103,7 +105,6 @@ Symfony is the result of the work of many people who made the code better - Sebastian Hörl (blogsh) - Daniel Gomes (danielcsgomes) - Hidenori Goto (hidenorigoto) - - Joshua Thijssen - Guilherme Blanco (guilhermeblanco) - Pablo Godel (pgodel) - Vladimir Reznichenko (kalessil) @@ -116,6 +117,7 @@ Symfony is the result of the work of many people who made the code better - Clemens Tolboom - Helmer Aaviksoo - Baptiste Clavié (talus) + - Tugdual Saunier (tucksaun) - Hiromi Hishida (77web) - Matthieu Ouellette-Vachon (maoueh) - Michał Pipa (michal.pipa) @@ -124,8 +126,7 @@ Symfony is the result of the work of many people who made the code better - Artur Kotyrba - Rouven Weßling (realityking) - Charles Sarrazin (csarrazi) - - Pierre du Plessis (pierredup) - - Tugdual Saunier (tucksaun) + - Warnar Boekkooi (boekkooi) - Andréia Bohner (andreia) - Dmitrii Chekaliuk (lazyhammer) - Clément JOBEILI (dator) @@ -159,15 +160,17 @@ Symfony is the result of the work of many people who made the code better - Justin Hileman (bobthecow) - Michele Orselli (orso) - Sven Paulus (subsven) - - Warnar Boekkooi (boekkooi) - Lars Strojny (lstrojny) + - Daniel Wehner - Rui Marinho (ruimarinho) + - Evgeniy (ewgraf) - Julien Brochet (mewt) - Sergey Linnik (linniksa) - Jáchym Toušek - Marcel Beerta (mazen) - Vincent AUBERT (vincent) - julien pauli (jpauli) + - Florian Lonqueu-Brochard (florianlb) - Francois Zaninotto - Alexander Kotynia (olden) - Daniel Tschinder @@ -185,6 +188,7 @@ Symfony is the result of the work of many people who made the code better - Eugene Leonovich (rybakit) - Joseph Rouff (rouffj) - Félix Labrecque (woodspire) + - Tomáš Votruba (tomas_votruba) - GordonsLondon - Jan Sorgalla (jsor) - Ray @@ -201,17 +205,19 @@ Symfony is the result of the work of many people who made the code better - Beau Simensen (simensen) - Robert Kiss (kepten) - Ruben Gonzalez (rubenrua) + - Marcos Sánchez - Kim Hemsø Rasmussen (kimhemsoe) - Diego Saint Esteben (dosten) - - Florian Lonqueu-Brochard (florianlb) - Tom Van Looy (tvlooy) - Wouter Van Hecke - Peter Kruithof (pkruithof) - Michael Holm (hollo) - Marc Weistroff (futurecat) + - Blanchon Vincent (blanchonvincent) - Dawid Nowak - Kristen Gilden (kgilden) - Chris Smith (cs278) + - Richard van Laak (rvanlaak) - Florian Klein (docteurklein) - Manuel Kiessling (manuelkiessling) - Daniel Wehner @@ -245,7 +251,7 @@ Symfony is the result of the work of many people who made the code better - Giorgio Premi - Erin Millard - Matthew Lewinski (lewinski) - - Marcos Sánchez + - Antonio J. García Lagar (ajgarlag) - alquerci - Francesco Levorato - Vitaliy Zakharov (zakharovvi) @@ -255,14 +261,11 @@ Symfony is the result of the work of many people who made the code better - Christian Gärtner (dagardner) - Tomasz Kowalczyk (thunderer) - François-Xavier de Guillebon (de-gui_f) - - Daniel Wehner - Felix Labrecque - Yaroslav Kiliba - Stepan Anchugov (kix) - Terje Bråten - - Evgeniy (ewgraf) - Robbert Klarenbeek (robbertkl) - - Blanchon Vincent (blanchonvincent) - hossein zolfi (ocean) - Clément Gautier (clementgautier) - Eduardo Gulias (egulias) @@ -285,6 +288,7 @@ Symfony is the result of the work of many people who made the code better - Shein Alexey - Joe Lencioni - Daniel Tschinder + - Diego Agulló (aeoris) - Kai - Lee Rowlands - Maximilian Reichel (phramz) @@ -313,8 +317,9 @@ Symfony is the result of the work of many people who made the code better - Thomas Lallement (raziel057) - Jan Schumann - Niklas Fiekas + - Mark Challoner (markchalloner) + - Markus Bachmann (baachi) - lancergr - - Antonio J. García Lagar (ajgarlag) - Olivier Dolbeau (odolbeau) - Roumen Damianoff (roumen) - vagrant @@ -365,9 +370,10 @@ Symfony is the result of the work of many people who made the code better - Daniel Beyer - Andrew Udvare (audvare) - alexpods - - Richard van Laak (rvanlaak) + - Tristan Darricau (nicofuma) - Erik Trapman (eriktrapman) - De Cock Xavier (xdecock) + - Possum - Scott Arciszewski - Norbert Orzechowicz (norzechowicz) - Matthijs van den Bos (matthijs) @@ -381,6 +387,7 @@ Symfony is the result of the work of many people who made the code better - Dawid Pakuła (zulusx) - Florian Rey (nervo) - Rodrigo Borrego Bernabé (rodrigobb) + - Leo Feyer - MatTheCat - John Bafford (jbafford) - Denis Gorbachev (starfall) @@ -410,7 +417,6 @@ Symfony is the result of the work of many people who made the code better - Christopher Davis (chrisguitarguy) - alcaeus - vitaliytv - - Markus Bachmann (baachi) - Sebastian Blum - aubx - Ricky Su (ricky) @@ -475,6 +481,7 @@ Symfony is the result of the work of many people who made the code better - Tiago Brito (blackmx) - Richard van den Brand (ricbra) - develop + - Hidde Wieringa - Mark Sonnabaum - Alexander Obuhovich (aik099) - jochenvdv @@ -496,7 +503,6 @@ Symfony is the result of the work of many people who made the code better - avorobiev - Venu - Lars Vierbergen - - Mark Challoner - Dennis Hotson - Andrew Tchircoff (andrewtch) - michaelwilliams @@ -534,7 +540,6 @@ Symfony is the result of the work of many people who made the code better - Rafał Wrzeszcz (rafalwrzeszcz) - Reen Lokum - Martin Parsiegla (spea) - - Possum - Denis Charrier (brucewouaigne) - Quentin Schuler - Pierre Vanliefland (pvanliefland) @@ -558,12 +563,10 @@ Symfony is the result of the work of many people who made the code better - Patrick Allaert - Gustavo Falco (gfalco) - Matt Robinson (inanimatt) - - Tristan Darricau (nicofuma) - Aleksey Podskrebyshev - Steffen Roßkamp - David Marín Carreño (davefx) - Jörn Lang (j.lang) - - Leo Feyer - mwsaz - Benoît Bourgeois - corphi @@ -589,7 +592,6 @@ Symfony is the result of the work of many people who made the code better - Balazs Csaba (balazscsaba2006) - Harry Walter (haswalt) - Johnson Page (jwpage) - - Tomáš Votruba (tomas_votruba) - Michael Roterman (wtfzdotnet) - Arno Geurts - Adán Lobato (adanlobato) @@ -638,6 +640,7 @@ Symfony is the result of the work of many people who made the code better - Jérôme Vasseur - Sander Coolen (scoolen) - Nicolas Le Goff (nlegoff) + - Anne-Sophie Bachelard (annesophie) - Manuele Menozzi - Anton Babenko (antonbabenko) - Irmantas Šiupšinskas (irmantas) @@ -921,7 +924,6 @@ Symfony is the result of the work of many people who made the code better - Shane Preece (shane) - wusuopu - povilas - - Diego Agulló - Alessandro Tagliapietra (alex88) - Biji (biji) - Gunnar Lium (gunnarlium) @@ -1082,7 +1084,6 @@ Symfony is the result of the work of many people who made the code better - grifx - Robert Campbell - Matt Lehner - - Hidde Wieringa - Hein Zaw Htet™ - Ruben Kruiswijk - Michael J @@ -1106,7 +1107,6 @@ Symfony is the result of the work of many people who made the code better - Alan Chen - Maerlyn - Even André Fiskvik - - Diego Agulló - Dane Powell - Gerrit Drost - Lenar Lõhmus @@ -1219,6 +1219,7 @@ Symfony is the result of the work of many people who made the code better - Sam Williams - Adrian Philipp - James Michael DuPont + - Eugene Wissner - Kasperki - Tammy D - Ondrej Slinták @@ -1276,6 +1277,7 @@ Symfony is the result of the work of many people who made the code better - arduanov - sualko - Nicolas Roudaire + - Jérôme Vasseur - Alfonso (afgar) - Andreas Forsblom (aforsblo) - Alex Olmos (alexolmos) diff --git a/composer.json b/composer.json index 521ccade6dad1..198070a402ee4 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "require": { "php": ">=5.3.3", "doctrine/common": "~2.4", - "twig/twig": "~1.20|~2.0", + "twig/twig": "~1.23|~2.0", "psr/log": "~1.0" }, "replace": { @@ -48,7 +48,10 @@ "symfony/proxy-manager-bridge": "self.version", "symfony/routing": "self.version", "symfony/security": "self.version", + "symfony/security-acl": "self.version", "symfony/security-bundle": "self.version", + "symfony/security-core": "self.version", + "symfony/security-http": "self.version", "symfony/serializer": "self.version", "symfony/stopwatch": "self.version", "symfony/swiftmailer-bridge": "self.version", @@ -75,7 +78,10 @@ "src/Symfony/Component/HttpFoundation/Resources/stubs", "src/Symfony/Component/Intl/Resources/stubs" ], - "files": [ "src/Symfony/Component/Intl/Resources/stubs/functions.php" ] + "files": [ "src/Symfony/Component/Intl/Resources/stubs/functions.php" ], + "exclude-from-classmap": [ + "**/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/phpunit b/phpunit index 79810f626e87f..2ab4f25e75cc2 100755 --- a/phpunit +++ b/phpunit @@ -1,6 +1,18 @@ #!/usr/bin/env php + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +// Please update when phpunit needs to be reinstalled with fresh deps: +// Cache-Id-Version: 2015-11-18 14:14 UTC + use Symfony\Component\Process\ProcessUtils; error_reporting(-1); @@ -10,21 +22,16 @@ require __DIR__.'/src/Symfony/Component/Process/ProcessUtils.php'; $PHPUNIT_VERSION = PHP_VERSION_ID >= 70000 ? '5.0' : '4.8'; $PHPUNIT_DIR = __DIR__.'/.phpunit'; $PHP = defined('PHP_BINARY') ? PHP_BINARY : 'php'; - -if (!file_exists($COMPOSER = __DIR__.'/composer.phar')) { - $COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? `where.exe composer.phar` : (`which composer.phar` ?: `which composer`)); - if (!file_exists($COMPOSER)) { - stream_copy_to_stream( - fopen('https://getcomposer.org/composer.phar', 'rb'), - fopen($COMPOSER = __DIR__.'/composer.phar', 'wb') - ); - } +$PHP = ProcessUtils::escapeArgument($PHP); +if ('phpdbg' === PHP_SAPI) { + $PHP .= ' -qrr'; } -$PHP = ProcessUtils::escapeArgument($PHP); -$COMPOSER = $PHP.' '.ProcessUtils::escapeArgument($COMPOSER); +$COMPOSER = file_exists($COMPOSER = __DIR__.'/composer.phar') || ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? `where.exe composer.phar` : `which composer.phar`)) + ? $PHP.' '.ProcessUtils::escapeArgument($COMPOSER) + : 'composer'; -if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__FILE__) !== @file_get_contents("$PHPUNIT_DIR/.md5")) { +if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__FILE__) !== @file_get_contents("$PHPUNIT_DIR/.$PHPUNIT_VERSION.md5")) { // Build a standalone phpunit without symfony/yaml $oldPwd = getcwd(); @@ -61,7 +68,7 @@ EOPHP passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? '(del /S /F /Q %s & rmdir %1$s) >nul': 'rm -rf %s', str_replace('/', DIRECTORY_SEPARATOR, "phpunit-$PHPUNIT_VERSION/vendor/symfony/phpunit-bridge"))); symlink(realpath('../src/Symfony/Bridge/PhpUnit'), "phpunit-$PHPUNIT_VERSION/vendor/symfony/phpunit-bridge"); } - file_put_contents('.md5', md5_file(__FILE__)); + file_put_contents(".$PHPUNIT_VERSION.md5", md5_file(__FILE__)); chdir($oldPwd); } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index e9c709d14223a..4e4e411c3cfb4 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -38,6 +38,10 @@ ./src/Symfony/Bundle/*/Resources ./src/Symfony/Component/*/Resources ./src/Symfony/Component/*/*/Resources + ./src/Symfony/Bridge/*/vendor + ./src/Symfony/Bundle/*/vendor + ./src/Symfony/Component/*/vendor + ./src/Symfony/Component/*/*/vendor diff --git a/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php b/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php index b4a2acd4e650f..a57b9ae6ea151 100644 --- a/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php +++ b/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php @@ -117,6 +117,9 @@ private function sanitizeQueries($connectionName, $queries) private function sanitizeQuery($connectionName, $query) { $query['explainable'] = true; + if (null === $query['params']) { + $query['params'] = array(); + } if (!is_array($query['params'])) { $query['params'] = array($query['params']); } diff --git a/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php b/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php index 1870aa650c009..45d0310e6dac8 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php @@ -79,9 +79,25 @@ public function testCollectQueries($param, $types, $expected, $explainable) $c = $this->createCollector($queries); $c->collect(new Request(), new Response()); - $collected_queries = $c->getQueries(); - $this->assertEquals($expected, $collected_queries['default'][0]['params'][0]); - $this->assertEquals($explainable, $collected_queries['default'][0]['explainable']); + $collectedQueries = $c->getQueries(); + $this->assertEquals($expected, $collectedQueries['default'][0]['params'][0]); + $this->assertEquals($explainable, $collectedQueries['default'][0]['explainable']); + } + + public function testCollectQueryWithNoParams() + { + $queries = array( + array('sql' => 'SELECT * FROM table1', 'params' => array(), 'types' => array(), 'executionMS' => 1), + array('sql' => 'SELECT * FROM table1', 'params' => null, 'types' => null, 'executionMS' => 1), + ); + $c = $this->createCollector($queries); + $c->collect(new Request(), new Response()); + + $collectedQueries = $c->getQueries(); + $this->assertEquals(array(), $collectedQueries['default'][0]['params']); + $this->assertTrue($collectedQueries['default'][0]['explainable']); + $this->assertEquals(array(), $collectedQueries['default'][1]['params']); + $this->assertTrue($collectedQueries['default'][1]['explainable']); } /** @@ -96,9 +112,9 @@ public function testSerialization($param, $types, $expected, $explainable) $c->collect(new Request(), new Response()); $c = unserialize(serialize($c)); - $collected_queries = $c->getQueries(); - $this->assertEquals($expected, $collected_queries['default'][0]['params'][0]); - $this->assertEquals($explainable, $collected_queries['default'][0]['explainable']); + $collectedQueries = $c->getQueries(); + $this->assertEquals($expected, $collectedQueries['default'][0]['params'][0]); + $this->assertEquals($explainable, $collectedQueries['default'][0]['explainable']); } public function paramProvider() diff --git a/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php b/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php index 59e866479858a..92fec99b5b47f 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php @@ -160,7 +160,7 @@ public function testLogUTF8LongString() $dbalLogger ->expects($this->once()) ->method('log') - ->with('SQL', array('short' => $shortString, 'long' => mb_substr($longString, 0, DbalLogger::MAX_STRING_LENGTH - 6, mb_detect_encoding($longString)).' [...]')) + ->with('SQL', array('short' => $shortString, 'long' => mb_substr($longString, 0, DbalLogger::MAX_STRING_LENGTH - 6, 'UTF-8').' [...]')) ; $dbalLogger->startQuery('SQL', array( diff --git a/src/Symfony/Bridge/Doctrine/composer.json b/src/Symfony/Bridge/Doctrine/composer.json index 7012ab771cda0..03e1376503c06 100644 --- a/src/Symfony/Bridge/Doctrine/composer.json +++ b/src/Symfony/Bridge/Doctrine/composer.json @@ -40,7 +40,10 @@ "doctrine/orm": "" }, "autoload": { - "psr-0": { "Symfony\\Bridge\\Doctrine\\": "" } + "psr-0": { "Symfony\\Bridge\\Doctrine\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Bridge/Doctrine", "minimum-stability": "dev", diff --git a/src/Symfony/Bridge/Doctrine/phpunit.xml.dist b/src/Symfony/Bridge/Doctrine/phpunit.xml.dist index 13409e6f0f6b5..c006d232219a4 100644 --- a/src/Symfony/Bridge/Doctrine/phpunit.xml.dist +++ b/src/Symfony/Bridge/Doctrine/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -21,6 +22,7 @@ ./Resources ./Tests + ./vendor diff --git a/src/Symfony/Bridge/Monolog/composer.json b/src/Symfony/Bridge/Monolog/composer.json index bd4cfa54324f9..c38fe461fdcf1 100644 --- a/src/Symfony/Bridge/Monolog/composer.json +++ b/src/Symfony/Bridge/Monolog/composer.json @@ -21,7 +21,10 @@ "monolog/monolog": "~1.3" }, "autoload": { - "psr-0": { "Symfony\\Bridge\\Monolog\\": "" } + "psr-0": { "Symfony\\Bridge\\Monolog\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Bridge/Monolog", "minimum-stability": "dev", diff --git a/src/Symfony/Bridge/Monolog/phpunit.xml.dist b/src/Symfony/Bridge/Monolog/phpunit.xml.dist index efd48709de90b..8a60f06a7a310 100644 --- a/src/Symfony/Bridge/Monolog/phpunit.xml.dist +++ b/src/Symfony/Bridge/Monolog/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -21,6 +22,7 @@ ./Resources ./Tests + ./vendor diff --git a/src/Symfony/Bridge/Propel1/composer.json b/src/Symfony/Bridge/Propel1/composer.json index ab92f4d22e020..296c4e84a5351 100644 --- a/src/Symfony/Bridge/Propel1/composer.json +++ b/src/Symfony/Bridge/Propel1/composer.json @@ -27,7 +27,10 @@ "symfony/stopwatch": "~2.2" }, "autoload": { - "psr-0": { "Symfony\\Bridge\\Propel1\\": "" } + "psr-0": { "Symfony\\Bridge\\Propel1\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Bridge/Propel1", "minimum-stability": "dev", diff --git a/src/Symfony/Bridge/Propel1/phpunit.xml.dist b/src/Symfony/Bridge/Propel1/phpunit.xml.dist index 507e12596cbd4..d6d959c7b01c2 100644 --- a/src/Symfony/Bridge/Propel1/phpunit.xml.dist +++ b/src/Symfony/Bridge/Propel1/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -21,6 +22,7 @@ ./Resources ./Tests + ./vendor diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/ContainerBuilderTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/ContainerBuilderTest.php index b6c3b4fd36b42..ae13d543b0e1e 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/ContainerBuilderTest.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/ContainerBuilderTest.php @@ -24,9 +24,6 @@ */ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService - */ public function testCreateProxyServiceWithRuntimeInstantiator() { $builder = new ContainerBuilder(); diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php index a6605c2a533e8..8b2402b045f28 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php @@ -18,8 +18,6 @@ * Tests for {@see \Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator}. * * @author Marco Pivetta - * - * @covers \Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator */ class RuntimeInstantiatorTest extends \PHPUnit_Framework_TestCase { diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php index 8ef46b4d962fe..fd20192d86e4f 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php @@ -18,8 +18,6 @@ * Tests for {@see \Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper}. * * @author Marco Pivetta - * - * @covers \Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper */ class ProxyDumperTest extends \PHPUnit_Framework_TestCase { diff --git a/src/Symfony/Bridge/ProxyManager/composer.json b/src/Symfony/Bridge/ProxyManager/composer.json index 8a2a81bf17bd6..82b119b164898 100644 --- a/src/Symfony/Bridge/ProxyManager/composer.json +++ b/src/Symfony/Bridge/ProxyManager/composer.json @@ -26,7 +26,10 @@ "autoload": { "psr-0": { "Symfony\\Bridge\\ProxyManager\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Bridge/ProxyManager", "minimum-stability": "dev", diff --git a/src/Symfony/Bridge/ProxyManager/phpunit.xml.dist b/src/Symfony/Bridge/ProxyManager/phpunit.xml.dist index 363805fdfa6ae..60980be9e531e 100644 --- a/src/Symfony/Bridge/ProxyManager/phpunit.xml.dist +++ b/src/Symfony/Bridge/ProxyManager/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ diff --git a/src/Symfony/Bridge/Swiftmailer/composer.json b/src/Symfony/Bridge/Swiftmailer/composer.json index 09cdce00a6fd1..ad203340e3f40 100644 --- a/src/Symfony/Bridge/Swiftmailer/composer.json +++ b/src/Symfony/Bridge/Swiftmailer/composer.json @@ -23,7 +23,10 @@ "symfony/http-kernel": "" }, "autoload": { - "psr-0": { "Symfony\\Bridge\\Swiftmailer\\": "" } + "psr-0": { "Symfony\\Bridge\\Swiftmailer\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Bridge/Swiftmailer", "minimum-stability": "dev", diff --git a/src/Symfony/Bridge/Twig/Extension/FormExtension.php b/src/Symfony/Bridge/Twig/Extension/FormExtension.php index 9c7339f70295f..e972ac4354baa 100644 --- a/src/Symfony/Bridge/Twig/Extension/FormExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/FormExtension.php @@ -21,7 +21,7 @@ * @author Fabien Potencier * @author Bernhard Schussek */ -class FormExtension extends \Twig_Extension +class FormExtension extends \Twig_Extension implements \Twig_Extension_InitRuntimeInterface { /** * This property is public so that it can be accessed directly from compiled diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json index 8ba426b6b16bc..b089cb6c1e8db 100644 --- a/src/Symfony/Bridge/Twig/composer.json +++ b/src/Symfony/Bridge/Twig/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=5.3.3", - "twig/twig": "~1.20|~2.0" + "twig/twig": "~1.23|~2.0" }, "require-dev": { "symfony/finder": "~2.3", @@ -42,7 +42,10 @@ "symfony/security": "" }, "autoload": { - "psr-0": { "Symfony\\Bridge\\Twig\\": "" } + "psr-0": { "Symfony\\Bridge\\Twig\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Bridge/Twig", "minimum-stability": "dev", diff --git a/src/Symfony/Bridge/Twig/phpunit.xml.dist b/src/Symfony/Bridge/Twig/phpunit.xml.dist index d291324949f2d..10c0be1142712 100644 --- a/src/Symfony/Bridge/Twig/phpunit.xml.dist +++ b/src/Symfony/Bridge/Twig/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/router_dev.php b/src/Symfony/Bundle/FrameworkBundle/Resources/config/router_dev.php index ca0cd1ee1cefb..432ccff9204f1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/router_dev.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/router_dev.php @@ -33,6 +33,10 @@ $_SERVER = array_merge($_SERVER, $_ENV); $_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'app_dev.php'; +// Since we are rewriting to app_dev.php, adjust SCRIPT_NAME and PHP_SELF accordingly +$_SERVER['SCRIPT_NAME'] = DIRECTORY_SEPARATOR.'app_dev.php'; +$_SERVER['PHP_SELF'] = DIRECTORY_SEPARATOR.'app_dev.php'; + require 'app_dev.php'; error_log(sprintf('%s:%d [%d]: %s', $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_PORT'], http_response_code(), $_SERVER['REQUEST_URI']), 4); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/router_prod.php b/src/Symfony/Bundle/FrameworkBundle/Resources/config/router_prod.php index 1c6b99b866b74..97613a6248f71 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/router_prod.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/router_prod.php @@ -33,6 +33,10 @@ $_SERVER = array_merge($_SERVER, $_ENV); $_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'app.php'; +// Since we are rewriting to app.php, adjust SCRIPT_NAME and PHP_SELF accordingly +$_SERVER['SCRIPT_NAME'] = DIRECTORY_SEPARATOR.'app.php'; +$_SERVER['PHP_SELF'] = DIRECTORY_SEPARATOR.'app.php'; + require 'app.php'; error_log(sprintf('%s:%d [%d]: %s', $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_PORT'], http_response_code(), $_SERVER['REQUEST_URI']), 4); diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index 03d183040bb66..9983848d7bf0b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -51,7 +51,10 @@ "symfony/serializer": "For using the serializer service" }, "autoload": { - "psr-0": { "Symfony\\Bundle\\FrameworkBundle\\": "" } + "psr-0": { "Symfony\\Bundle\\FrameworkBundle\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Bundle/FrameworkBundle", "minimum-stability": "dev", diff --git a/src/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist b/src/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist index eb7c0b0a97a2f..1d25eeb3304c5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist +++ b/src/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -19,9 +20,9 @@ ./ - ./vendor ./Resources ./Tests + ./vendor diff --git a/src/Symfony/Bundle/SecurityBundle/composer.json b/src/Symfony/Bundle/SecurityBundle/composer.json index f3a001b649896..98f4fd0fff00c 100644 --- a/src/Symfony/Bundle/SecurityBundle/composer.json +++ b/src/Symfony/Bundle/SecurityBundle/composer.json @@ -34,10 +34,13 @@ "symfony/process": "~2.0,>=2.0.5", "symfony/validator": "~2.2", "symfony/yaml": "~2.0,>=2.0.5", - "twig/twig": "~1.20|~2.0" + "twig/twig": "~1.23|~2.0" }, "autoload": { - "psr-0": { "Symfony\\Bundle\\SecurityBundle\\": "" } + "psr-0": { "Symfony\\Bundle\\SecurityBundle\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Bundle/SecurityBundle", "minimum-stability": "dev", diff --git a/src/Symfony/Bundle/SecurityBundle/phpunit.xml.dist b/src/Symfony/Bundle/SecurityBundle/phpunit.xml.dist index 52f420ae5f2fe..a7fdc326c4571 100644 --- a/src/Symfony/Bundle/SecurityBundle/phpunit.xml.dist +++ b/src/Symfony/Bundle/SecurityBundle/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -19,8 +20,8 @@ ./ - ./Tests ./Resources + ./Tests ./vendor diff --git a/src/Symfony/Bundle/TwigBundle/composer.json b/src/Symfony/Bundle/TwigBundle/composer.json index ea7e9e72e363a..168701fa6547b 100644 --- a/src/Symfony/Bundle/TwigBundle/composer.json +++ b/src/Symfony/Bundle/TwigBundle/composer.json @@ -28,7 +28,10 @@ "symfony/framework-bundle": "~2.1" }, "autoload": { - "psr-0": { "Symfony\\Bundle\\TwigBundle\\": "" } + "psr-0": { "Symfony\\Bundle\\TwigBundle\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Bundle/TwigBundle", "minimum-stability": "dev", diff --git a/src/Symfony/Bundle/TwigBundle/phpunit.xml.dist b/src/Symfony/Bundle/TwigBundle/phpunit.xml.dist index 715b0bfa87f47..9a8c38f26ef33 100644 --- a/src/Symfony/Bundle/TwigBundle/phpunit.xml.dist +++ b/src/Symfony/Bundle/TwigBundle/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -19,8 +20,8 @@ ./ - ./Tests ./Resources + ./Tests ./vendor diff --git a/src/Symfony/Bundle/WebProfilerBundle/composer.json b/src/Symfony/Bundle/WebProfilerBundle/composer.json index 1bef0d7698247..16235d8b8699b 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/composer.json +++ b/src/Symfony/Bundle/WebProfilerBundle/composer.json @@ -28,7 +28,10 @@ "symfony/stopwatch": "~2.2" }, "autoload": { - "psr-0": { "Symfony\\Bundle\\WebProfilerBundle\\": "" } + "psr-0": { "Symfony\\Bundle\\WebProfilerBundle\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Bundle/WebProfilerBundle", "minimum-stability": "dev", diff --git a/src/Symfony/Bundle/WebProfilerBundle/phpunit.xml.dist b/src/Symfony/Bundle/WebProfilerBundle/phpunit.xml.dist index 767f3e066b391..2bcccd6667a26 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/phpunit.xml.dist +++ b/src/Symfony/Bundle/WebProfilerBundle/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -19,8 +20,8 @@ ./ - ./Tests ./Resources + ./Tests ./vendor diff --git a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php index cc7db71fd2f94..36a0fbc6ee26b 100644 --- a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php @@ -73,27 +73,18 @@ protected function getScript($request) class ClientTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\BrowserKit\Client::getHistory - */ public function testGetHistory() { $client = new TestClient(array(), $history = new History()); $this->assertSame($history, $client->getHistory(), '->getHistory() returns the History'); } - /** - * @covers Symfony\Component\BrowserKit\Client::getCookieJar - */ public function testGetCookieJar() { $client = new TestClient(array(), null, $cookieJar = new CookieJar()); $this->assertSame($cookieJar, $client->getCookieJar(), '->getCookieJar() returns the CookieJar'); } - /** - * @covers Symfony\Component\BrowserKit\Client::getRequest - */ public function testGetRequest() { $client = new TestClient(); @@ -140,9 +131,6 @@ public function testGetContent() $this->assertEquals($json, $client->getRequest()->getContent()); } - /** - * @covers Symfony\Component\BrowserKit\Client::getCrawler - */ public function testGetCrawler() { $client = new TestClient(); diff --git a/src/Symfony/Component/BrowserKit/composer.json b/src/Symfony/Component/BrowserKit/composer.json index 429aa0cb07161..ab104ecc5c4c9 100644 --- a/src/Symfony/Component/BrowserKit/composer.json +++ b/src/Symfony/Component/BrowserKit/composer.json @@ -27,7 +27,10 @@ "symfony/process": "" }, "autoload": { - "psr-0": { "Symfony\\Component\\BrowserKit\\": "" } + "psr-0": { "Symfony\\Component\\BrowserKit\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/BrowserKit", "minimum-stability": "dev", diff --git a/src/Symfony/Component/BrowserKit/phpunit.xml.dist b/src/Symfony/Component/BrowserKit/phpunit.xml.dist index d6ca28bf1c6b5..d76b2b98afd80 100644 --- a/src/Symfony/Component/BrowserKit/phpunit.xml.dist +++ b/src/Symfony/Component/BrowserKit/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ diff --git a/src/Symfony/Component/ClassLoader/composer.json b/src/Symfony/Component/ClassLoader/composer.json index 447cf1f92654f..1796ab0b51f5b 100644 --- a/src/Symfony/Component/ClassLoader/composer.json +++ b/src/Symfony/Component/ClassLoader/composer.json @@ -23,7 +23,10 @@ "symfony/finder": "~2.0,>=2.0.5" }, "autoload": { - "psr-0": { "Symfony\\Component\\ClassLoader\\": "" } + "psr-0": { "Symfony\\Component\\ClassLoader\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/ClassLoader", "extra": { diff --git a/src/Symfony/Component/ClassLoader/phpunit.xml.dist b/src/Symfony/Component/ClassLoader/phpunit.xml.dist index a1b6c82c10161..4856db5be65d1 100644 --- a/src/Symfony/Component/ClassLoader/phpunit.xml.dist +++ b/src/Symfony/Component/ClassLoader/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ diff --git a/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php b/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php index 7641e24825956..cdb0980307f8b 100644 --- a/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php +++ b/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php @@ -16,19 +16,12 @@ class DelegatingLoaderTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\Config\Loader\DelegatingLoader::__construct - */ public function testConstructor() { $loader = new DelegatingLoader($resolver = new LoaderResolver()); $this->assertTrue(true, '__construct() takes a loader resolver as its first argument'); } - /** - * @covers Symfony\Component\Config\Loader\DelegatingLoader::getResolver - * @covers Symfony\Component\Config\Loader\DelegatingLoader::setResolver - */ public function testGetSetResolver() { $resolver = new LoaderResolver(); @@ -38,9 +31,6 @@ public function testGetSetResolver() $this->assertSame($resolver, $loader->getResolver(), '->setResolver() sets the resolver loader'); } - /** - * @covers Symfony\Component\Config\Loader\DelegatingLoader::supports - */ public function testSupports() { $loader1 = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); @@ -54,9 +44,6 @@ public function testSupports() $this->assertFalse($loader->supports('foo.foo'), '->supports() returns false if the resource is not loadable'); } - /** - * @covers Symfony\Component\Config\Loader\DelegatingLoader::load - */ public function testLoad() { $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); diff --git a/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php b/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php index 1442e94e8045c..1e8e91eda1c16 100644 --- a/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php +++ b/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php @@ -16,9 +16,6 @@ class FileLoaderTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\Config\Loader\FileLoader - */ public function testImportWithFileLocatorDelegation() { $locatorMock = $this->getMock('Symfony\Component\Config\FileLocatorInterface'); diff --git a/src/Symfony/Component/Config/Tests/Loader/LoaderResolverTest.php b/src/Symfony/Component/Config/Tests/Loader/LoaderResolverTest.php index 8ee276b0c4aa9..03db21be4e2c0 100644 --- a/src/Symfony/Component/Config/Tests/Loader/LoaderResolverTest.php +++ b/src/Symfony/Component/Config/Tests/Loader/LoaderResolverTest.php @@ -15,9 +15,6 @@ class LoaderResolverTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\Config\Loader\LoaderResolver::__construct - */ public function testConstructor() { $resolver = new LoaderResolver(array( @@ -27,9 +24,6 @@ public function testConstructor() $this->assertEquals(array($loader), $resolver->getLoaders(), '__construct() takes an array of loaders as its first argument'); } - /** - * @covers Symfony\Component\Config\Loader\LoaderResolver::resolve - */ public function testResolve() { $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); @@ -42,10 +36,6 @@ public function testResolve() $this->assertEquals($loader, $resolver->resolve(function () {}), '->resolve() returns the loader for the given resource'); } - /** - * @covers Symfony\Component\Config\Loader\LoaderResolver::getLoaders - * @covers Symfony\Component\Config\Loader\LoaderResolver::addLoader - */ public function testLoaders() { $resolver = new LoaderResolver(); diff --git a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php index f592e571c213f..cff40b1232725 100644 --- a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php +++ b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php @@ -63,11 +63,14 @@ public function testLoadFile() public function testLoadFileWithInternalErrorsEnabled() { - libxml_use_internal_errors(true); + $internalErrors = libxml_use_internal_errors(true); $this->assertSame(array(), libxml_get_errors()); $this->assertInstanceOf('DOMDocument', XmlUtils::loadFile(__DIR__.'/../Fixtures/Util/invalid_schema.xml')); $this->assertSame(array(), libxml_get_errors()); + + libxml_clear_errors(); + libxml_use_internal_errors($internalErrors); } /** @@ -144,7 +147,7 @@ public function getDataForPhpize() public function testLoadEmptyXmlFile() { $file = __DIR__.'/../Fixtures/foo.xml'; - $this->setExpectedException('InvalidArgumentException', 'File '.$file.' does not contain valid XML, it is empty.'); + $this->setExpectedException('InvalidArgumentException', sprintf('File %s does not contain valid XML, it is empty.', $file)); XmlUtils::loadFile($file); } diff --git a/src/Symfony/Component/Config/composer.json b/src/Symfony/Component/Config/composer.json index b093afb6d6840..bdc180de76014 100644 --- a/src/Symfony/Component/Config/composer.json +++ b/src/Symfony/Component/Config/composer.json @@ -20,7 +20,10 @@ "symfony/filesystem": "~2.3" }, "autoload": { - "psr-0": { "Symfony\\Component\\Config\\": "" } + "psr-0": { "Symfony\\Component\\Config\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/Config", "minimum-stability": "dev", diff --git a/src/Symfony/Component/Config/phpunit.xml.dist b/src/Symfony/Component/Config/phpunit.xml.dist index 2156534e9ce52..3fe6fd87c8499 100644 --- a/src/Symfony/Component/Config/phpunit.xml.dist +++ b/src/Symfony/Component/Config/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index f8bd1d05828b5..eb665e5bdb49a 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -1089,7 +1089,7 @@ private function stringWidth($string) return strlen($string); } - if (false === $encoding = mb_detect_encoding($string)) { + if (false === $encoding = mb_detect_encoding($string, null, true)) { return strlen($string); } @@ -1106,7 +1106,7 @@ private function splitStringByWidth($string, $width) return str_split($string, $width); } - if (false === $encoding = mb_detect_encoding($string)) { + if (false === $encoding = mb_detect_encoding($string, null, true)) { return str_split($string, $width); } diff --git a/src/Symfony/Component/Console/Helper/Helper.php b/src/Symfony/Component/Console/Helper/Helper.php index dc42600de88c2..dcdca6da24eff 100644 --- a/src/Symfony/Component/Console/Helper/Helper.php +++ b/src/Symfony/Component/Console/Helper/Helper.php @@ -53,7 +53,7 @@ protected function strlen($string) return strlen($string); } - if (false === $encoding = mb_detect_encoding($string)) { + if (false === $encoding = mb_detect_encoding($string, null, true)) { return strlen($string); } diff --git a/src/Symfony/Component/Console/Helper/TableHelper.php b/src/Symfony/Component/Console/Helper/TableHelper.php index 7d624771db259..00814ecdd922a 100644 --- a/src/Symfony/Component/Console/Helper/TableHelper.php +++ b/src/Symfony/Component/Console/Helper/TableHelper.php @@ -386,7 +386,7 @@ private function renderCell(array $row, $column, $cellFormat) $width = $this->getColumnWidth($column); // str_pad won't work properly with multi-byte strings, we need to fix the padding - if (function_exists('mb_strwidth') && false !== $encoding = mb_detect_encoding($cell)) { + if (function_exists('mb_strwidth') && false !== $encoding = mb_detect_encoding($cell, null, true)) { $width += strlen($cell) - mb_strwidth($cell, $encoding); } diff --git a/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php b/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php index 4df4134889434..6328b24e9f51d 100644 --- a/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php @@ -16,9 +16,6 @@ class HelperSetTest extends \PHPUnit_Framework_TestCase { - /** - * @covers \Symfony\Component\Console\Helper\HelperSet::__construct - */ public function testConstructor() { $mock_helper = $this->getGenericMockHelper('fake_helper'); @@ -28,9 +25,6 @@ public function testConstructor() $this->assertTrue($helperset->has('fake_helper_alias'), '__construct sets helper alias for given helper'); } - /** - * @covers \Symfony\Component\Console\Helper\HelperSet::set - */ public function testSet() { $helperset = new HelperSet(); @@ -49,9 +43,6 @@ public function testSet() $this->assertTrue($helperset->has('fake_helper_alias'), '->set() adds helper alias when set'); } - /** - * @covers \Symfony\Component\Console\Helper\HelperSet::has - */ public function testHas() { $helperset = new HelperSet(array('fake_helper_alias' => $this->getGenericMockHelper('fake_helper'))); @@ -59,9 +50,6 @@ public function testHas() $this->assertTrue($helperset->has('fake_helper_alias'), '->has() finds set helper by alias'); } - /** - * @covers \Symfony\Component\Console\Helper\HelperSet::get - */ public function testGet() { $helper_01 = $this->getGenericMockHelper('fake_helper_01'); @@ -82,9 +70,6 @@ public function testGet() } } - /** - * @covers \Symfony\Component\Console\Helper\HelperSet::setCommand - */ public function testSetCommand() { $cmd_01 = new Command('foo'); @@ -100,9 +85,6 @@ public function testSetCommand() $this->assertEquals($cmd_02, $helperset->getCommand(), '->setCommand() overwrites stored command with consecutive calls'); } - /** - * @covers \Symfony\Component\Console\Helper\HelperSet::getCommand - */ public function testGetCommand() { $cmd = new Command('foo'); diff --git a/src/Symfony/Component/Console/composer.json b/src/Symfony/Component/Console/composer.json index f3ce3e6b00476..309ca91a24c64 100644 --- a/src/Symfony/Component/Console/composer.json +++ b/src/Symfony/Component/Console/composer.json @@ -25,7 +25,10 @@ "symfony/event-dispatcher": "" }, "autoload": { - "psr-0": { "Symfony\\Component\\Console\\": "" } + "psr-0": { "Symfony\\Component\\Console\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/Console", "minimum-stability": "dev", diff --git a/src/Symfony/Component/Console/phpunit.xml.dist b/src/Symfony/Component/Console/phpunit.xml.dist index 729c433aa69e8..ae0dcbeaba41c 100644 --- a/src/Symfony/Component/Console/phpunit.xml.dist +++ b/src/Symfony/Component/Console/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ diff --git a/src/Symfony/Component/CssSelector/composer.json b/src/Symfony/Component/CssSelector/composer.json index 076852c53a2ab..3f7913d07b779 100644 --- a/src/Symfony/Component/CssSelector/composer.json +++ b/src/Symfony/Component/CssSelector/composer.json @@ -23,7 +23,10 @@ "php": ">=5.3.3" }, "autoload": { - "psr-0": { "Symfony\\Component\\CssSelector\\": "" } + "psr-0": { "Symfony\\Component\\CssSelector\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/CssSelector", "minimum-stability": "dev", diff --git a/src/Symfony/Component/CssSelector/phpunit.xml.dist b/src/Symfony/Component/CssSelector/phpunit.xml.dist index bc57cfcdfa8d8..14a320c873c11 100644 --- a/src/Symfony/Component/CssSelector/phpunit.xml.dist +++ b/src/Symfony/Component/CssSelector/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ diff --git a/src/Symfony/Component/Debug/composer.json b/src/Symfony/Component/Debug/composer.json index a3243d77222f5..7b98c4ff733f8 100644 --- a/src/Symfony/Component/Debug/composer.json +++ b/src/Symfony/Component/Debug/composer.json @@ -31,7 +31,10 @@ "symfony/class-loader": "" }, "autoload": { - "psr-0": { "Symfony\\Component\\Debug\\": "" } + "psr-0": { "Symfony\\Component\\Debug\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/Debug", "minimum-stability": "dev", diff --git a/src/Symfony/Component/Debug/phpunit.xml.dist b/src/Symfony/Component/Debug/phpunit.xml.dist index e91766065749a..20b0313f0cd89 100644 --- a/src/Symfony/Component/Debug/phpunit.xml.dist +++ b/src/Symfony/Component/Debug/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ diff --git a/src/Symfony/Component/DependencyInjection/ContainerAware.php b/src/Symfony/Component/DependencyInjection/ContainerAware.php index af977fea03dff..8937c669a6a63 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerAware.php +++ b/src/Symfony/Component/DependencyInjection/ContainerAware.php @@ -24,9 +24,9 @@ abstract class ContainerAware implements ContainerAwareInterface protected $container; /** - * Sets the Container associated with this Controller. + * Sets the container. * - * @param ContainerInterface $container A ContainerInterface instance + * @param ContainerInterface|null $container A ContainerInterface instance or null */ public function setContainer(ContainerInterface $container = null) { diff --git a/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php b/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php index 7007265ac8d36..fe301b6270bb9 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php +++ b/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php @@ -19,7 +19,7 @@ interface ContainerAwareInterface { /** - * Sets the Container. + * Sets the container. * * @param ContainerInterface|null $container A ContainerInterface instance or null */ diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index 2c4460f394a09..6c52c47b651a9 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -895,7 +895,7 @@ public function createService(Definition $definition, $id, $tryProxy = true) $this->callMethod($service, $call); } - $properties = $this->resolveServices($parameterBag->resolveValue($definition->getProperties())); + $properties = $this->resolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getProperties()))); foreach ($properties as $name => $value) { $service->$name = $value; } @@ -1054,7 +1054,7 @@ private function callMethod($service, $call) } } - call_user_func_array(array($service, $call[0]), $this->resolveServices($this->getParameterBag()->resolveValue($call[1]))); + call_user_func_array(array($service, $call[0]), $this->resolveServices($this->getParameterBag()->unescapeValue($this->getParameterBag()->resolveValue($call[1])))); } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 2d4eee0a61c2d..3a369d9d2ed18 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -29,12 +29,6 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::setDefinitions - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getDefinitions - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::setDefinition - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getDefinition - */ public function testDefinitions() { $builder = new ContainerBuilder(); @@ -62,9 +56,6 @@ public function testDefinitions() } } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::register - */ public function testRegister() { $builder = new ContainerBuilder(); @@ -73,9 +64,6 @@ public function testRegister() $this->assertInstanceOf('Symfony\Component\DependencyInjection\Definition', $builder->getDefinition('foo'), '->register() returns the newly created Definition instance'); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::has - */ public function testHas() { $builder = new ContainerBuilder(); @@ -86,9 +74,6 @@ public function testHas() $this->assertTrue($builder->has('bar'), '->has() returns true if a service exists'); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::get - */ public function testGet() { $builder = new ContainerBuilder(); @@ -121,7 +106,6 @@ public function testGet() } /** - * @covers \Symfony\Component\DependencyInjection\ContainerBuilder::get * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException * @expectedExceptionMessage You have requested a synthetic service ("foo"). The DIC does not know how to construct this service. */ @@ -140,9 +124,6 @@ public function testGetUnsetLoadingServiceWhenCreateServiceThrowsAnException() $builder->get('foo'); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::get - */ public function testGetReturnsNullOnInactiveScope() { $builder = new ContainerBuilder(); @@ -151,9 +132,6 @@ public function testGetReturnsNullOnInactiveScope() $this->assertNull($builder->get('foo', ContainerInterface::NULL_ON_INVALID_REFERENCE)); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::get - */ public function testGetReturnsNullOnInactiveScopeWhenServiceIsCreatedByAMethod() { $builder = new ProjectContainer(); @@ -161,9 +139,6 @@ public function testGetReturnsNullOnInactiveScopeWhenServiceIsCreatedByAMethod() $this->assertNull($builder->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE)); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getServiceIds - */ public function testGetServiceIds() { $builder = new ContainerBuilder(); @@ -173,11 +148,6 @@ public function testGetServiceIds() $this->assertEquals(array('foo', 'bar', 'service_container'), $builder->getServiceIds(), '->getServiceIds() returns all defined service ids'); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::setAlias - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::hasAlias - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getAlias - */ public function testAliases() { $builder = new ContainerBuilder(); @@ -204,9 +174,6 @@ public function testAliases() } } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getAliases - */ public function testGetAliases() { $builder = new ContainerBuilder(); @@ -229,9 +196,6 @@ public function testGetAliases() $this->assertCount(0, $builder->getAliases(), '->getAliases() does not return aliased services that have been overridden'); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::setAliases - */ public function testSetAliases() { $builder = new ContainerBuilder(); @@ -242,9 +206,6 @@ public function testSetAliases() $this->assertTrue(isset($aliases['foobar'])); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::addAliases - */ public function testAddAliases() { $builder = new ContainerBuilder(); @@ -256,10 +217,6 @@ public function testAddAliases() $this->assertTrue(isset($aliases['foobar'])); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::addCompilerPass - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getCompilerPassConfig - */ public function testAddGetCompilerPass() { $builder = new ContainerBuilder(); @@ -270,9 +227,6 @@ public function testAddGetCompilerPass() $this->assertCount(count($builder->getCompiler()->getPassConfig()->getPasses()) - 1, $builderCompilerPasses); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService - */ public function testCreateService() { $builder = new ContainerBuilder(); @@ -283,9 +237,6 @@ public function testCreateService() $this->assertInstanceOf('\FooClass', $builder->get('foo2'), '->createService() replaces parameters in the file provided by the service definition'); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService - */ public function testCreateProxyWithRealServiceInstantiator() { $builder = new ContainerBuilder(); @@ -299,9 +250,6 @@ public function testCreateProxyWithRealServiceInstantiator() $this->assertSame('FooClass', get_class($foo1)); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService - */ public function testCreateServiceClass() { $builder = new ContainerBuilder(); @@ -310,9 +258,6 @@ public function testCreateServiceClass() $this->assertInstanceOf('\stdClass', $builder->get('foo1'), '->createService() replaces parameters in the class provided by the service definition'); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService - */ public function testCreateServiceArguments() { $builder = new ContainerBuilder(); @@ -322,9 +267,6 @@ public function testCreateServiceArguments() $this->assertEquals(array('foo' => 'bar', 'bar' => 'foo', $builder->get('bar'), '%unescape_it%'), $builder->get('foo1')->arguments, '->createService() replaces parameters and service references in the arguments provided by the service definition'); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService - */ public function testCreateServiceFactoryMethod() { $builder = new ContainerBuilder(); @@ -341,9 +283,6 @@ public function testCreateServiceFactoryMethod() $this->assertEquals(array('foo' => 'bar', 'bar' => 'foo', $builder->get('bar')), $builder->get('foo1')->arguments, '->createService() passes the arguments to the factory method'); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService - */ public function testCreateServiceFactoryService() { $builder = new ContainerBuilder(); @@ -357,9 +296,6 @@ public function testCreateServiceFactoryService() $this->assertTrue($builder->get('foo')->called, '->createService() calls the factory method to create the service instance'); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService - */ public function testCreateServiceMethodCalls() { $builder = new ContainerBuilder(); @@ -369,9 +305,24 @@ public function testCreateServiceMethodCalls() $this->assertEquals(array('bar', $builder->get('bar')), $builder->get('foo1')->bar, '->createService() replaces the values in the method calls arguments'); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService - */ + public function testCreateServiceMethodCallsWithEscapedParam() + { + $builder = new ContainerBuilder(); + $builder->register('bar', 'stdClass'); + $builder->register('foo1', 'FooClass')->addMethodCall('setBar', array(array('%%unescape_it%%'))); + $builder->setParameter('value', 'bar'); + $this->assertEquals(array('%unescape_it%'), $builder->get('foo1')->bar, '->createService() replaces the values in the method calls arguments'); + } + + public function testCreateServiceProperties() + { + $builder = new ContainerBuilder(); + $builder->register('bar', 'stdClass'); + $builder->register('foo1', 'FooClass')->setProperty('bar', array('%value%', new Reference('bar'), '%%unescape_it%%')); + $builder->setParameter('value', 'bar'); + $this->assertEquals(array('bar', $builder->get('bar'), '%unescape_it%'), $builder->get('foo1')->bar, '->createService() replaces the values in the properties'); + } + public function testCreateServiceConfigurator() { $builder = new ContainerBuilder(); @@ -396,7 +347,6 @@ public function testCreateServiceConfigurator() } /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService * @expectedException \RuntimeException */ public function testCreateSyntheticService() @@ -406,9 +356,6 @@ public function testCreateSyntheticService() $builder->get('foo'); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::resolveServices - */ public function testResolveServices() { $builder = new ContainerBuilder(); @@ -417,9 +364,6 @@ public function testResolveServices() $this->assertEquals(array('foo' => array('foo', $builder->get('foo'))), $builder->resolveServices(array('foo' => array('foo', new Reference('foo')))), '->resolveServices() resolves service references to service instances in nested arrays'); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::merge - */ public function testMerge() { $container = new ContainerBuilder(new ParameterBag(array('bar' => 'foo'))); @@ -467,7 +411,6 @@ public function testMerge() } /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::merge * @expectedException \LogicException */ public function testMergeLogicException() @@ -478,9 +421,6 @@ public function testMergeLogicException() $container->merge(new ContainerBuilder()); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::findTaggedServiceIds - */ public function testfindTaggedServiceIds() { $builder = new ContainerBuilder(); @@ -499,9 +439,6 @@ public function testfindTaggedServiceIds() $this->assertEquals(array(), $builder->findTaggedServiceIds('foobar'), '->findTaggedServiceIds() returns an empty array if there is annotated services'); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::findDefinition - */ public function testFindDefinition() { $container = new ContainerBuilder(); @@ -511,9 +448,6 @@ public function testFindDefinition() $this->assertEquals($definition, $container->findDefinition('foobar'), '->findDefinition() returns a Definition'); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::addObjectResource - */ public function testAddObjectResource() { $container = new ContainerBuilder(); @@ -537,9 +471,6 @@ public function testAddObjectResource() $this->assertSame(realpath(__DIR__.'/Fixtures/includes/classes.php'), realpath($resource->getResource())); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::addClassResource - */ public function testAddClassResource() { $container = new ContainerBuilder(); @@ -563,9 +494,6 @@ public function testAddClassResource() $this->assertSame(realpath(__DIR__.'/Fixtures/includes/classes.php'), realpath($resource->getResource())); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::compile - */ public function testCompilesClassDefinitionsOfLazyServices() { $container = new ContainerBuilder(); @@ -588,10 +516,6 @@ function (ResourceInterface $resource) use ($classesPath) { $this->assertNotEmpty($matchingResources); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getResources - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::addResource - */ public function testResources() { $container = new ContainerBuilder(); @@ -608,10 +532,6 @@ public function testResources() $this->assertEquals(array(), $container->getResources()); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::registerExtension - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getExtension - */ public function testExtension() { $container = new ContainerBuilder(); @@ -757,10 +677,6 @@ public function testThrowsExceptionWhenSetDefinitionOnAFrozenContainer() $container->setDefinition('a', new Definition()); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getExtensionConfig - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::prependExtensionConfig - */ public function testExtensionConfig() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php index e2d4ab13f5bf7..5acc3c3b842e2 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -19,9 +19,6 @@ class ContainerTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\DependencyInjection\Container::__construct - */ public function testConstructor() { $sc = new Container(); @@ -55,9 +52,6 @@ public function dataForTestCamelize() ); } - /** - * @covers Symfony\Component\DependencyInjection\Container::compile - */ public function testCompile() { $sc = new Container(new ParameterBag(array('foo' => 'bar'))); @@ -66,9 +60,6 @@ public function testCompile() $this->assertEquals(array('foo' => 'bar'), $sc->getParameterBag()->all(), '->compile() copies the current parameters to the new parameter bag'); } - /** - * @covers Symfony\Component\DependencyInjection\Container::isFrozen - */ public function testIsFrozen() { $sc = new Container(new ParameterBag(array('foo' => 'bar'))); @@ -77,19 +68,12 @@ public function testIsFrozen() $this->assertTrue($sc->isFrozen(), '->isFrozen() returns true if the parameters are frozen'); } - /** - * @covers Symfony\Component\DependencyInjection\Container::getParameterBag - */ public function testGetParameterBag() { $sc = new Container(); $this->assertEquals(array(), $sc->getParameterBag()->all(), '->getParameterBag() returns an empty array if no parameter has been defined'); } - /** - * @covers Symfony\Component\DependencyInjection\Container::setParameter - * @covers Symfony\Component\DependencyInjection\Container::getParameter - */ public function testGetSetParameter() { $sc = new Container(new ParameterBag(array('foo' => 'bar'))); @@ -112,9 +96,6 @@ public function testGetSetParameter() } } - /** - * @covers Symfony\Component\DependencyInjection\Container::getServiceIds - */ public function testGetServiceIds() { $sc = new Container(); @@ -126,9 +107,6 @@ public function testGetServiceIds() $this->assertEquals(array('scoped', 'scoped_foo', 'inactive', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'service_container'), $sc->getServiceIds(), '->getServiceIds() returns defined service ids by getXXXService() methods'); } - /** - * @covers Symfony\Component\DependencyInjection\Container::set - */ public function testSet() { $sc = new Container(); @@ -136,9 +114,6 @@ public function testSet() $this->assertEquals($foo, $sc->get('foo'), '->set() sets a service'); } - /** - * @covers Symfony\Component\DependencyInjection\Container::set - */ public function testSetWithNullResetTheService() { $sc = new Container(); @@ -177,9 +152,6 @@ public function testSetAlsoSetsScopedService() $this->assertSame($foo, $services['foo']['foo']); } - /** - * @covers Symfony\Component\DependencyInjection\Container::get - */ public function testGet() { $sc = new ProjectServiceContainer(); @@ -238,18 +210,12 @@ public function testGetCircularReference() } } - /** - * @covers Symfony\Component\DependencyInjection\Container::get - */ public function testGetReturnsNullOnInactiveScope() { $sc = new ProjectServiceContainer(); $this->assertNull($sc->get('inactive', ContainerInterface::NULL_ON_INVALID_REFERENCE)); } - /** - * @covers Symfony\Component\DependencyInjection\Container::has - */ public function testHas() { $sc = new ProjectServiceContainer(); @@ -262,9 +228,6 @@ public function testHas() $this->assertTrue($sc->has('foo\\baz'), '->has() returns true if a get*Method() is defined'); } - /** - * @covers Symfony\Component\DependencyInjection\Container::initialized - */ public function testInitialized() { $sc = new ProjectServiceContainer(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php index 4fcef3828dc6f..6a1da0698cd3e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php @@ -15,9 +15,6 @@ class DefinitionTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\DependencyInjection\Definition::__construct - */ public function testConstructor() { $def = new Definition('stdClass'); @@ -51,10 +48,6 @@ public function testSetGetFactoryService() $this->assertEquals('foo.bar', $def->getFactoryService(), '->getFactoryService() returns current service to construct this service.'); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::setClass - * @covers Symfony\Component\DependencyInjection\Definition::getClass - */ public function testSetGetClass() { $def = new Definition('stdClass'); @@ -62,11 +55,6 @@ public function testSetGetClass() $this->assertEquals('foo', $def->getClass(), '->getClass() returns the class name'); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::setArguments - * @covers Symfony\Component\DependencyInjection\Definition::getArguments - * @covers Symfony\Component\DependencyInjection\Definition::addArgument - */ public function testArguments() { $def = new Definition('stdClass'); @@ -76,12 +64,6 @@ public function testArguments() $this->assertEquals(array('foo', 'bar'), $def->getArguments(), '->addArgument() adds an argument'); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::setMethodCalls - * @covers Symfony\Component\DependencyInjection\Definition::addMethodCall - * @covers Symfony\Component\DependencyInjection\Definition::hasMethodCall - * @covers Symfony\Component\DependencyInjection\Definition::removeMethodCall - */ public function testMethodCalls() { $def = new Definition('stdClass'); @@ -105,10 +87,6 @@ public function testExceptionOnEmptyMethodCall() $def->addMethodCall(''); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::setFile - * @covers Symfony\Component\DependencyInjection\Definition::getFile - */ public function testSetGetFile() { $def = new Definition('stdClass'); @@ -116,10 +94,6 @@ public function testSetGetFile() $this->assertEquals('foo', $def->getFile(), '->getFile() returns the file to include'); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::setScope - * @covers Symfony\Component\DependencyInjection\Definition::getScope - */ public function testSetGetScope() { $def = new Definition('stdClass'); @@ -128,10 +102,6 @@ public function testSetGetScope() $this->assertEquals('foo', $def->getScope()); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::setPublic - * @covers Symfony\Component\DependencyInjection\Definition::isPublic - */ public function testSetIsPublic() { $def = new Definition('stdClass'); @@ -140,10 +110,6 @@ public function testSetIsPublic() $this->assertFalse($def->isPublic(), '->isPublic() returns false if the instance must not be public.'); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::setSynthetic - * @covers Symfony\Component\DependencyInjection\Definition::isSynthetic - */ public function testSetIsSynthetic() { $def = new Definition('stdClass'); @@ -152,10 +118,6 @@ public function testSetIsSynthetic() $this->assertTrue($def->isSynthetic(), '->isSynthetic() returns true if the service is synthetic.'); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::setSynchronized - * @covers Symfony\Component\DependencyInjection\Definition::isSynchronized - */ public function testSetIsSynchronized() { $def = new Definition('stdClass'); @@ -164,10 +126,6 @@ public function testSetIsSynchronized() $this->assertTrue($def->isSynchronized(), '->isSynchronized() returns true if the service is synchronized.'); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::setLazy - * @covers Symfony\Component\DependencyInjection\Definition::isLazy - */ public function testSetIsLazy() { $def = new Definition('stdClass'); @@ -176,10 +134,6 @@ public function testSetIsLazy() $this->assertTrue($def->isLazy(), '->isLazy() returns true if the service is lazy.'); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::setAbstract - * @covers Symfony\Component\DependencyInjection\Definition::isAbstract - */ public function testSetIsAbstract() { $def = new Definition('stdClass'); @@ -188,10 +142,6 @@ public function testSetIsAbstract() $this->assertTrue($def->isAbstract(), '->isAbstract() returns true if the instance must not be public.'); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::setConfigurator - * @covers Symfony\Component\DependencyInjection\Definition::getConfigurator - */ public function testSetGetConfigurator() { $def = new Definition('stdClass'); @@ -199,9 +149,6 @@ public function testSetGetConfigurator() $this->assertEquals('foo', $def->getConfigurator(), '->getConfigurator() returns the configurator'); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::clearTags - */ public function testClearTags() { $def = new Definition('stdClass'); @@ -211,9 +158,6 @@ public function testClearTags() $this->assertEquals(array(), $def->getTags(), '->clearTags() removes all current tags'); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::clearTags - */ public function testClearTag() { $def = new Definition('stdClass'); @@ -230,12 +174,6 @@ public function testClearTag() $this->assertTrue($def->hasTag('3foo3')); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::addTag - * @covers Symfony\Component\DependencyInjection\Definition::getTag - * @covers Symfony\Component\DependencyInjection\Definition::getTags - * @covers Symfony\Component\DependencyInjection\Definition::hasTag - */ public function testTags() { $def = new Definition('stdClass'); @@ -253,9 +191,6 @@ public function testTags() ), '->getTags() returns all tags'); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::replaceArgument - */ public function testSetArgument() { $def = new Definition('stdClass'); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml index d9dc85265f190..b79697b6e9399 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml @@ -8,7 +8,7 @@ services: file: { class: FooClass, file: %path%/foo.php } arguments: { class: FooClass, arguments: [foo, '@foo', [true, false]] } configurator1: { class: FooClass, configurator: sc_configure } - configurator2: { class: FooClass, configurator: [@baz, configure] } + configurator2: { class: FooClass, configurator: ['@baz', configure] } configurator3: { class: FooClass, configurator: [BazClass, configureStatic] } method_call1: class: FooClass diff --git a/src/Symfony/Component/DependencyInjection/Tests/LazyProxy/Instantiator/RealServiceInstantiatorTest.php b/src/Symfony/Component/DependencyInjection/Tests/LazyProxy/Instantiator/RealServiceInstantiatorTest.php index cb4402499d24f..6dcf25d2bee10 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/LazyProxy/Instantiator/RealServiceInstantiatorTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/LazyProxy/Instantiator/RealServiceInstantiatorTest.php @@ -18,8 +18,6 @@ * Tests for {@see \Symfony\Component\DependencyInjection\Instantiator\RealServiceInstantiator}. * * @author Marco Pivetta - * - * @covers \Symfony\Component\DependencyInjection\LazyProxy\Instantiator\RealServiceInstantiator */ class RealServiceInstantiatorTest extends \PHPUnit_Framework_TestCase { diff --git a/src/Symfony/Component/DependencyInjection/Tests/LazyProxy/PhpDumper/NullDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/LazyProxy/PhpDumper/NullDumperTest.php index 2081ebcf46fca..1fcedca5f98c4 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/LazyProxy/PhpDumper/NullDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/LazyProxy/PhpDumper/NullDumperTest.php @@ -18,8 +18,6 @@ * Tests for {@see \Symfony\Component\DependencyInjection\PhpDumper\NullDumper}. * * @author Marco Pivetta - * - * @covers \Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\NullDumper */ class NullDumperTest extends \PHPUnit_Framework_TestCase { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/ClosureLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/ClosureLoaderTest.php index 483e30b78b818..be057313ab909 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/ClosureLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/ClosureLoaderTest.php @@ -16,9 +16,6 @@ class ClosureLoaderTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\DependencyInjection\Loader\ClosureLoader::supports - */ public function testSupports() { $loader = new ClosureLoader(new ContainerBuilder()); @@ -27,9 +24,6 @@ public function testSupports() $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable'); } - /** - * @covers Symfony\Component\DependencyInjection\Loader\ClosureLoader::load - */ public function testLoad() { $loader = new ClosureLoader($container = new ContainerBuilder()); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php index 9188018b2b7db..cab44b20c74cc 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php @@ -33,10 +33,6 @@ protected function setUp() $this->loader = new IniFileLoader($this->container, new FileLocator(self::$fixturesPath.'/ini')); } - /** - * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::__construct - * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::load - */ public function testIniFileCanBeLoaded() { $this->loader->load('parameters.ini'); @@ -44,9 +40,6 @@ public function testIniFileCanBeLoaded() } /** - * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::__construct - * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::load - * * @expectedException \InvalidArgumentException * @expectedExceptionMessage The file "foo.ini" does not exist (in: */ @@ -56,9 +49,6 @@ public function testExceptionIsRaisedWhenIniFileDoesNotExist() } /** - * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::__construct - * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::load - * * @expectedException \InvalidArgumentException * @expectedExceptionMessage The "nonvalid.ini" file is not valid. */ @@ -67,9 +57,6 @@ public function testExceptionIsRaisedWhenIniFileCannotBeParsed() @$this->loader->load('nonvalid.ini'); } - /** - * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::supports - */ public function testSupports() { $loader = new IniFileLoader(new ContainerBuilder(), new FileLocator()); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php index 5ae097ca7d1e9..00b957b73115e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php @@ -17,9 +17,6 @@ class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\DependencyInjection\Loader\PhpFileLoader::supports - */ public function testSupports() { $loader = new PhpFileLoader(new ContainerBuilder(), new FileLocator()); @@ -28,9 +25,6 @@ public function testSupports() $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable'); } - /** - * @covers Symfony\Component\DependencyInjection\Loader\PhpFileLoader::load - */ public function testLoad() { $loader = new PhpFileLoader($container = new ContainerBuilder(), new FileLocator()); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index 9c6fd2bdd692d..c0e39ef7ad15c 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -329,9 +329,6 @@ public function testExtensionInPhar() } } - /** - * @covers Symfony\Component\DependencyInjection\Loader\XmlFileLoader::supports - */ public function testSupports() { $loader = new XmlFileLoader(new ContainerBuilder(), new FileLocator()); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index 7d6b76bce9d44..bd53da0d5f510 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -179,9 +179,6 @@ public function testExtensions() } } - /** - * @covers Symfony\Component\DependencyInjection\Loader\YamlFileLoader::supports - */ public function testSupports() { $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator()); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php index 6d963dc054566..b87ca916bbfe5 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php @@ -15,9 +15,6 @@ class FrozenParameterBagTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag::__construct - */ public function testConstructor() { $parameters = array( @@ -29,7 +26,6 @@ public function testConstructor() } /** - * @covers Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag::clear * @expectedException \LogicException */ public function testClear() @@ -39,7 +35,6 @@ public function testClear() } /** - * @covers Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag::set * @expectedException \LogicException */ public function testSet() @@ -49,7 +44,6 @@ public function testSet() } /** - * @covers Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag::add * @expectedException \LogicException */ public function testAdd() diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php index e1f8169f8851a..39dfb48455b47 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php @@ -18,9 +18,6 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::__construct - */ public function testConstructor() { $bag = new ParameterBag($parameters = array( @@ -30,9 +27,6 @@ public function testConstructor() $this->assertEquals($parameters, $bag->all(), '__construct() takes an array of parameters as its first argument'); } - /** - * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::clear - */ public function testClear() { $bag = new ParameterBag($parameters = array( @@ -43,9 +37,6 @@ public function testClear() $this->assertEquals(array(), $bag->all(), '->clear() removes all parameters'); } - /** - * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::remove - */ public function testRemove() { $bag = new ParameterBag(array( @@ -58,10 +49,6 @@ public function testRemove() $this->assertEquals(array(), $bag->all(), '->remove() converts key to lowercase before removing'); } - /** - * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::get - * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::set - */ public function testGetSet() { $bag = new ParameterBag(array('foo' => 'bar')); @@ -117,9 +104,6 @@ public function testGetThrowParameterNotFoundException() } } - /** - * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::has - */ public function testHas() { $bag = new ParameterBag(array('foo' => 'bar')); @@ -128,9 +112,6 @@ public function testHas() $this->assertFalse($bag->has('bar'), '->has() returns false if a parameter is not defined'); } - /** - * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::resolveValue - */ public function testResolveValue() { $bag = new ParameterBag(array()); @@ -198,9 +179,6 @@ public function testResolveValue() $this->assertEquals('foo.bar:1337', $bag->resolveValue('%host%:%port%')); } - /** - * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::resolve - */ public function testResolveIndicatesWhyAParameterIsNeeded() { $bag = new ParameterBag(array('foo' => '%bar%')); @@ -220,9 +198,6 @@ public function testResolveIndicatesWhyAParameterIsNeeded() } } - /** - * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::resolve - */ public function testResolveUnescapesValue() { $bag = new ParameterBag(array( @@ -236,9 +211,6 @@ public function testResolveUnescapesValue() $this->assertEquals(array('bar' => array('ding' => 'I\'m a bar %foo %bar')), $bag->get('foo'), '->resolveValue() supports % escaping by doubling it'); } - /** - * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::escapeValue - */ public function testEscapeValue() { $bag = new ParameterBag(); @@ -253,7 +225,6 @@ public function testEscapeValue() } /** - * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::resolve * @dataProvider stringsWithSpacesProvider */ public function testResolveStringWithSpacesReturnsString($expected, $test, $description) diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterTest.php index bed188e95c04e..571ca029881f0 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ParameterTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterTest.php @@ -15,9 +15,6 @@ class ParameterTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\DependencyInjection\Parameter::__construct - */ public function testConstructor() { $ref = new Parameter('foo'); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ReferenceTest.php b/src/Symfony/Component/DependencyInjection/Tests/ReferenceTest.php index f14e99f926842..6800267c96b10 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ReferenceTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ReferenceTest.php @@ -15,9 +15,6 @@ class ReferenceTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\DependencyInjection\Reference::__construct - */ public function testConstructor() { $ref = new Reference('foo'); diff --git a/src/Symfony/Component/DependencyInjection/composer.json b/src/Symfony/Component/DependencyInjection/composer.json index 9c813a59483eb..e7691eb8822ba 100644 --- a/src/Symfony/Component/DependencyInjection/composer.json +++ b/src/Symfony/Component/DependencyInjection/composer.json @@ -28,7 +28,10 @@ "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them" }, "autoload": { - "psr-0": { "Symfony\\Component\\DependencyInjection\\": "" } + "psr-0": { "Symfony\\Component\\DependencyInjection\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/DependencyInjection", "minimum-stability": "dev", diff --git a/src/Symfony/Component/DependencyInjection/phpunit.xml.dist b/src/Symfony/Component/DependencyInjection/phpunit.xml.dist index 17a217226da3d..86252d0456ba9 100644 --- a/src/Symfony/Component/DependencyInjection/phpunit.xml.dist +++ b/src/Symfony/Component/DependencyInjection/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ diff --git a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php index ca7802d45d4f8..55a5942e0d413 100644 --- a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php @@ -24,9 +24,6 @@ public function testConstructor() $this->assertCount(1, $crawler, '__construct() takes a node as a first argument'); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::add - */ public function testAdd() { $crawler = new Crawler(); @@ -62,9 +59,6 @@ public function testAddInvalidNode() $crawler->add(1); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::addHtmlContent - */ public function testAddHtmlContent() { $crawler = new Crawler(); @@ -79,7 +73,6 @@ public function testAddHtmlContent() } /** - * @covers Symfony\Component\DomCrawler\Crawler::addHtmlContent * @requires extension mbstring */ public function testAddHtmlContentCharset() @@ -90,9 +83,6 @@ public function testAddHtmlContentCharset() $this->assertEquals('Tiếng Việt', $crawler->filterXPath('//div')->text()); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::addHtmlContent - */ public function testAddHtmlContentInvalidBaseTag() { $crawler = new Crawler(null, 'http://symfony.com'); @@ -102,9 +92,6 @@ public function testAddHtmlContentInvalidBaseTag() $this->assertEquals('http://symfony.com/contact', current($crawler->filterXPath('//a')->links())->getUri(), '->addHtmlContent() correctly handles a non-existent base tag href attribute'); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::addHtmlContent - */ public function testAddHtmlContentUnsupportedCharset() { $crawler = new Crawler(); @@ -114,7 +101,6 @@ public function testAddHtmlContentUnsupportedCharset() } /** - * @covers Symfony\Component\DomCrawler\Crawler::addHtmlContent * @requires extension mbstring */ public function testAddHtmlContentCharsetGbk() @@ -126,9 +112,6 @@ public function testAddHtmlContentCharsetGbk() $this->assertEquals('中文', $crawler->filterXPath('//p')->text()); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::addHtmlContent - */ public function testAddHtmlContentWithErrors() { $internalErrors = libxml_use_internal_errors(true); @@ -154,9 +137,6 @@ public function testAddHtmlContentWithErrors() libxml_use_internal_errors($internalErrors); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::addXmlContent - */ public function testAddXmlContent() { $crawler = new Crawler(); @@ -165,9 +145,6 @@ public function testAddXmlContent() $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->addXmlContent() adds nodes from an XML string'); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::addXmlContent - */ public function testAddXmlContentCharset() { $crawler = new Crawler(); @@ -176,9 +153,6 @@ public function testAddXmlContentCharset() $this->assertEquals('Tiếng Việt', $crawler->filterXPath('//div')->text()); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::addXmlContent - */ public function testAddXmlContentWithErrors() { $internalErrors = libxml_use_internal_errors(true); @@ -202,9 +176,6 @@ public function testAddXmlContentWithErrors() libxml_use_internal_errors($internalErrors); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::addContent - */ public function testAddContent() { $crawler = new Crawler(); @@ -240,9 +211,6 @@ public function testAddContent() $this->assertEquals('日本語', $crawler->filterXPath('//body')->text(), '->addContent() can recognize "Shift_JIS" in html5 meta charset tag'); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::addDocument - */ public function testAddDocument() { $crawler = new Crawler(); @@ -251,9 +219,6 @@ public function testAddDocument() $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->addDocument() adds nodes from a \DOMDocument'); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::addNodeList - */ public function testAddNodeList() { $crawler = new Crawler(); @@ -262,9 +227,6 @@ public function testAddNodeList() $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->addNodeList() adds nodes from a \DOMNodeList'); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::addNodes - */ public function testAddNodes() { foreach ($this->createNodeList() as $node) { @@ -277,9 +239,6 @@ public function testAddNodes() $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->addNodes() adds nodes from an array of nodes'); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::addNode - */ public function testAddNode() { $crawler = new Crawler(); @@ -396,9 +355,6 @@ public function testFilterXpathComplexQueries() $this->assertCount(7, $crawler->filterXPath('( ( //a | //div )//img | //ul )')); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::filterXPath - */ public function testFilterXPath() { $crawler = $this->createTestCrawler(); @@ -512,9 +468,6 @@ public function testFilterXPathWithSelfAxes() $this->assertCount(9, $crawler->filterXPath('self::*/a')); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::filter - */ public function testFilter() { $crawler = $this->createTestCrawler(); diff --git a/src/Symfony/Component/DomCrawler/composer.json b/src/Symfony/Component/DomCrawler/composer.json index dda76b8fc704c..6ce2171e66980 100644 --- a/src/Symfony/Component/DomCrawler/composer.json +++ b/src/Symfony/Component/DomCrawler/composer.json @@ -25,7 +25,10 @@ "symfony/css-selector": "" }, "autoload": { - "psr-0": { "Symfony\\Component\\DomCrawler\\": "" } + "psr-0": { "Symfony\\Component\\DomCrawler\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/DomCrawler", "minimum-stability": "dev", diff --git a/src/Symfony/Component/EventDispatcher/composer.json b/src/Symfony/Component/EventDispatcher/composer.json index 18703ac346a07..c48b1417f62e2 100644 --- a/src/Symfony/Component/EventDispatcher/composer.json +++ b/src/Symfony/Component/EventDispatcher/composer.json @@ -26,7 +26,10 @@ "symfony/http-kernel": "" }, "autoload": { - "psr-0": { "Symfony\\Component\\EventDispatcher\\": "" } + "psr-0": { "Symfony\\Component\\EventDispatcher\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/EventDispatcher", "minimum-stability": "dev", diff --git a/src/Symfony/Component/EventDispatcher/phpunit.xml.dist b/src/Symfony/Component/EventDispatcher/phpunit.xml.dist index b14fde575007d..ae0586e0b33de 100644 --- a/src/Symfony/Component/EventDispatcher/phpunit.xml.dist +++ b/src/Symfony/Component/EventDispatcher/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ diff --git a/src/Symfony/Component/Filesystem/composer.json b/src/Symfony/Component/Filesystem/composer.json index 70a5839126e14..8dce266b59056 100644 --- a/src/Symfony/Component/Filesystem/composer.json +++ b/src/Symfony/Component/Filesystem/composer.json @@ -19,7 +19,10 @@ "php": ">=5.3.3" }, "autoload": { - "psr-0": { "Symfony\\Component\\Filesystem\\": "" } + "psr-0": { "Symfony\\Component\\Filesystem\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/Filesystem", "minimum-stability": "dev", diff --git a/src/Symfony/Component/Filesystem/phpunit.xml.dist b/src/Symfony/Component/Filesystem/phpunit.xml.dist index 32444185a1edc..d066ed7969868 100644 --- a/src/Symfony/Component/Filesystem/phpunit.xml.dist +++ b/src/Symfony/Component/Filesystem/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -20,6 +21,7 @@ ./ ./Tests + ./vendor diff --git a/src/Symfony/Component/Finder/composer.json b/src/Symfony/Component/Finder/composer.json index 6b5e01d9b1a5f..5572f2937be04 100644 --- a/src/Symfony/Component/Finder/composer.json +++ b/src/Symfony/Component/Finder/composer.json @@ -19,7 +19,10 @@ "php": ">=5.3.3" }, "autoload": { - "psr-0": { "Symfony\\Component\\Finder\\": "" } + "psr-0": { "Symfony\\Component\\Finder\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/Finder", "minimum-stability": "dev", diff --git a/src/Symfony/Component/Finder/phpunit.xml.dist b/src/Symfony/Component/Finder/phpunit.xml.dist index bc38ccaa45d1d..631e570b9479f 100644 --- a/src/Symfony/Component/Finder/phpunit.xml.dist +++ b/src/Symfony/Component/Finder/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php index 79423cea3bc48..7cc3d5c805369 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php @@ -132,7 +132,7 @@ public function reverseTransform($value) throw new TransformationFailedException('I don\'t have a clear idea what infinity looks like'); } - if (function_exists('mb_detect_encoding') && false !== $encoding = mb_detect_encoding($value)) { + if (function_exists('mb_detect_encoding') && false !== $encoding = mb_detect_encoding($value, null, true)) { $length = mb_strlen($value, $encoding); $remainder = mb_substr($value, $position, $length, $encoding); } else { diff --git a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php index 31ea45f3d5261..f323de0fd2d40 100644 --- a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php +++ b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Form\Extension\Csrf\CsrfProvider; +use Symfony\Component\Security\Core\Util\StringUtils; + /** * Default implementation of CsrfProviderInterface. * @@ -54,7 +56,17 @@ public function generateCsrfToken($intention) */ public function isCsrfTokenValid($intention, $token) { - return $token === $this->generateCsrfToken($intention); + $expectedToken = $this->generateCsrfToken($intention); + + if (function_exists('hash_equals')) { + return hash_equals($expectedToken, $token); + } + + if (class_exists('Symfony\Component\Security\Core\Util\StringUtils')) { + return StringUtils::equals($expectedToken, $token); + } + + return $token === $expectedToken; } /** diff --git a/src/Symfony/Component/Form/composer.json b/src/Symfony/Component/Form/composer.json index b42fdf6916d07..00f185208cc5b 100644 --- a/src/Symfony/Component/Form/composer.json +++ b/src/Symfony/Component/Form/composer.json @@ -33,7 +33,10 @@ "symfony/http-foundation": "" }, "autoload": { - "psr-0": { "Symfony\\Component\\Form\\": "" } + "psr-0": { "Symfony\\Component\\Form\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/Form", "minimum-stability": "dev", diff --git a/src/Symfony/Component/Form/phpunit.xml.dist b/src/Symfony/Component/Form/phpunit.xml.dist index 104aee4b0b52d..1c4acf476238d 100644 --- a/src/Symfony/Component/Form/phpunit.xml.dist +++ b/src/Symfony/Component/Form/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -19,6 +20,7 @@ ./ + ./Resources ./Tests ./vendor diff --git a/src/Symfony/Component/HttpFoundation/ParameterBag.php b/src/Symfony/Component/HttpFoundation/ParameterBag.php index 125a4d041cb42..7df267db02ddb 100644 --- a/src/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/src/Symfony/Component/HttpFoundation/ParameterBag.php @@ -172,7 +172,7 @@ public function remove($key) * Returns the alphabetic characters of the parameter value. * * @param string $key The parameter key - * @param mixed $default The default value if the parameter key does not exist + * @param string $default The default value if the parameter key does not exist * @param bool $deep If true, a path like foo[bar] will find deeper items * * @return string The filtered value @@ -186,7 +186,7 @@ public function getAlpha($key, $default = '', $deep = false) * Returns the alphabetic characters and digits of the parameter value. * * @param string $key The parameter key - * @param mixed $default The default value if the parameter key does not exist + * @param string $default The default value if the parameter key does not exist * @param bool $deep If true, a path like foo[bar] will find deeper items * * @return string The filtered value @@ -200,7 +200,7 @@ public function getAlnum($key, $default = '', $deep = false) * Returns the digits of the parameter value. * * @param string $key The parameter key - * @param mixed $default The default value if the parameter key does not exist + * @param string $default The default value if the parameter key does not exist * @param bool $deep If true, a path like foo[bar] will find deeper items * * @return string The filtered value @@ -215,7 +215,7 @@ public function getDigits($key, $default = '', $deep = false) * Returns the parameter value converted to integer. * * @param string $key The parameter key - * @param mixed $default The default value if the parameter key does not exist + * @param int $default The default value if the parameter key does not exist * @param bool $deep If true, a path like foo[bar] will find deeper items * * @return int The filtered value diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index 3c37187cd1e6b..ad55f8772af47 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -412,7 +412,7 @@ public function setStatusCode($code, $text = null) } if (null === $text) { - $this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] : ''; + $this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] : 'unknown status'; return $this; } diff --git a/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php b/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php index b3bd4f6e4b2b6..fd90103e42e3d 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php @@ -41,7 +41,6 @@ public function invalidNames() /** * @dataProvider invalidNames * @expectedException \InvalidArgumentException - * @covers Symfony\Component\HttpFoundation\Cookie::__construct */ public function testInstantiationThrowsExceptionIfCookieNameContainsInvalidCharacters($name) { @@ -56,9 +55,6 @@ public function testInvalidExpiration() $cookie = new Cookie('MyCookie', 'foo', 'bar'); } - /** - * @covers Symfony\Component\HttpFoundation\Cookie::getValue - */ public function testGetValue() { $value = 'MyValue'; diff --git a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php index ada9ac0d1eaae..d4d02d94fead1 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php @@ -15,9 +15,6 @@ class HeaderBagTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\HttpFoundation\HeaderBag::__construct - */ public function testConstructor() { $bag = new HeaderBag(array('foo' => 'bar')); @@ -67,9 +64,6 @@ public function testGetCacheControlHeader() $this->assertEquals('#a', $bag->getCacheControlDirective('public')); } - /** - * @covers Symfony\Component\HttpFoundation\HeaderBag::all - */ public function testAll() { $bag = new HeaderBag(array('foo' => 'bar')); @@ -79,9 +73,6 @@ public function testAll() $this->assertEquals(array('foo' => array('BAR')), $bag->all(), '->all() gets all the input key are lower case'); } - /** - * @covers Symfony\Component\HttpFoundation\HeaderBag::replace - */ public function testReplace() { $bag = new HeaderBag(array('foo' => 'bar')); @@ -91,9 +82,6 @@ public function testReplace() $this->assertFalse($bag->has('foo'), '->replace() overrides previously set the input'); } - /** - * @covers Symfony\Component\HttpFoundation\HeaderBag::get - */ public function testGet() { $bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz')); @@ -119,9 +107,6 @@ public function testSetAssociativeArray() $this->assertEquals(array('value'), $bag->get('foo', 'nope', false), 'assoc indices of multi-valued headers are ignored'); } - /** - * @covers Symfony\Component\HttpFoundation\HeaderBag::contains - */ public function testContains() { $bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz')); @@ -186,9 +171,6 @@ public function testCacheControlDirectiveOverrideWithReplace() $this->assertEquals(10, $bag->getCacheControlDirective('max-age')); } - /** - * @covers Symfony\Component\HttpFoundation\HeaderBag::getIterator - */ public function testGetIterator() { $headers = array('foo' => 'bar', 'hello' => 'world', 'third' => 'charm'); @@ -203,9 +185,6 @@ public function testGetIterator() $this->assertEquals(count($headers), $i); } - /** - * @covers Symfony\Component\HttpFoundation\HeaderBag::count - */ public function testCount() { $headers = array('foo' => 'bar', 'HELLO' => 'WORLD'); diff --git a/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php index 2044d97a6fcb8..453414aa99004 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php @@ -15,17 +15,11 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\HttpFoundation\ParameterBag::__construct - */ public function testConstructor() { $this->testAll(); } - /** - * @covers Symfony\Component\HttpFoundation\ParameterBag::all - */ public function testAll() { $bag = new ParameterBag(array('foo' => 'bar')); @@ -54,9 +48,6 @@ public function testRemove() $this->assertEquals(array('foo' => 'bar'), $bag->all()); } - /** - * @covers Symfony\Component\HttpFoundation\ParameterBag::replace - */ public function testReplace() { $bag = new ParameterBag(array('foo' => 'bar')); @@ -66,9 +57,6 @@ public function testReplace() $this->assertFalse($bag->has('foo'), '->replace() overrides previously set the input'); } - /** - * @covers Symfony\Component\HttpFoundation\ParameterBag::get - */ public function testGet() { $bag = new ParameterBag(array('foo' => 'bar', 'null' => null)); @@ -116,9 +104,6 @@ public function testGetDeep() $this->assertEquals('default', $bag->get('bar[moo][foo]', 'default', true)); } - /** - * @covers Symfony\Component\HttpFoundation\ParameterBag::set - */ public function testSet() { $bag = new ParameterBag(array()); @@ -130,9 +115,6 @@ public function testSet() $this->assertEquals('baz', $bag->get('foo'), '->set() overrides previously set parameter'); } - /** - * @covers Symfony\Component\HttpFoundation\ParameterBag::has - */ public function testHas() { $bag = new ParameterBag(array('foo' => 'bar')); @@ -141,9 +123,6 @@ public function testHas() $this->assertFalse($bag->has('unknown'), '->has() return false if a parameter is not defined'); } - /** - * @covers Symfony\Component\HttpFoundation\ParameterBag::getAlpha - */ public function testGetAlpha() { $bag = new ParameterBag(array('word' => 'foo_BAR_012')); @@ -152,9 +131,6 @@ public function testGetAlpha() $this->assertEquals('', $bag->getAlpha('unknown'), '->getAlpha() returns empty string if a parameter is not defined'); } - /** - * @covers Symfony\Component\HttpFoundation\ParameterBag::getAlnum - */ public function testGetAlnum() { $bag = new ParameterBag(array('word' => 'foo_BAR_012')); @@ -163,9 +139,6 @@ public function testGetAlnum() $this->assertEquals('', $bag->getAlnum('unknown'), '->getAlnum() returns empty string if a parameter is not defined'); } - /** - * @covers Symfony\Component\HttpFoundation\ParameterBag::getDigits - */ public function testGetDigits() { $bag = new ParameterBag(array('word' => 'foo_BAR_012')); @@ -174,9 +147,6 @@ public function testGetDigits() $this->assertEquals('', $bag->getDigits('unknown'), '->getDigits() returns empty string if a parameter is not defined'); } - /** - * @covers Symfony\Component\HttpFoundation\ParameterBag::getInt - */ public function testGetInt() { $bag = new ParameterBag(array('digits' => '0123')); @@ -185,9 +155,6 @@ public function testGetInt() $this->assertEquals(0, $bag->getInt('unknown'), '->getInt() returns zero if a parameter is not defined'); } - /** - * @covers Symfony\Component\HttpFoundation\ParameterBag::filter - */ public function testFilter() { $bag = new ParameterBag(array( @@ -223,9 +190,6 @@ public function testFilter() $this->assertEquals(array('bang'), $bag->filter('array', '', false), '->filter() gets a value of parameter as an array'); } - /** - * @covers Symfony\Component\HttpFoundation\ParameterBag::getIterator - */ public function testGetIterator() { $parameters = array('foo' => 'bar', 'hello' => 'world'); @@ -240,9 +204,6 @@ public function testGetIterator() $this->assertEquals(count($parameters), $i); } - /** - * @covers Symfony\Component\HttpFoundation\ParameterBag::count - */ public function testCount() { $parameters = array('foo' => 'bar', 'hello' => 'world'); diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 0f4706d97e51e..dcc1c2eb99132 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -17,17 +17,11 @@ class RequestTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\HttpFoundation\Request::__construct - */ public function testConstructor() { $this->testInitialize(); } - /** - * @covers Symfony\Component\HttpFoundation\Request::initialize - */ public function testInitialize() { $request = new Request(); @@ -94,9 +88,6 @@ public function testSetDefaultLocale() $this->assertEquals('pl', $locale); } - /** - * @covers Symfony\Component\HttpFoundation\Request::create - */ public function testCreate() { $request = Request::create('http://test.com/foo?bar=baz'); @@ -240,9 +231,6 @@ public function testCreate() $this->assertFalse($request->isSecure()); } - /** - * @covers Symfony\Component\HttpFoundation\Request::create - */ public function testCreateCheckPrecedence() { // server is used by default @@ -311,8 +299,6 @@ public function testDuplicateWithFormat() } /** - * @covers Symfony\Component\HttpFoundation\Request::getFormat - * @covers Symfony\Component\HttpFoundation\Request::setFormat * @dataProvider getFormatToMimeTypeMapProvider */ public function testGetFormatFromMimeType($format, $mimeTypes) @@ -327,9 +313,6 @@ public function testGetFormatFromMimeType($format, $mimeTypes) } } - /** - * @covers Symfony\Component\HttpFoundation\Request::getFormat - */ public function testGetFormatFromMimeTypeWithParameters() { $request = new Request(); @@ -337,7 +320,6 @@ public function testGetFormatFromMimeTypeWithParameters() } /** - * @covers Symfony\Component\HttpFoundation\Request::getMimeType * @dataProvider getFormatToMimeTypeMapProvider */ public function testGetMimeTypeFromFormat($format, $mimeTypes) @@ -362,9 +344,6 @@ public function getFormatToMimeTypeMapProvider() ); } - /** - * @covers Symfony\Component\HttpFoundation\Request::getUri - */ public function testGetUri() { $server = array(); @@ -480,9 +459,6 @@ public function testGetUri() $this->assertEquals('http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri()); } - /** - * @covers Symfony\Component\HttpFoundation\Request::getUriForPath - */ public function testGetUriForPath() { $request = Request::create('http://test.com/foo?bar=baz'); @@ -590,14 +566,11 @@ public function testGetUriForPath() $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path')); } - /** - * @covers Symfony\Component\HttpFoundation\Request::getUserInfo - */ public function testGetUserInfo() { $request = new Request(); - $server['PHP_AUTH_USER'] = 'fabien'; + $server = array('PHP_AUTH_USER' => 'fabien'); $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('fabien', $request->getUserInfo()); @@ -610,9 +583,6 @@ public function testGetUserInfo() $this->assertEquals('0:0', $request->getUserInfo()); } - /** - * @covers Symfony\Component\HttpFoundation\Request::getSchemeAndHttpHost - */ public function testGetSchemeAndHttpHost() { $request = new Request(); @@ -636,8 +606,6 @@ public function testGetSchemeAndHttpHost() } /** - * @covers Symfony\Component\HttpFoundation\Request::getQueryString - * @covers Symfony\Component\HttpFoundation\Request::normalizeQueryString * @dataProvider getQueryStringNormalizationData */ public function testGetQueryString($query, $expectedQuery, $msg) @@ -773,10 +741,6 @@ public function testGetHostWithFakeHttpHostValue() $request->getHost(); } - /** - * @covers Symfony\Component\HttpFoundation\Request::setMethod - * @covers Symfony\Component\HttpFoundation\Request::getMethod - */ public function testGetSetMethod() { $request = new Request(); diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php index b716ac162aeb9..f6641dbb4050b 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php @@ -20,7 +20,6 @@ class ResponseHeaderBagTest extends \PHPUnit_Framework_TestCase { /** - * @covers Symfony\Component\HttpFoundation\ResponseHeaderBag::allPreserveCase * @dataProvider provideAllPreserveCase */ public function testAllPreserveCase($headers, $expected) diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index 72e143f9da438..f0539079c949c 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -647,7 +647,7 @@ public function getStatusCodeFixtures() array('200', null, 'OK'), array('200', false, ''), array('200', 'foo', 'foo'), - array('199', null, ''), + array('199', null, 'unknown status'), array('199', false, ''), array('199', 'foo', 'foo'), ); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php index 5515003b40739..8d0e7a5c13e6d 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php @@ -169,9 +169,6 @@ public function attributesProvider() ); } - /** - * @covers Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag::getIterator - */ public function testGetIterator() { $i = 0; @@ -183,9 +180,6 @@ public function testGetIterator() $this->assertEquals(count($this->array), $i); } - /** - * @covers Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag::count - */ public function testCount() { $this->assertEquals(count($this->array), count($this->bag)); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php index c424591755e0b..7b7afe8628b3e 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php @@ -132,9 +132,6 @@ public function testPeekAll() ); } - /** - * @covers Symfony\Component\HttpFoundation\Session\Flash\FlashBag::getIterator - */ public function testGetIterator() { $flashes = array('hello' => 'world', 'beep' => 'boop', 'notice' => 'nope'); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php index 385df1e46a958..57460c6daac5a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php @@ -190,9 +190,6 @@ public function testGetFlashBag() $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface', $this->session->getFlashBag()); } - /** - * @covers Symfony\Component\HttpFoundation\Session\Session::getIterator - */ public function testGetIterator() { $attributes = array('hello' => 'world', 'symfony' => 'rocks'); @@ -209,9 +206,6 @@ public function testGetIterator() $this->assertEquals(count($attributes), $i); } - /** - * @covers \Symfony\Component\HttpFoundation\Session\Session::count - */ public function testGetCount() { $this->session->set('hello', 'world'); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index c72358afc8436..755be2fcf36c5 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -34,6 +34,7 @@ protected function setUp() $mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient'; $this->mongo = $this->getMockBuilder($mongoClass) + ->disableOriginalConstructor() ->getMock(); $this->options = array( @@ -202,13 +203,8 @@ public function testGc() private function createMongoCollectionMock() { - $mongoClient = $this->getMockBuilder('MongoClient') - ->getMock(); - $mongoDb = $this->getMockBuilder('MongoDB') - ->setConstructorArgs(array($mongoClient, 'database-name')) - ->getMock(); $collection = $this->getMockBuilder('MongoCollection') - ->setConstructorArgs(array($mongoDb, 'collection-name')) + ->disableOriginalConstructor() ->getMock(); return $collection; diff --git a/src/Symfony/Component/HttpFoundation/composer.json b/src/Symfony/Component/HttpFoundation/composer.json index bae2bc8e90ce3..8fa1a00ec9f27 100644 --- a/src/Symfony/Component/HttpFoundation/composer.json +++ b/src/Symfony/Component/HttpFoundation/composer.json @@ -20,7 +20,10 @@ }, "autoload": { "psr-0": { "Symfony\\Component\\HttpFoundation\\": "" }, - "classmap": [ "Symfony/Component/HttpFoundation/Resources/stubs" ] + "classmap": [ "Symfony/Component/HttpFoundation/Resources/stubs" ], + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/HttpFoundation", "minimum-stability": "dev", diff --git a/src/Symfony/Component/HttpFoundation/phpunit.xml.dist b/src/Symfony/Component/HttpFoundation/phpunit.xml.dist index b5b660a39433e..9ffdb43a2d744 100644 --- a/src/Symfony/Component/HttpFoundation/phpunit.xml.dist +++ b/src/Symfony/Component/HttpFoundation/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php index 4901e2cf297aa..eca3adec1b82f 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php @@ -32,12 +32,16 @@ class Store implements StoreInterface * Constructor. * * @param string $root The path to the cache directory + * + * @throws \RuntimeException */ public function __construct($root) { $this->root = $root; if (!is_dir($this->root)) { - mkdir($this->root, 0777, true); + if (false === @mkdir($this->root, 0777, true) && !is_dir($this->root)) { + throw new \RuntimeException(sprintf('Unable to create the store directory (%s).', $this->root)); + } } $this->keyCache = new \SplObjectStorage(); $this->locks = array(); @@ -74,7 +78,7 @@ public function cleanup() public function lock(Request $request) { $path = $this->getPath($this->getCacheKey($request).'.lck'); - if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true)) { + if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) { return false; } @@ -338,7 +342,7 @@ private function load($key) private function save($key, $data) { $path = $this->getPath($key); - if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true)) { + if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) { return false; } diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 1013e31bb0c72..be3ea8d1ee900 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,11 +58,11 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.3.34'; - const VERSION_ID = 20334; + const VERSION = '2.3.35'; + const VERSION_ID = 20335; const MAJOR_VERSION = 2; const MINOR_VERSION = 3; - const RELEASE_VERSION = 34; + const RELEASE_VERSION = 35; const EXTRA_VERSION = ''; /** diff --git a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php index bda87e80e1e96..8677b57e4f4f8 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php +++ b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php @@ -41,8 +41,8 @@ public function __construct($dsn) } $this->folder = substr($dsn, 5); - if (!is_dir($this->folder)) { - mkdir($this->folder, 0777, true); + if (!is_dir($this->folder) && false === @mkdir($this->folder, 0777, true) && !is_dir($this->folder)) { + throw new \RuntimeException(sprintf('Unable to create the storage directory (%s).', $this->folder)); } } @@ -125,6 +125,8 @@ public function read($token) /** * {@inheritdoc} + * + * @throws \RuntimeException */ public function write(Profile $profile) { @@ -134,8 +136,8 @@ public function write(Profile $profile) if (!$profileIndexed) { // Create directory $dir = dirname($file); - if (!is_dir($dir)) { - mkdir($dir, 0777, true); + if (!is_dir($dir) && false === @mkdir($dir, 0777, true) && !is_dir($dir)) { + throw new \RuntimeException(sprintf('Unable to create the storage directory (%s).', $dir)); } } diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php index b5d64bffe350a..0bdcccd53d0cb 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php @@ -15,6 +15,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +/** + * @group time-sensitive + */ class TimeDataCollectorTest extends \PHPUnit_Framework_TestCase { public function testCollect() diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php index 8fb00f51c1e6e..947af1122850d 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php @@ -23,6 +23,8 @@ * ExceptionListenerTest. * * @author Robert Schönthal + * + * @group time-sensitive */ class ExceptionListenerTest extends \PHPUnit_Framework_TestCase { diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php index 3f6780a87657e..e569accac4cb0 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php @@ -15,6 +15,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +/** + * @group time-sensitive + */ class FragmentHandlerTest extends \PHPUnit_Framework_TestCase { /** diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php index fa8358da5e777..766e2b1d499a5 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php @@ -16,7 +16,6 @@ use Symfony\Component\HttpKernel\HttpCache\HttpCache; use Symfony\Component\HttpKernel\HttpCache\Store; use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Bridge\PhpUnit\ClockMock; class HttpCacheTestCase extends \PHPUnit_Framework_TestCase { @@ -32,9 +31,6 @@ class HttpCacheTestCase extends \PHPUnit_Framework_TestCase protected function setUp() { - if (class_exists('Symfony\Bridge\PhpUnit\ClockMock')) { - ClockMock::register('Symfony\Component\HttpFoundation\Request'); - } $this->kernel = null; $this->cache = null; diff --git a/src/Symfony/Component/HttpKernel/composer.json b/src/Symfony/Component/HttpKernel/composer.json index e66ce54a9377d..fe2f8921bd142 100644 --- a/src/Symfony/Component/HttpKernel/composer.json +++ b/src/Symfony/Component/HttpKernel/composer.json @@ -45,7 +45,10 @@ "symfony/finder": "" }, "autoload": { - "psr-0": { "Symfony\\Component\\HttpKernel\\": "" } + "psr-0": { "Symfony\\Component\\HttpKernel\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/HttpKernel", "minimum-stability": "dev", diff --git a/src/Symfony/Component/HttpKernel/phpunit.xml.dist b/src/Symfony/Component/HttpKernel/phpunit.xml.dist index 7901a0b8b5433..17c48935c7158 100644 --- a/src/Symfony/Component/HttpKernel/phpunit.xml.dist +++ b/src/Symfony/Component/HttpKernel/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -24,4 +25,14 @@ + + + + + + Symfony\Component\HttpFoundation + + + + diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php index 7c82706d060ac..3f7dcfd32d717 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php @@ -29,8 +29,6 @@ protected function setUp() /** * When a time zone is not specified, it uses the system default however it returns null in the getter method. * - * @covers Symfony\Component\Intl\DateFormatter\IntlDateFormatter::getTimeZoneId - * * @see StubIntlDateFormatterTest::testDefaultTimeZoneIntl() */ public function testConstructorDefaultTimeZone() @@ -874,7 +872,6 @@ public function testSetPattern() } /** - * @covers Symfony\Component\Intl\DateFormatter\IntlDateFormatter::getTimeZoneId * @dataProvider setTimeZoneIdProvider */ public function testSetTimeZoneId($timeZoneId, $expectedTimeZoneId) diff --git a/src/Symfony/Component/Intl/composer.json b/src/Symfony/Component/Intl/composer.json index 4247b591c9b02..e641cadd70fcb 100644 --- a/src/Symfony/Component/Intl/composer.json +++ b/src/Symfony/Component/Intl/composer.json @@ -35,7 +35,10 @@ "autoload": { "psr-0": { "Symfony\\Component\\Intl\\": "" }, "classmap": [ "Symfony/Component/Intl/Resources/stubs" ], - "files": [ "Symfony/Component/Intl/Resources/stubs/functions.php" ] + "files": [ "Symfony/Component/Intl/Resources/stubs/functions.php" ], + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/Intl", "minimum-stability": "dev", diff --git a/src/Symfony/Component/Intl/phpunit.xml.dist b/src/Symfony/Component/Intl/phpunit.xml.dist index d40a1582bb889..9e7ce2f0b2642 100644 --- a/src/Symfony/Component/Intl/phpunit.xml.dist +++ b/src/Symfony/Component/Intl/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -25,6 +26,7 @@ ./ + ./Resources ./Tests ./vendor diff --git a/src/Symfony/Component/Locale/composer.json b/src/Symfony/Component/Locale/composer.json index 8b83867a1752b..e71439dc21f8f 100644 --- a/src/Symfony/Component/Locale/composer.json +++ b/src/Symfony/Component/Locale/composer.json @@ -20,7 +20,10 @@ "symfony/intl": "~2.3" }, "autoload": { - "psr-0": { "Symfony\\Component\\Locale\\": "" } + "psr-0": { "Symfony\\Component\\Locale\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/Locale", "minimum-stability": "dev", diff --git a/src/Symfony/Component/Locale/phpunit.xml.dist b/src/Symfony/Component/Locale/phpunit.xml.dist index 4633ca6f04375..0d9b637cc78d1 100644 --- a/src/Symfony/Component/Locale/phpunit.xml.dist +++ b/src/Symfony/Component/Locale/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ diff --git a/src/Symfony/Component/OptionsResolver/Tests/OptionsTest.php b/src/Symfony/Component/OptionsResolver/Tests/OptionsTest.php index 5db0995685a00..e7f47ccd7868e 100644 --- a/src/Symfony/Component/OptionsResolver/Tests/OptionsTest.php +++ b/src/Symfony/Component/OptionsResolver/Tests/OptionsTest.php @@ -392,7 +392,6 @@ public function testClearRemovesAllOptions() } /** - * @covers Symfony\Component\OptionsResolver\Options::replace * @expectedException \Symfony\Component\OptionsResolver\Exception\OptionDefinitionException */ public function testCannotReplaceAfterOptionWasRead() @@ -406,7 +405,6 @@ public function testCannotReplaceAfterOptionWasRead() } /** - * @covers Symfony\Component\OptionsResolver\Options::overload * @expectedException \Symfony\Component\OptionsResolver\Exception\OptionDefinitionException */ public function testCannotOverloadAfterOptionWasRead() @@ -418,7 +416,6 @@ public function testCannotOverloadAfterOptionWasRead() } /** - * @covers Symfony\Component\OptionsResolver\Options::clear * @expectedException \Symfony\Component\OptionsResolver\Exception\OptionDefinitionException */ public function testCannotClearAfterOptionWasRead() diff --git a/src/Symfony/Component/OptionsResolver/composer.json b/src/Symfony/Component/OptionsResolver/composer.json index 80fbbc4b010f2..ada190d46020d 100644 --- a/src/Symfony/Component/OptionsResolver/composer.json +++ b/src/Symfony/Component/OptionsResolver/composer.json @@ -19,7 +19,10 @@ "php": ">=5.3.3" }, "autoload": { - "psr-0": { "Symfony\\Component\\OptionsResolver\\": "" } + "psr-0": { "Symfony\\Component\\OptionsResolver\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/OptionsResolver", "minimum-stability": "dev", diff --git a/src/Symfony/Component/OptionsResolver/phpunit.xml.dist b/src/Symfony/Component/OptionsResolver/phpunit.xml.dist index 2398388768711..abf84614bcf76 100644 --- a/src/Symfony/Component/OptionsResolver/phpunit.xml.dist +++ b/src/Symfony/Component/OptionsResolver/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -21,6 +22,7 @@ ./Resources ./Tests + ./vendor diff --git a/src/Symfony/Component/Process/PhpExecutableFinder.php b/src/Symfony/Component/Process/PhpExecutableFinder.php index f8f57cc536a25..fb297825fe364 100644 --- a/src/Symfony/Component/Process/PhpExecutableFinder.php +++ b/src/Symfony/Component/Process/PhpExecutableFinder.php @@ -35,14 +35,17 @@ public function __construct() */ public function find($includeArgs = true) { + $args = $this->findArguments(); + $args = $includeArgs && $args ? ' '.implode(' ', $args) : ''; + // HHVM support if (defined('HHVM_VERSION')) { - return (getenv('PHP_BINARY') ?: PHP_BINARY).($includeArgs ? ' '.implode(' ', $this->findArguments()) : ''); + return (getenv('PHP_BINARY') ?: PHP_BINARY).$args; } // PHP_BINARY return the current sapi executable - if (defined('PHP_BINARY') && PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server')) && is_file(PHP_BINARY)) { - return PHP_BINARY; + if (defined('PHP_BINARY') && PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg')) && is_file(PHP_BINARY)) { + return PHP_BINARY.$args; } if ($php = getenv('PHP_PATH')) { @@ -76,9 +79,10 @@ public function findArguments() { $arguments = array(); - // HHVM support if (defined('HHVM_VERSION')) { $arguments[] = '--php'; + } elseif ('phpdbg' === PHP_SAPI) { + $arguments[] = '-qrr'; } return $arguments; diff --git a/src/Symfony/Component/Process/PhpProcess.php b/src/Symfony/Component/Process/PhpProcess.php index 1adbd977adf88..4a2a2625ffae0 100644 --- a/src/Symfony/Component/Process/PhpProcess.php +++ b/src/Symfony/Component/Process/PhpProcess.php @@ -39,6 +39,13 @@ public function __construct($script, $cwd = null, array $env = null, $timeout = if (false === $php = $executableFinder->find()) { $php = null; } + if ('phpdbg' === PHP_SAPI) { + $file = tempnam(sys_get_temp_dir(), 'dbg'); + file_put_contents($file, $script); + register_shutdown_function('unlink', $file); + $php .= ' '.ProcessUtils::escapeArgument($file); + $script = null; + } parent::__construct($php, $cwd, $env, $script, $timeout, $options); } diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 7580c17d829c5..1675ad33994aa 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -237,8 +237,20 @@ public function start($callback = null) } } + $ptsWorkaround = null; + + if (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { + // Workaround for the bug, when PTS functionality is enabled. + // @see : https://bugs.php.net/69442 + $ptsWorkaround = fopen(__FILE__, 'r'); + } + $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options); + if ($ptsWorkaround) { + fclose($ptsWorkaround); + } + if (!is_resource($this->process)) { throw new RuntimeException('Unable to launch a new process.'); } diff --git a/src/Symfony/Component/Process/Tests/AbstractProcessTest.php b/src/Symfony/Component/Process/Tests/AbstractProcessTest.php index 62616eed347d4..1874290936d53 100644 --- a/src/Symfony/Component/Process/Tests/AbstractProcessTest.php +++ b/src/Symfony/Component/Process/Tests/AbstractProcessTest.php @@ -27,7 +27,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase public static function setUpBeforeClass() { $phpBin = new PhpExecutableFinder(); - self::$phpBin = $phpBin->find(); + self::$phpBin = 'phpdbg' === PHP_SAPI ? 'php' : $phpBin->find(); } public function testThatProcessDoesNotThrowWarningDuringRun() @@ -80,7 +80,7 @@ public function testStopWithTimeoutIsActuallyWorking() // exec is mandatory here since we send a signal to the process // see https://github.com/symfony/symfony/issues/5030 about prepending // command with exec - $p = $this->getProcess('exec php '.__DIR__.'/NonStopableProcess.php 3'); + $p = $this->getProcess('exec '.self::$phpBin.' '.__DIR__.'/NonStopableProcess.php 3'); $p->start(); usleep(100000); $start = microtime(true); @@ -410,7 +410,7 @@ public function testTTYCommand() $this->markTestSkipped('Windows does have /dev/tty support'); } - $process = $this->getProcess('echo "foo" >> /dev/null && php -r "usleep(100000);"'); + $process = $this->getProcess('echo "foo" >> /dev/null && '.self::$phpBin.' -r "usleep(100000);"'); $process->setTty(true); $process->start(); $this->assertTrue($process->isRunning()); @@ -633,7 +633,7 @@ public function testProcessThrowsExceptionWhenExternallySignaled() $termSignal = defined('SIGKILL') ? SIGKILL : 9; - $process = $this->getProcess('exec php -r "while (true) {}"'); + $process = $this->getProcess('exec '.self::$phpBin.' -r "while (true) {}"'); $process->start(); posix_kill($process->getPid(), $termSignal); @@ -659,18 +659,6 @@ public function testRestart() $this->assertNotEquals($process1->getOutput(), $process2->getOutput()); } - public function testPhpDeadlock() - { - $this->markTestSkipped('Can cause PHP to hang'); - - // Sleep doesn't work as it will allow the process to handle signals and close - // file handles from the other end. - $process = $this->getProcess(self::$phpBin.' -r "while (true) {}"'); - $process->start(); - - // PHP will deadlock when it tries to cleanup $process - } - public function testRunProcessWithTimeout() { $timeout = 0.5; diff --git a/src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php b/src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php index cd4abedc9df73..28bafe38ea1c6 100644 --- a/src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php +++ b/src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php @@ -68,6 +68,8 @@ public function testFindArguments() if (defined('HHVM_VERSION')) { $this->assertEquals($f->findArguments(), array('--php'), '::findArguments() returns HHVM arguments'); + } elseif ('phpdbg' === PHP_SAPI) { + $this->assertEquals($f->findArguments(), array('-qrr'), '::findArguments() returns phpdbg arguments'); } else { $this->assertEquals($f->findArguments(), array(), '::findArguments() returns no arguments'); } diff --git a/src/Symfony/Component/Process/Tests/PhpProcessTest.php b/src/Symfony/Component/Process/Tests/PhpProcessTest.php index 5dc546cc1ce6e..2cf79aa1a6d15 100644 --- a/src/Symfony/Component/Process/Tests/PhpProcessTest.php +++ b/src/Symfony/Component/Process/Tests/PhpProcessTest.php @@ -30,6 +30,10 @@ public function testNonBlockingWorks() public function testCommandLine() { + if ('phpdbg' === PHP_SAPI) { + $this->markTestSkipped('phpdbg SAPI is not supported by this test.'); + } + $process = new PhpProcess(<<=5.3.3" }, "autoload": { - "psr-0": { "Symfony\\Component\\Process\\": "" } + "psr-0": { "Symfony\\Component\\Process\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/Process", "minimum-stability": "dev", diff --git a/src/Symfony/Component/Process/phpunit.xml.dist b/src/Symfony/Component/Process/phpunit.xml.dist index 07b617be4b5d2..788500084abf8 100644 --- a/src/Symfony/Component/Process/phpunit.xml.dist +++ b/src/Symfony/Component/Process/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -20,6 +21,7 @@ ./ ./Tests + ./vendor diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index 76ef8c1d5cfb6..a55ccf339933c 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -23,8 +23,21 @@ class PropertyAccessor implements PropertyAccessorInterface { const VALUE = 0; const IS_REF = 1; + const ACCESS_HAS_PROPERTY = 0; + const ACCESS_TYPE = 1; + const ACCESS_NAME = 2; + const ACCESS_REF = 3; + const ACCESS_ADDER = 4; + const ACCESS_REMOVER = 5; + const ACCESS_TYPE_METHOD = 0; + const ACCESS_TYPE_PROPERTY = 1; + const ACCESS_TYPE_MAGIC = 2; + const ACCESS_TYPE_ADDER_AND_REMOVER = 3; + const ACCESS_TYPE_NOT_FOUND = 4; private $magicCall; + private $readPropertyCache = array(); + private $writePropertyCache = array(); /** * Should not be used by application code. Use @@ -202,48 +215,31 @@ private function &readProperty(&$object, $property) throw new NoSuchPropertyException(sprintf('Cannot read property "%s" from an array. Maybe you should write the property path as "[%s]" instead?', $property, $property)); } - $camelProp = $this->camelize($property); - $reflClass = new \ReflectionClass($object); - $getter = 'get'.$camelProp; - $isser = 'is'.$camelProp; - $hasser = 'has'.$camelProp; - $classHasProperty = $reflClass->hasProperty($property); - - if ($reflClass->hasMethod($getter) && $reflClass->getMethod($getter)->isPublic()) { - $result[self::VALUE] = $object->$getter(); - } elseif ($reflClass->hasMethod($isser) && $reflClass->getMethod($isser)->isPublic()) { - $result[self::VALUE] = $object->$isser(); - } elseif ($reflClass->hasMethod($hasser) && $reflClass->getMethod($hasser)->isPublic()) { - $result[self::VALUE] = $object->$hasser(); - } elseif ($reflClass->hasMethod('__get') && $reflClass->getMethod('__get')->isPublic()) { - $result[self::VALUE] = $object->$property; - } elseif ($classHasProperty && $reflClass->getProperty($property)->isPublic()) { - $result[self::VALUE] = &$object->$property; - $result[self::IS_REF] = true; - } elseif (!$classHasProperty && property_exists($object, $property)) { + $access = $this->getReadAccessInfo($object, $property); + + if (self::ACCESS_TYPE_METHOD === $access[self::ACCESS_TYPE]) { + $result[self::VALUE] = $object->{$access[self::ACCESS_NAME]}(); + } elseif (self::ACCESS_TYPE_PROPERTY === $access[self::ACCESS_TYPE]) { + if ($access[self::ACCESS_REF]) { + $result[self::VALUE] = &$object->{$access[self::ACCESS_NAME]}; + $result[self::IS_REF] = true; + } else { + $result[self::VALUE] = $object->{$access[self::ACCESS_NAME]}; + } + } elseif (!$access[self::ACCESS_HAS_PROPERTY] && property_exists($object, $property)) { // Needed to support \stdClass instances. We need to explicitly // exclude $classHasProperty, otherwise if in the previous clause // a *protected* property was found on the class, property_exists() // returns true, consequently the following line will result in a // fatal error. + $result[self::VALUE] = &$object->$property; $result[self::IS_REF] = true; - } elseif ($this->magicCall && $reflClass->hasMethod('__call') && $reflClass->getMethod('__call')->isPublic()) { + } elseif (self::ACCESS_TYPE_MAGIC === $access[self::ACCESS_TYPE]) { // we call the getter and hope the __call do the job - $result[self::VALUE] = $object->$getter(); + $result[self::VALUE] = $object->{$access[self::ACCESS_NAME]}(); } else { - $methods = array($getter, $isser, $hasser, '__get'); - if ($this->magicCall) { - $methods[] = '__call'; - } - - throw new NoSuchPropertyException(sprintf( - 'Neither the property "%s" nor one of the methods "%s()" '. - 'exist and have public access in class "%s".', - $property, - implode('()", "', $methods), - $reflClass->name - )); + throw new NoSuchPropertyException($access[self::ACCESS_NAME]); } // Objects are always passed around by reference @@ -254,6 +250,77 @@ private function &readProperty(&$object, $property) return $result; } + /** + * Guesses how to read the property value. + * + * @param string $object + * @param string $property + * + * @return array + */ + private function getReadAccessInfo($object, $property) + { + $key = get_class($object).'::'.$property; + + if (isset($this->readPropertyCache[$key])) { + $access = $this->readPropertyCache[$key]; + } else { + $access = array(); + + $reflClass = new \ReflectionClass($object); + $access[self::ACCESS_HAS_PROPERTY] = $reflClass->hasProperty($property); + $camelProp = $this->camelize($property); + $getter = 'get'.$camelProp; + $isser = 'is'.$camelProp; + $hasser = 'has'.$camelProp; + $classHasProperty = $reflClass->hasProperty($property); + + if ($reflClass->hasMethod($getter) && $reflClass->getMethod($getter)->isPublic()) { + $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD; + $access[self::ACCESS_NAME] = $getter; + } elseif ($reflClass->hasMethod($isser) && $reflClass->getMethod($isser)->isPublic()) { + $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD; + $access[self::ACCESS_NAME] = $isser; + } elseif ($reflClass->hasMethod($hasser) && $reflClass->getMethod($hasser)->isPublic()) { + $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD; + $access[self::ACCESS_NAME] = $hasser; + } elseif ($reflClass->hasMethod('__get') && $reflClass->getMethod('__get')->isPublic()) { + $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_PROPERTY; + $access[self::ACCESS_NAME] = $property; + $access[self::ACCESS_REF] = false; + } elseif ($classHasProperty && $reflClass->getProperty($property)->isPublic()) { + $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_PROPERTY; + $access[self::ACCESS_NAME] = $property; + $access[self::ACCESS_REF] = true; + + $result[self::VALUE] = &$object->$property; + $result[self::IS_REF] = true; + } elseif ($this->magicCall && $reflClass->hasMethod('__call') && $reflClass->getMethod('__call')->isPublic()) { + // we call the getter and hope the __call do the job + $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_MAGIC; + $access[self::ACCESS_NAME] = $getter; + } else { + $methods = array($getter, $isser, $hasser, '__get'); + if ($this->magicCall) { + $methods[] = '__call'; + } + + $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_NOT_FOUND; + $access[self::ACCESS_NAME] = sprintf( + 'Neither the property "%s" nor one of the methods "%s()" '. + 'exist and have public access in class "%s".', + $property, + implode('()", "', $methods), + $reflClass->name + ); + } + + $this->readPropertyCache[$key] = $access; + } + + return $access; + } + /** * Sets the value of the property at the given index in the path. * @@ -285,98 +352,145 @@ private function writeIndex(&$array, $index, $value) */ private function writeProperty(&$object, $property, $singular, $value) { - $guessedAdders = ''; - if (!is_object($object)) { throw new NoSuchPropertyException(sprintf('Cannot write property "%s" to an array. Maybe you should write the property path as "[%s]" instead?', $property, $property)); } - $reflClass = new \ReflectionClass($object); - $plural = $this->camelize($property); - - // Any of the two methods is required, but not yet known - $singulars = null !== $singular ? array($singular) : (array) StringUtil::singularify($plural); - - if (is_array($value) || $value instanceof \Traversable) { - $methods = $this->findAdderAndRemover($reflClass, $singulars); - - if (null !== $methods) { - // At this point the add and remove methods have been found - // Use iterator_to_array() instead of clone in order to prevent side effects - // see https://github.com/symfony/symfony/issues/4670 - $itemsToAdd = is_object($value) ? iterator_to_array($value) : $value; - $itemToRemove = array(); - $propertyValue = &$this->readProperty($object, $property); - $previousValue = $propertyValue[self::VALUE]; - // remove reference to avoid modifications - unset($propertyValue); - - if (is_array($previousValue) || $previousValue instanceof \Traversable) { - foreach ($previousValue as $previousItem) { - foreach ($value as $key => $item) { - if ($item === $previousItem) { - // Item found, don't add - unset($itemsToAdd[$key]); - - // Next $previousItem - continue 2; - } + $access = $this->getWriteAccessInfo($object, $property, $singular, $value); + + if (self::ACCESS_TYPE_METHOD === $access[self::ACCESS_TYPE]) { + $object->{$access[self::ACCESS_NAME]}($value); + } elseif (self::ACCESS_TYPE_PROPERTY === $access[self::ACCESS_TYPE]) { + $object->{$access[self::ACCESS_NAME]} = $value; + } elseif (self::ACCESS_TYPE_ADDER_AND_REMOVER === $access[self::ACCESS_TYPE]) { + // At this point the add and remove methods have been found + // Use iterator_to_array() instead of clone in order to prevent side effects + // see https://github.com/symfony/symfony/issues/4670 + $itemsToAdd = is_object($value) ? iterator_to_array($value) : $value; + $itemToRemove = array(); + $propertyValue = &$this->readProperty($object, $property); + $previousValue = $propertyValue[self::VALUE]; + // remove reference to avoid modifications + unset($propertyValue); + + if (is_array($previousValue) || $previousValue instanceof \Traversable) { + foreach ($previousValue as $previousItem) { + foreach ($value as $key => $item) { + if ($item === $previousItem) { + // Item found, don't add + unset($itemsToAdd[$key]); + + // Next $previousItem + continue 2; } - - // Item not found, add to remove list - $itemToRemove[] = $previousItem; } - } - - foreach ($itemToRemove as $item) { - call_user_func(array($object, $methods[1]), $item); - } - foreach ($itemsToAdd as $item) { - call_user_func(array($object, $methods[0]), $item); + // Item not found, add to remove list + $itemToRemove[] = $previousItem; } - - return; - } else { - // It is sufficient to include only the adders in the error - // message. If the user implements the adder but not the remover, - // an exception will be thrown in findAdderAndRemover() that - // the remover has to be implemented as well. - $guessedAdders = '"add'.implode('()", "add', $singulars).'()", '; } - } - $setter = 'set'.$this->camelize($property); - $classHasProperty = $reflClass->hasProperty($property); + foreach ($itemToRemove as $item) { + call_user_func(array($object, $access[self::ACCESS_REMOVER]), $item); + } - if ($reflClass->hasMethod($setter) && $reflClass->getMethod($setter)->isPublic()) { - $object->$setter($value); - } elseif ($reflClass->hasMethod('__set') && $reflClass->getMethod('__set')->isPublic()) { - $object->$property = $value; - } elseif ($classHasProperty && $reflClass->getProperty($property)->isPublic()) { - $object->$property = $value; - } elseif (!$classHasProperty && property_exists($object, $property)) { + foreach ($itemsToAdd as $item) { + call_user_func(array($object, $access[self::ACCESS_ADDER]), $item); + } + } elseif (!$access[self::ACCESS_HAS_PROPERTY] && property_exists($object, $property)) { // Needed to support \stdClass instances. We need to explicitly // exclude $classHasProperty, otherwise if in the previous clause // a *protected* property was found on the class, property_exists() // returns true, consequently the following line will result in a // fatal error. + $object->$property = $value; - } elseif ($this->magicCall && $reflClass->hasMethod('__call') && $reflClass->getMethod('__call')->isPublic()) { - // we call the getter and hope the __call do the job - $object->$setter($value); + } elseif (self::ACCESS_TYPE_MAGIC === $access[self::ACCESS_TYPE]) { + $object->{$access[self::ACCESS_NAME]}($value); } else { - throw new NoSuchPropertyException(sprintf( - 'Neither the property "%s" nor one of the methods %s"%s()", '. - '"__set()" or "__call()" exist and have public access in class "%s".', - $property, - $guessedAdders, - $setter, - $reflClass->name - )); + throw new NoSuchPropertyException($access[self::ACCESS_NAME]); } } + /** + * Guesses how to write the property value. + * + * @param string $object + * @param string $property + * @param string|null $singular + * @param mixed $value + * + * @return array + */ + private function getWriteAccessInfo($object, $property, $singular, $value) + { + $key = get_class($object).'::'.$property; + $guessedAdders = ''; + + if (isset($this->writePropertyCache[$key])) { + $access = $this->writePropertyCache[$key]; + } else { + $access = array(); + + $reflClass = new \ReflectionClass($object); + $access[self::ACCESS_HAS_PROPERTY] = $reflClass->hasProperty($property); + $plural = $this->camelize($property); + + // Any of the two methods is required, but not yet known + $singulars = null !== $singular ? array($singular) : (array) StringUtil::singularify($plural); + + if (is_array($value) || $value instanceof \Traversable) { + $methods = $this->findAdderAndRemover($reflClass, $singulars); + + if (null === $methods) { + // It is sufficient to include only the adders in the error + // message. If the user implements the adder but not the remover, + // an exception will be thrown in findAdderAndRemover() that + // the remover has to be implemented as well. + $guessedAdders = '"add'.implode('()", "add', $singulars).'()", '; + } else { + $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_ADDER_AND_REMOVER; + $access[self::ACCESS_ADDER] = $methods[0]; + $access[self::ACCESS_REMOVER] = $methods[1]; + } + } + + if (!isset($access[self::ACCESS_TYPE])) { + $setter = 'set'.$this->camelize($property); + $classHasProperty = $reflClass->hasProperty($property); + + if ($reflClass->hasMethod($setter) && $reflClass->getMethod($setter)->isPublic()) { + $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD; + $access[self::ACCESS_NAME] = $setter; + } elseif ($reflClass->hasMethod('__set') && $reflClass->getMethod('__set')->isPublic()) { + $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_PROPERTY; + $access[self::ACCESS_NAME] = $property; + } elseif ($classHasProperty && $reflClass->getProperty($property)->isPublic()) { + $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_PROPERTY; + $access[self::ACCESS_NAME] = $property; + } elseif ($this->magicCall && $reflClass->hasMethod('__call') && $reflClass->getMethod('__call')->isPublic()) { + // we call the getter and hope the __call do the job + $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_MAGIC; + $access[self::ACCESS_NAME] = $setter; + } else { + $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_NOT_FOUND; + $access[self::ACCESS_NAME] = sprintf( + 'Neither the property "%s" nor one of the methods %s"%s()", '. + '"__set()" or "__call()" exist and have public access in class "%s".', + $property, + $guessedAdders, + $setter, + $reflClass->name + ); + } + } + + $this->writePropertyCache[$key] = $access; + } + + return $access; + } + /** * Camelizes a given string. * diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php index 5b127e1bc403d..a38a3ef967869 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php @@ -375,4 +375,32 @@ public function testTicket5755() $this->assertEquals('foobar', $object->getProperty()); } + + /** + * @dataProvider getValidPropertyPaths + */ + public function testSetValue($objectOrArray, $path) + { + $this->propertyAccessor->setValue($objectOrArray, $path, 'Updated'); + + $this->assertSame('Updated', $this->propertyAccessor->getValue($objectOrArray, $path)); + } + + public function getValidPropertyPaths() + { + return array( + array(array('Bernhard', 'Schussek'), '[0]', 'Bernhard'), + array(array('Bernhard', 'Schussek'), '[1]', 'Schussek'), + array(array('firstName' => 'Bernhard'), '[firstName]', 'Bernhard'), + array(array('index' => array('firstName' => 'Bernhard')), '[index][firstName]', 'Bernhard'), + array((object) array('firstName' => 'Bernhard'), 'firstName', 'Bernhard'), + array((object) array('property' => array('firstName' => 'Bernhard')), 'property[firstName]', 'Bernhard'), + array(array('index' => (object) array('firstName' => 'Bernhard')), '[index].firstName', 'Bernhard'), + array((object) array('property' => (object) array('firstName' => 'Bernhard')), 'property.firstName', 'Bernhard'), + + // Missing indices + array(array('index' => array()), '[index][firstName]', null), + array(array('root' => array('index' => array())), '[root][index][firstName]', null), + ); + } } diff --git a/src/Symfony/Component/PropertyAccess/composer.json b/src/Symfony/Component/PropertyAccess/composer.json index 060ff8ef2c133..e9c5c41183b6c 100644 --- a/src/Symfony/Component/PropertyAccess/composer.json +++ b/src/Symfony/Component/PropertyAccess/composer.json @@ -19,7 +19,10 @@ "php": ">=5.3.3" }, "autoload": { - "psr-0": { "Symfony\\Component\\PropertyAccess\\": "" } + "psr-0": { "Symfony\\Component\\PropertyAccess\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/PropertyAccess", "minimum-stability": "dev", diff --git a/src/Symfony/Component/PropertyAccess/phpunit.xml.dist b/src/Symfony/Component/PropertyAccess/phpunit.xml.dist index 99858f7b95361..b0b20c1bd9460 100644 --- a/src/Symfony/Component/PropertyAccess/phpunit.xml.dist +++ b/src/Symfony/Component/PropertyAccess/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -21,6 +22,7 @@ ./Resources ./Tests + ./vendor diff --git a/src/Symfony/Component/Routing/composer.json b/src/Symfony/Component/Routing/composer.json index 824561077e187..6af426012881d 100644 --- a/src/Symfony/Component/Routing/composer.json +++ b/src/Symfony/Component/Routing/composer.json @@ -31,7 +31,10 @@ "doctrine/common": "" }, "autoload": { - "psr-0": { "Symfony\\Component\\Routing\\": "" } + "psr-0": { "Symfony\\Component\\Routing\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/Routing", "minimum-stability": "dev", diff --git a/src/Symfony/Component/Routing/phpunit.xml.dist b/src/Symfony/Component/Routing/phpunit.xml.dist index fae243c8152b0..b69f066ac1b2f 100644 --- a/src/Symfony/Component/Routing/phpunit.xml.dist +++ b/src/Symfony/Component/Routing/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -19,8 +20,8 @@ ./ - ./vendor ./Tests + ./vendor diff --git a/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php index a88250bff386c..5e1159f733105 100644 --- a/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php @@ -13,6 +13,7 @@ use Symfony\Component\Security\Core\SecurityContextInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Core\Util\StringUtils; use Symfony\Component\Security\Http\EntryPoint\DigestAuthenticationEntryPoint; use Psr\Log\LoggerInterface; use Symfony\Component\HttpKernel\Event\GetResponseEvent; @@ -99,7 +100,7 @@ public function handle(GetResponseEvent $event) return; } - if ($serverDigestMd5 !== $digestAuth->getResponse()) { + if (!StringUtils::equals($serverDigestMd5, $digestAuth->getResponse())) { if (null !== $this->logger) { $this->logger->debug(sprintf('Expected response: "%s" but received: "%s"; is AuthenticationDao returning clear text passwords?', $serverDigestMd5, $digestAuth->getResponse())); } diff --git a/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php b/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php index 942e53787a1bc..52a231c70e104 100644 --- a/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php @@ -20,6 +20,7 @@ use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; use Symfony\Component\Security\Http\SecurityEvents; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy; /** * RememberMeListener implements authentication capabilities via a cookie. @@ -33,6 +34,7 @@ class RememberMeListener implements ListenerInterface private $authenticationManager; private $logger; private $dispatcher; + private $sessionStrategy; /** * Constructor. @@ -50,6 +52,7 @@ public function __construct(SecurityContextInterface $securityContext, RememberM $this->authenticationManager = $authenticationManager; $this->logger = $logger; $this->dispatcher = $dispatcher; + $this->sessionStrategy = new SessionAuthenticationStrategy(SessionAuthenticationStrategy::MIGRATE); } /** @@ -70,6 +73,11 @@ public function handle(GetResponseEvent $event) try { $token = $this->authenticationManager->authenticate($token); + + if ($request->hasSession() && $request->getSession()->isStarted()) { + $this->sessionStrategy->onAuthentication($request, $token); + } + $this->securityContext->setToken($token); if (null !== $this->dispatcher) { diff --git a/src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php b/src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php index f800668a5e2b7..0fffbfe4f992d 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php +++ b/src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php @@ -21,6 +21,7 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Util\SecureRandomInterface; use Psr\Log\LoggerInterface; +use Symfony\Component\Security\Core\Util\StringUtils; /** * Concrete implementation of the RememberMeServicesInterface which needs @@ -90,7 +91,7 @@ protected function processAutoLoginCookie(array $cookieParts, Request $request) list($series, $tokenValue) = $cookieParts; $persistentToken = $this->tokenProvider->loadTokenBySeries($series); - if ($persistentToken->getTokenValue() !== $tokenValue) { + if (!StringUtils::equals($persistentToken->getTokenValue(), $tokenValue)) { throw new CookieTheftException('This token was already used. The account is possibly compromised.'); } diff --git a/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php b/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php index de662fb3d8b90..1aea5fd76d78d 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php +++ b/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php @@ -17,6 +17,7 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Core\Util\StringUtils; /** * Concrete implementation of the RememberMeServicesInterface providing @@ -53,7 +54,7 @@ protected function processAutoLoginCookie(array $cookieParts, Request $request) throw new \RuntimeException(sprintf('The UserProviderInterface implementation must return an instance of UserInterface, but returned "%s".', get_class($user))); } - if (true !== $this->compareHashes($hash, $this->generateCookieHash($class, $username, $expires, $user->getPassword()))) { + if (!StringUtils::equals($this->generateCookieHash($class, $username, $expires, $user->getPassword()), $hash)) { throw new AuthenticationException('The cookie\'s hash is invalid.'); } @@ -64,31 +65,6 @@ protected function processAutoLoginCookie(array $cookieParts, Request $request) return $user; } - /** - * Compares two hashes using a constant-time algorithm to avoid (remote) - * timing attacks. - * - * This is the same implementation as used in the BasePasswordEncoder. - * - * @param string $hash1 The first hash - * @param string $hash2 The second hash - * - * @return bool true if the two hashes are the same, false otherwise - */ - private function compareHashes($hash1, $hash2) - { - if (strlen($hash1) !== $c = strlen($hash2)) { - return false; - } - - $result = 0; - for ($i = 0; $i < $c; ++$i) { - $result |= ord($hash1[$i]) ^ ord($hash2[$i]); - } - - return 0 === $result; - } - /** * {@inheritdoc} */ diff --git a/src/Symfony/Component/Security/Tests/Core/Authentication/Token/AbstractTokenTest.php b/src/Symfony/Component/Security/Tests/Core/Authentication/Token/AbstractTokenTest.php index b8be6288dc7a9..efdad4ca7e6f4 100644 --- a/src/Symfony/Component/Security/Tests/Core/Authentication/Token/AbstractTokenTest.php +++ b/src/Symfony/Component/Security/Tests/Core/Authentication/Token/AbstractTokenTest.php @@ -85,10 +85,6 @@ public function testEraseCredentials() $token->eraseCredentials(); } - /** - * @covers Symfony\Component\Security\Core\Authentication\Token\AbstractToken::serialize - * @covers Symfony\Component\Security\Core\Authentication\Token\AbstractToken::unserialize - */ public function testSerialize() { $token = $this->getToken(array('ROLE_FOO')); @@ -114,9 +110,6 @@ public function testSerializeParent() ); } - /** - * @covers Symfony\Component\Security\Core\Authentication\Token\AbstractToken::__construct - */ public function testConstructor() { $token = $this->getToken(array('ROLE_FOO')); @@ -129,10 +122,6 @@ public function testConstructor() $this->assertEquals(array(new Role('ROLE_FOO'), new Role('ROLE_BAR')), $token->getRoles()); } - /** - * @covers Symfony\Component\Security\Core\Authentication\Token\AbstractToken::isAuthenticated - * @covers Symfony\Component\Security\Core\Authentication\Token\AbstractToken::setAuthenticated - */ public function testAuthenticatedFlag() { $token = $this->getToken(); @@ -145,13 +134,6 @@ public function testAuthenticatedFlag() $this->assertFalse($token->isAuthenticated()); } - /** - * @covers Symfony\Component\Security\Core\Authentication\Token\AbstractToken::getAttributes - * @covers Symfony\Component\Security\Core\Authentication\Token\AbstractToken::setAttributes - * @covers Symfony\Component\Security\Core\Authentication\Token\AbstractToken::hasAttribute - * @covers Symfony\Component\Security\Core\Authentication\Token\AbstractToken::getAttribute - * @covers Symfony\Component\Security\Core\Authentication\Token\AbstractToken::setAttribute - */ public function testAttributes() { $attributes = array('foo' => 'bar'); diff --git a/src/Symfony/Component/Security/Tests/Core/User/UserTest.php b/src/Symfony/Component/Security/Tests/Core/User/UserTest.php index d05f4911ab12e..eb21503bcce3a 100644 --- a/src/Symfony/Component/Security/Tests/Core/User/UserTest.php +++ b/src/Symfony/Component/Security/Tests/Core/User/UserTest.php @@ -16,7 +16,6 @@ class UserTest extends \PHPUnit_Framework_TestCase { /** - * @covers Symfony\Component\Security\Core\User\User::__construct * @expectedException \InvalidArgumentException */ public function testConstructorException() @@ -24,10 +23,6 @@ public function testConstructorException() new User('', 'superpass'); } - /** - * @covers Symfony\Component\Security\Core\User\User::__construct - * @covers Symfony\Component\Security\Core\User\User::getRoles - */ public function testGetRoles() { $user = new User('fabien', 'superpass'); @@ -37,38 +32,24 @@ public function testGetRoles() $this->assertEquals(array('ROLE_ADMIN'), $user->getRoles()); } - /** - * @covers Symfony\Component\Security\Core\User\User::__construct - * @covers Symfony\Component\Security\Core\User\User::getPassword - */ public function testGetPassword() { $user = new User('fabien', 'superpass'); $this->assertEquals('superpass', $user->getPassword()); } - /** - * @covers Symfony\Component\Security\Core\User\User::__construct - * @covers Symfony\Component\Security\Core\User\User::getUsername - */ public function testGetUsername() { $user = new User('fabien', 'superpass'); $this->assertEquals('fabien', $user->getUsername()); } - /** - * @covers Symfony\Component\Security\Core\User\User::getSalt - */ public function testGetSalt() { $user = new User('fabien', 'superpass'); $this->assertEquals('', $user->getSalt()); } - /** - * @covers Symfony\Component\Security\Core\User\User::isAccountNonExpired - */ public function testIsAccountNonExpired() { $user = new User('fabien', 'superpass'); @@ -78,9 +59,6 @@ public function testIsAccountNonExpired() $this->assertFalse($user->isAccountNonExpired()); } - /** - * @covers Symfony\Component\Security\Core\User\User::isCredentialsNonExpired - */ public function testIsCredentialsNonExpired() { $user = new User('fabien', 'superpass'); @@ -90,9 +68,6 @@ public function testIsCredentialsNonExpired() $this->assertFalse($user->isCredentialsNonExpired()); } - /** - * @covers Symfony\Component\Security\Core\User\User::isAccountNonLocked - */ public function testIsAccountNonLocked() { $user = new User('fabien', 'superpass'); @@ -102,9 +77,6 @@ public function testIsAccountNonLocked() $this->assertFalse($user->isAccountNonLocked()); } - /** - * @covers Symfony\Component\Security\Core\User\User::isEnabled - */ public function testIsEnabled() { $user = new User('fabien', 'superpass'); @@ -114,9 +86,6 @@ public function testIsEnabled() $this->assertFalse($user->isEnabled()); } - /** - * @covers Symfony\Component\Security\Core\User\User::eraseCredentials - */ public function testEraseCredentials() { $user = new User('fabien', 'superpass'); diff --git a/src/Symfony/Component/Security/Tests/Http/Firewall/RememberMeListenerTest.php b/src/Symfony/Component/Security/Tests/Http/Firewall/RememberMeListenerTest.php index 067cacb6cbdad..ad96243d47905 100644 --- a/src/Symfony/Component/Security/Tests/Http/Firewall/RememberMeListenerTest.php +++ b/src/Symfony/Component/Security/Tests/Http/Firewall/RememberMeListenerTest.php @@ -138,6 +138,69 @@ public function testOnCoreSecurity() $listener->handle($event); } + public function testSessionStrategy() + { + list($listener, $tokenStorage, $service, $manager) = $this->getListener(false, true, true); + + $tokenStorage + ->expects($this->once()) + ->method('getToken') + ->will($this->returnValue(null)) + ; + + $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + $service + ->expects($this->once()) + ->method('autoLogin') + ->will($this->returnValue($token)) + ; + + $tokenStorage + ->expects($this->once()) + ->method('setToken') + ->with($this->equalTo($token)) + ; + + $manager + ->expects($this->once()) + ->method('authenticate') + ->will($this->returnValue($token)) + ; + + $session = $this->getMock('\Symfony\Component\HttpFoundation\Session\SessionInterface'); + $session + ->expects($this->once()) + ->method('isStarted') + ->will($this->returnValue(true)) + ; + $session + ->expects($this->once()) + ->method('migrate') + ; + + $request = $this->getMock('\Symfony\Component\HttpFoundation\Request'); + $request + ->expects($this->any()) + ->method('hasSession') + ->will($this->returnValue(true)) + ; + + $request + ->expects($this->any()) + ->method('getSession') + ->will($this->returnValue($session)) + ; + + $event = $this->getGetResponseEvent(); + $event + ->expects($this->once()) + ->method('getRequest') + ->will($this->returnValue($request)) + ; + + $listener->handle($event); + } + protected function getGetResponseEvent() { return $this->getMock('Symfony\Component\HttpKernel\Event\GetResponseEvent', array(), array(), '', false); diff --git a/src/Symfony/Component/Security/composer.json b/src/Symfony/Component/Security/composer.json index e62f028b732f8..ddc700af79532 100644 --- a/src/Symfony/Component/Security/composer.json +++ b/src/Symfony/Component/Security/composer.json @@ -31,6 +31,11 @@ "psr/log": "~1.0", "ircmaxell/password-compat": "~1.0" }, + "replace": { + "symfony/security-acl": "self.version", + "symfony/security-core": "self.version", + "symfony/security-http": "self.version" + }, "suggest": { "symfony/class-loader": "", "symfony/finder": "", @@ -42,7 +47,10 @@ "paragonie/random_compat": "" }, "autoload": { - "psr-0": { "Symfony\\Component\\Security\\": "" } + "psr-0": { "Symfony\\Component\\Security\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/Security", "minimum-stability": "dev", diff --git a/src/Symfony/Component/Security/phpunit.xml.dist b/src/Symfony/Component/Security/phpunit.xml.dist index 9a20f91498ae9..9d3cf4a02318d 100644 --- a/src/Symfony/Component/Security/phpunit.xml.dist +++ b/src/Symfony/Component/Security/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -19,8 +20,10 @@ ./ - ./vendor + ./Acl/Resources + ./Resources ./Tests + ./vendor diff --git a/src/Symfony/Component/Serializer/composer.json b/src/Symfony/Component/Serializer/composer.json index dbc270748106a..305ab003789ab 100644 --- a/src/Symfony/Component/Serializer/composer.json +++ b/src/Symfony/Component/Serializer/composer.json @@ -19,7 +19,10 @@ "php": ">=5.3.3" }, "autoload": { - "psr-0": { "Symfony\\Component\\Serializer\\": "" } + "psr-0": { "Symfony\\Component\\Serializer\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/Serializer", "minimum-stability": "dev", diff --git a/src/Symfony/Component/Serializer/phpunit.xml.dist b/src/Symfony/Component/Serializer/phpunit.xml.dist index da0540137b19a..4799e3cf2f1dd 100644 --- a/src/Symfony/Component/Serializer/phpunit.xml.dist +++ b/src/Symfony/Component/Serializer/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -19,8 +20,8 @@ ./ - ./vendor ./Tests + ./vendor diff --git a/src/Symfony/Component/Stopwatch/composer.json b/src/Symfony/Component/Stopwatch/composer.json index 3fb113b796116..c2b5d08739cc1 100644 --- a/src/Symfony/Component/Stopwatch/composer.json +++ b/src/Symfony/Component/Stopwatch/composer.json @@ -19,7 +19,10 @@ "php": ">=5.3.3" }, "autoload": { - "psr-0": { "Symfony\\Component\\Stopwatch\\": "" } + "psr-0": { "Symfony\\Component\\Stopwatch\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/Stopwatch", "minimum-stability": "dev", diff --git a/src/Symfony/Component/Stopwatch/phpunit.xml.dist b/src/Symfony/Component/Stopwatch/phpunit.xml.dist index 38078d25bb7ee..b16dcaebf9a47 100644 --- a/src/Symfony/Component/Stopwatch/phpunit.xml.dist +++ b/src/Symfony/Component/Stopwatch/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ diff --git a/src/Symfony/Component/Templating/composer.json b/src/Symfony/Component/Templating/composer.json index f39b8f3600433..d9ee9981bc634 100644 --- a/src/Symfony/Component/Templating/composer.json +++ b/src/Symfony/Component/Templating/composer.json @@ -19,7 +19,10 @@ "php": ">=5.3.3" }, "autoload": { - "psr-0": { "Symfony\\Component\\Templating\\": "" } + "psr-0": { "Symfony\\Component\\Templating\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/Templating", "minimum-stability": "dev", diff --git a/src/Symfony/Component/Templating/phpunit.xml.dist b/src/Symfony/Component/Templating/phpunit.xml.dist index 3da1f5de1371c..109584e805db2 100644 --- a/src/Symfony/Component/Templating/phpunit.xml.dist +++ b/src/Symfony/Component/Templating/phpunit.xml.dist @@ -20,8 +20,8 @@ ./ - ./vendor ./Tests + ./vendor diff --git a/src/Symfony/Component/Translation/PluralizationRules.php b/src/Symfony/Component/Translation/PluralizationRules.php index 6d91da7fc6c78..8b02773b5884a 100644 --- a/src/Symfony/Component/Translation/PluralizationRules.php +++ b/src/Symfony/Component/Translation/PluralizationRules.php @@ -132,6 +132,7 @@ public static function get($number, $locale) case 'fr': case 'gun': case 'hi': + case 'hy': case 'ln': case 'mg': case 'nso': diff --git a/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php index ff986d2f33016..a3aa89597a03b 100644 --- a/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php +++ b/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php @@ -30,7 +30,7 @@ public function testLoad() public function testLoadWithInternalErrorsEnabled() { - libxml_use_internal_errors(true); + $internalErrors = libxml_use_internal_errors(true); $this->assertSame(array(), libxml_get_errors()); @@ -41,6 +41,9 @@ public function testLoadWithInternalErrorsEnabled() $this->assertEquals('en', $catalogue->getLocale()); $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); $this->assertSame(array(), libxml_get_errors()); + + libxml_clear_errors(); + libxml_use_internal_errors($internalErrors); } public function testLoadWithResname() diff --git a/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php b/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php index 066e07f5ab3f2..43c31672c2ce5 100644 --- a/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php +++ b/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php @@ -61,7 +61,7 @@ public function successLangcodes() { return array( array('1', array('ay','bo', 'cgg','dz','id', 'ja', 'jbo', 'ka','kk','km','ko','ky')), - array('2', array('nl', 'fr', 'en', 'de', 'de_GE')), + array('2', array('nl', 'fr', 'en', 'de', 'de_GE', 'hy', 'hy_AM')), array('3', array('be','bs','cs','hr')), array('4', array('cy','mt', 'sl')), array('5', array()), diff --git a/src/Symfony/Component/Translation/composer.json b/src/Symfony/Component/Translation/composer.json index 19b2d8ebf6d0e..9979bd1b72485 100644 --- a/src/Symfony/Component/Translation/composer.json +++ b/src/Symfony/Component/Translation/composer.json @@ -28,7 +28,10 @@ "symfony/yaml": "" }, "autoload": { - "psr-0": { "Symfony\\Component\\Translation\\": "" } + "psr-0": { "Symfony\\Component\\Translation\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/Translation", "minimum-stability": "dev", diff --git a/src/Symfony/Component/Translation/phpunit.xml.dist b/src/Symfony/Component/Translation/phpunit.xml.dist index 16cca4afb7c69..c25ec5eda6940 100644 --- a/src/Symfony/Component/Translation/phpunit.xml.dist +++ b/src/Symfony/Component/Translation/phpunit.xml.dist @@ -20,8 +20,8 @@ ./ - ./vendor ./Tests + ./vendor diff --git a/src/Symfony/Component/Validator/Constraints/UrlValidator.php b/src/Symfony/Component/Validator/Constraints/UrlValidator.php index 5af71e6d824ee..5127f8b1660f6 100644 --- a/src/Symfony/Component/Validator/Constraints/UrlValidator.php +++ b/src/Symfony/Component/Validator/Constraints/UrlValidator.php @@ -33,7 +33,7 @@ class UrlValidator extends ConstraintValidator \] # a IPv6 address ) (:[0-9]+)? # a port (optional) - (/?|/\S+|\?|\#) # a /, nothing, a / with something, a query or a fragment + (/?|/\S+|\?\S*|\#\S*) # a /, nothing, a / with something, a query or a fragment $~ixu'; /** diff --git a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php index c08531339c2a4..93e9e8237ff0e 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php @@ -112,7 +112,11 @@ public function getValidUrls() array('http://username:password@symfony.com'), array('http://user-name@symfony.com'), array('http://symfony.com?'), + array('http://symfony.com?query=1'), + array('http://symfony.com/?query=1'), array('http://symfony.com#'), + array('http://symfony.com#fragment'), + array('http://symfony.com/#fragment'), ); } diff --git a/src/Symfony/Component/Validator/composer.json b/src/Symfony/Component/Validator/composer.json index 4510ff3253c59..ea79565660ae1 100644 --- a/src/Symfony/Component/Validator/composer.json +++ b/src/Symfony/Component/Validator/composer.json @@ -34,7 +34,10 @@ "symfony/config": "" }, "autoload": { - "psr-0": { "Symfony\\Component\\Validator\\": "" } + "psr-0": { "Symfony\\Component\\Validator\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/Validator", "minimum-stability": "dev", diff --git a/src/Symfony/Component/Validator/phpunit.xml.dist b/src/Symfony/Component/Validator/phpunit.xml.dist index 1bf4391c3c181..cf8c343863e5d 100644 --- a/src/Symfony/Component/Validator/phpunit.xml.dist +++ b/src/Symfony/Component/Validator/phpunit.xml.dist @@ -20,8 +20,9 @@ ./ - ./vendor + ./Resources ./Tests + ./vendor diff --git a/src/Symfony/Component/Yaml/composer.json b/src/Symfony/Component/Yaml/composer.json index 791dbe2b2640a..96aa97dab0acc 100644 --- a/src/Symfony/Component/Yaml/composer.json +++ b/src/Symfony/Component/Yaml/composer.json @@ -19,7 +19,10 @@ "php": ">=5.3.3" }, "autoload": { - "psr-0": { "Symfony\\Component\\Yaml\\": "" } + "psr-0": { "Symfony\\Component\\Yaml\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "target-dir": "Symfony/Component/Yaml", "minimum-stability": "dev", diff --git a/src/Symfony/Component/Yaml/phpunit.xml.dist b/src/Symfony/Component/Yaml/phpunit.xml.dist index 8f7741fe393e6..6bdbea16e6426 100644 --- a/src/Symfony/Component/Yaml/phpunit.xml.dist +++ b/src/Symfony/Component/Yaml/phpunit.xml.dist @@ -9,6 +9,7 @@ + ./Tests/ @@ -19,8 +20,8 @@ ./ - ./vendor ./Tests + ./vendor