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 7027114730604..18d4646a95664 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,15 +32,17 @@ 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" = 5.* ]] && [ "$deps" = "no" ]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo "extension = $(pwd)/modules/symfony_debug.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini); fi; - - if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php -i; fi; + - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]] && [ "$deps" = "no" ]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo "extension = $(pwd)/modules/symfony_debug.so" >> $INI_FILE); 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 d08b224d9d7c5..9c9d593aa08c7 100644 --- a/CHANGELOG-2.3.md +++ b/CHANGELOG-2.3.md @@ -7,6 +7,38 @@ 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.34 (2015-10-27) + + * bug #16288 [Process] Inherit env vars by default in PhpProcess (nicolas-grekas) + * bug #16302 [DoctrineBridge] Fix required guess of boolean fields (enumag) + * bug #16177 [HttpFoundation] Fixes /0 subnet handling in IpUtils (ultrafez) + * bug #16259 [Validator] Allow an empty path in a URL with only a fragment or a query (jakzal) + * bug #16226 [filesystem] makeRelativePath does not work correctly from root (jaytaph, fabpot) + * bug #16182 [Process] Workaround buggy PHP warning (cbj4074) + * bug #16095 [Console] Add additional ways to detect OS400 platform (johnkary) + * bug #15793 [Yaml] Allow tabs before comments at the end of a line (superdav42) + * bug #16152 Fix URL validator failure with empty string (fabpot, bocharsky-bw) + * bug #15121 fixed #15118 [Filesystem] mirroring a symlink copies absolute file path (danepowell) + * bug #15161 avoid duplicated path with addPrefix (remicollet) + * bug #16133 compatibility with Security component split (xabbuh) + * bug #16123 Command list ordering fix (spdionis, fabpot) + * bug #14842 [Security][bugfix] "Remember me" cookie cleared on logout with custom "secure"/"httponly" config options (MacDada) + * bug #13627 [Security] InMemoryUserProvider now concerns whether user's password is changed when refreshing (issei-m) + * bug #16090 Fix PropertyAccessor modifying array in object when array key does no… (pierredup) + * bug #16111 Throw exception if tempnam returns false in ProcessPipes (pierredup) + * bug #16053 [Console] use PHP_OS instead of php_uname('s') (xabbuh) + * bug #15860 [Yaml] Fix improper comments removal (ogizanagi) + * bug #16050 [TwigBundle] fix useless and failing test (Tobion) + * bug #15482 [Yaml] Improve newline handling in folded scalar blocks (teohhanhui) + * bug #15976 [Console] do not make the getHelp() method smart (xabbuh) + * bug #15799 [HttpFoundation] NativeSessionStorage `regenerate` method wrongly sets storage as started (iambrosi) + * bug #15533 [Console] Fix input validation when required arguments are missing (jakzal) + * bug #15915 Detect Mintty for color support on Windows (stof) + * bug #15906 Forbid serializing a Crawler (stof) + * bug #15682 [Form] Added exception when setAutoInitialize() is called when locked (jaytaph) + * bug #15846 [FrameworkBundle] Advanced search templates of bundles (yethee) + * bug #15895 [Security] Allow user providers to be defined in many files (lyrixx) + * 2.3.33 (2015-09-25) * bug #15821 [EventDispatcher] fix memory leak in getListeners (Tobion) diff --git a/CHANGELOG-2.7.md b/CHANGELOG-2.7.md index 05bf4d856d835..19e9036c82bb2 100644 --- a/CHANGELOG-2.7.md +++ b/CHANGELOG-2.7.md @@ -7,6 +7,34 @@ in 2.7 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.7.0...v2.7.1 +* 2.7.7 (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 #16578 [Console] Fix bug in windows detection (kbond) + * bug #16546 [Serializer] ObjectNormalizer: don't serialize static methods and props (dunglas) + * 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 #15945 [Form] trigger deprecation warning when using empty_value (xabbuh) + * bug #16384 [FrameworkBundle] JsonDescriptor - encode container params only once (xabbuh) + * bug #16480 [VarDumper] Fix PHP7 type-hints compat (nicolas-grekas) + * bug #16463 [PropertyAccess] Port of the performance optimization from 2.3 (dunglas) + * bug #16462 [PropertyAccess] Fix dynamic property accessing. (dunglas) + * bug #16454 [Serializer] GetSetNormalizer shouldn't set/get static methods (boekkooi) + * bug #16453 [Serializer] PropertyNormalizer shouldn't set static properties (boekkooi) + * bug #16471 [VarDumper] Fix casting for ReflectionParameter (nicolas-grekas) + * 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.7.6 (2015-10-27) * bug #16338 [VarDumper] Fix anonymous class dumping (nicolas-grekas) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ac53dc8b75159..b78fd1ff5ee94 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -10,8 +10,8 @@ Symfony is the result of the work of many people who made the code better - Tobias Schultze (tobion) - Victor Berchet (victor) - Jordi Boggiano (seldaek) - - Johannes S (johannes) - Christophe Coevoet (stof) + - Johannes S (johannes) - Kris Wallsmith (kriswallsmith) - Jakub Zalas (jakubzalas) - Christian Flothmann (xabbuh) @@ -28,12 +28,12 @@ Symfony is the result of the work of many people who made the code better - Benjamin Eberlei (beberlei) - Igor Wiedler (igorw) - Martin Hasoň (hason) + - Wouter De Jong (wouterj) - Eriksen Costa (eriksencosta) - Grégoire Pineau (lyrixx) - - Wouter De Jong (wouterj) - Javier Eguiluz (javier.eguiluz) - - Jonathan Wage (jwage) - Kévin Dunglas (dunglas) + - Jonathan Wage (jwage) - Alexandre Salomé (alexandresalome) - William Durand (couac) - ornicar @@ -52,16 +52,18 @@ Symfony is the result of the work of many people who made the code better - Eric Clemmons (ericclemmons) - Andrej Hudec (pulzarraider) - Deni + - Maxime Steinhausser (ogizanagi) - Henrik Westphal (snc) - Dariusz Górecki (canni) - - Arnout Boks (aboks) + - Gábor Egyed (1ed) - Christian Raue + - Arnout Boks (aboks) - Michel Weimerskirch (mweimerskirch) + - Kevin Bond (kbond) - Lee McDermott - Brandon Turner - Luis Cordova (cordoval) - Douglas Greenshields (shieldo) - - Kevin Bond (kbond) - Daniel Holmes (dholmes) - Bart van den Burg (burgov) - Jordan Alliot (jalliot) @@ -69,18 +71,16 @@ Symfony is the result of the work of many people who made the code better - Fran Moreno (franmomu) - Antoine Hérault (herzult) - Toni Uebernickel (havvg) - - Gábor Egyed (1ed) + - Matthias Pigulla (mpdude) - Arnaud Le Blanc (arnaud-lb) - - Maxime Steinhausser (ogizanagi) - Tim Nagel (merk) - Brice BERNARD (brikou) + - Jérôme Tamarelle (gromnan) - marc.weistroff - lenar - Graham Campbell (graham) - Włodzimierz Gajda (gajdaw) - - Jérôme Tamarelle (gromnan) - Florian Voutzinos (florianv) - - Matthias Pigulla (mpdude) - Colin Frei - Adrien Brault (adrienbrault) - excelwebzone @@ -88,6 +88,7 @@ Symfony is the result of the work of many people who made the code better - Fabien Pennequin (fabienpennequin) - Peter Rehm (rpet) - Peter Kokot (maastermedia) + - Alexander Schwenn (xelaris) - Gordon Franke (gimler) - Robert Schönthal (digitalkaoz) - Jérémy DERUSSÉ (jderusse) @@ -95,26 +96,26 @@ Symfony is the result of the work of many people who made the code better - Michal Piotrowski (eventhorizon) - Stefano Sala (stefano.sala) - David Buchmann (dbu) - - Alexander Schwenn (xelaris) + - Issei Murasawa (issei_m) + - Iltar van der Berg (kjarli) - Juti Noppornpitak (shiroyuki) - Eric GELOEN (gelo) - Sebastian Hörl (blogsh) - Daniel Gomes (danielcsgomes) - Hidenori Goto (hidenorigoto) + - Joshua Thijssen - Guilherme Blanco (guilhermeblanco) - - Iltar van der Berg (kjarli) - Pablo Godel (pgodel) - Vladimir Reznichenko (kalessil) - Jérémie Augustin (jaugustin) - Sebastiaan Stok (sstok) - - Issei Murasawa (issei_m) - Rafael Dohms (rdohms) - Arnaud Kleinpeter (nanocom) - - Joshua Thijssen - Tigran Azatyan (tigranazatyan) - Richard Shank (iampersistent) - Clemens Tolboom - Helmer Aaviksoo + - Baptiste Clavié (talus) - Hiromi Hishida (77web) - Matthieu Ouellette-Vachon (maoueh) - Michał Pipa (michal.pipa) @@ -122,6 +123,9 @@ Symfony is the result of the work of many people who made the code better - Jonathan Ingram (jonathaningram) - Artur Kotyrba - Rouven Weßling (realityking) + - Charles Sarrazin (csarrazi) + - Pierre du Plessis (pierredup) + - Tugdual Saunier (tucksaun) - Andréia Bohner (andreia) - Dmitrii Chekaliuk (lazyhammer) - Clément JOBEILI (dator) @@ -131,11 +135,13 @@ Symfony is the result of the work of many people who made the code better - hacfi (hifi) - Mario A. Alvarez Garcia (nomack84) - Dennis Benkert (denderello) + - Alexander M. Turek (derrabus) + - Konstantin Myakshin (koc) - Benjamin Dulau (dbenjamin) - Andreas Hucks (meandmymonkey) + - Mikael Pajunen - Noel Guilbert (noel) - Joel Wurtz (brouznouf) - - Charles Sarrazin (csarrazi) - bronze1man - sun (sun) - Larry Garfield (crell) @@ -146,19 +152,19 @@ Symfony is the result of the work of many people who made the code better - fivestar - Dominique Bongiraud - Leszek Prabucki (l3l0) - - Alexander M. Turek (derrabus) - François Zaninotto (fzaninotto) - Dustin Whittle (dustinwhittle) - jeff + - John Kary (johnkary) - Justin Hileman (bobthecow) + - Michele Orselli (orso) - Sven Paulus (subsven) - Warnar Boekkooi (boekkooi) - Lars Strojny (lstrojny) - Rui Marinho (ruimarinho) - - Mikael Pajunen - Julien Brochet (mewt) - - Tugdual Saunier (tucksaun) - Sergey Linnik (linniksa) + - Jáchym Toušek - Marcel Beerta (mazen) - Vincent AUBERT (vincent) - julien pauli (jpauli) @@ -166,12 +172,10 @@ Symfony is the result of the work of many people who made the code better - Alexander Kotynia (olden) - Daniel Tschinder - Elnur Abdurrakhimov (elnur) - - John Kary (johnkary) - Manuel Reinhard (sprain) - Danny Berger (dpb587) - Roman Marintšenko (inori) - Xavier Montaña Carreras (xmontana) - - Michele Orselli (orso) - Chris Wilkinson (thewilkybarkid) - Xavier Perez - Arjen Brouwer (arjenjb) @@ -192,10 +196,10 @@ Symfony is the result of the work of many people who made the code better - Nikita Konstantinov - Wodor Wodorski - Matthieu Auger (matthieuauger) + - Michael Lee (zerustech) - Sébastien Lavoie (lavoiesl) - Beau Simensen (simensen) - Robert Kiss (kepten) - - Konstantin Myakshin (koc) - Ruben Gonzalez (rubenrua) - Kim Hemsø Rasmussen (kimhemsoe) - Diego Saint Esteben (dosten) @@ -205,6 +209,7 @@ Symfony is the result of the work of many people who made the code better - Peter Kruithof (pkruithof) - Michael Holm (hollo) - Marc Weistroff (futurecat) + - Dawid Nowak - Kristen Gilden (kgilden) - Chris Smith (cs278) - Florian Klein (docteurklein) @@ -220,6 +225,7 @@ Symfony is the result of the work of many people who made the code better - Thomas Tourlourat (armetiz) - Andrey Esaulov (andremaha) - Grégoire Passault (gregwar) + - Ismael Ambrosi (iambrosi) - Uwe Jäger (uwej711) - Aurelijus Valeiša (aurelijus) - Jan Decavele (jandc) @@ -248,6 +254,7 @@ Symfony is the result of the work of many people who made the code better - Inal DJAFAR (inalgnu) - Christian Gärtner (dagardner) - Tomasz Kowalczyk (thunderer) + - François-Xavier de Guillebon (de-gui_f) - Daniel Wehner - Felix Labrecque - Yaroslav Kiliba @@ -256,7 +263,6 @@ Symfony is the result of the work of many people who made the code better - Evgeniy (ewgraf) - Robbert Klarenbeek (robbertkl) - Blanchon Vincent (blanchonvincent) - - Dawid Nowak - hossein zolfi (ocean) - Clément Gautier (clementgautier) - Eduardo Gulias (egulias) @@ -265,7 +271,6 @@ Symfony is the result of the work of many people who made the code better - Philipp Kräutli (pkraeutli) - Kirill chEbba Chebunin (chebba) - Greg Thornton (xdissent) - - Baptiste Clavié (talus) - Costin Bereveanu (schniper) - Loïc Chardonnet (gnusat) - Marek Kalnik (marekkalnik) @@ -277,7 +282,6 @@ Symfony is the result of the work of many people who made the code better - Pavel Volokitin (pvolok) - Endre Fejes - Tobias Naumann (tna) - - Ismael Ambrosi (iambrosi) - Shein Alexey - Joe Lencioni - Daniel Tschinder @@ -298,7 +302,6 @@ Symfony is the result of the work of many people who made the code better - Christophe L. (christophelau) - Massimiliano Arione (garak) - Anthon Pang (robocoder) - - Jáchym Toušek - Jannik Zschiesche (apfelbox) - Emanuele Gaspari (inmarelibero) - Dariusz Rumiński @@ -308,12 +311,10 @@ Symfony is the result of the work of many people who made the code better - Jeanmonod David (jeanmonod) - Berny Cantos (xphere81) - Thomas Lallement (raziel057) - - Michael Lee (zerustech) - Jan Schumann - Niklas Fiekas - lancergr - Antonio J. García Lagar (ajgarlag) - - Pierre du Plessis (pierredup) - Olivier Dolbeau (odolbeau) - Roumen Damianoff (roumen) - vagrant @@ -329,11 +330,11 @@ Symfony is the result of the work of many people who made the code better - Christian Schmidt - Marcin Sikoń (marphi) - Dominik Zogg (dominik.zogg) + - Mathieu Lemoine - franek (franek) - Damien Alexandre (damienalexandre) - Adam Harvey - Alex Bakhturin - - François-Xavier de Guillebon (de-gui_f) - boombatower - Fabrice Bernhard (fabriceb) - Jérôme Macias (jeromemacias) @@ -364,6 +365,7 @@ 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) - Erik Trapman (eriktrapman) - De Cock Xavier (xdecock) - Scott Arciszewski @@ -379,12 +381,15 @@ 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) + - MatTheCat + - John Bafford (jbafford) - Denis Gorbachev (starfall) - Titouan Galopin (tgalopin) - Steven Surowiec - Kevin Saliou (kbsali) - Ryan - Alexander Deruwe (aderuwe) + - Alain Hippolyte (aloneh) - Dave Hulbert (dave1010) - François Pluchino (francoispluchino) - Ivan Rey (ivanrey) @@ -445,6 +450,7 @@ Symfony is the result of the work of many people who made the code better - umpirski - Chris Heng (gigablah) - Ulumuddin Yunus (joenoez) + - Florian Pfitzer (marmelatze) - Luc Vieillescazes (iamluc) - Johann Saunier (prophet777) - Antoine Corcy @@ -471,7 +477,6 @@ Symfony is the result of the work of many people who made the code better - develop - Mark Sonnabaum - Alexander Obuhovich (aik099) - - Mathieu Lemoine - jochenvdv - Filippo Tessarotto - Arturas Smorgun (asarturas) @@ -538,7 +543,7 @@ Symfony is the result of the work of many people who made the code better - Abhoryo - Fabian Vogler (fabian) - Korvin Szanto - - MatTheCat + - Alaattin Kahramanlar (alaattin) - Maksim Kotlyar (makasim) - Neil Ferreira - Dmitry Parnas (parnas) @@ -555,21 +560,19 @@ Symfony is the result of the work of many people who made the code better - Matt Robinson (inanimatt) - Tristan Darricau (nicofuma) - Aleksey Podskrebyshev + - Steffen Roßkamp - David Marín Carreño (davefx) - Jörn Lang (j.lang) - Leo Feyer - - John Bafford (jbafford) - mwsaz - Benoît Bourgeois - corphi - grizlik - Derek ROTH - - Alain Hippolyte (aloneh) - Shin Ohno (ganchiku) - Geert De Deckere (geertdd) - Jan Kramer (jankramer) - Jean-Baptiste GOMOND (mjbgo) - - Richard van Laak (rvanlaak) - abdul malik ikhsan (samsonasik) - Henry Snoek (snoek09) - Timothée Barray (tyx) @@ -596,6 +599,7 @@ Symfony is the result of the work of many people who made the code better - Daniel Cestari - Brunet Laurent (lbrunet) - Magnus Nordlander (magnusnordlander) + - Michiel Boeckaert (milio) - Mikhail Yurasov (mym) - LOUARDI Abdeltif (ouardisoft) - Robert Gruendler (pulse00) @@ -620,6 +624,7 @@ Symfony is the result of the work of many people who made the code better - Chris Jones (leek) - Colin O'Dell (colinodell) - xaav + - Jean-Christophe Cuvelier [Artack] - Mahmoud Mostafa (mahmoud) - Michael Tibben - Sander Marechal @@ -628,6 +633,7 @@ Symfony is the result of the work of many people who made the code better - Mei Gwilym (meigwilym) - Michael H. Arieli (excelwebzone) - Luciano Mammino (loige) + - Michael Hirschler (mvhirsch) - fabios - Jérôme Vasseur - Sander Coolen (scoolen) @@ -668,15 +674,18 @@ Symfony is the result of the work of many people who made the code better - Ville Mattila - Boris Vujicic (boris.vujicic) - Max Beutel + - Michal Trojanowski - Catalin Dan - nacho - Piotr Antosik (antek88) - Artem Lopata - Samuel ROZE (sroze) + - Sergey Novikov (s12v) - Marcos Quesada (marcos_quesada) - Matthew Vickery (mattvick) - Dan Finnie - Ken Marfilla (marfillaster) + - Max Grigorian (maxakawizard) - benatespina (benatespina) - Denis Kop - jfcixmedia @@ -709,9 +718,11 @@ Symfony is the result of the work of many people who made the code better - Jochen Bayer (jocl) - Jeremy Bush - wizhippo + - Viacheslav Sychov - rpg600 - Péter Buri (burci) - Davide Borsatto (davide.borsatto) + - Teoh Han Hui (teohhanhui) - kaiwa - Charles Sanquer (csanquer) - Albert Ganiev (helios-ag) @@ -723,9 +734,11 @@ Symfony is the result of the work of many people who made the code better - Artem Kolesnikov (tyomo4ka) - Gustavo Adrian - Yannick + - spdionis - Eduardo García Sanz (coma) - James Gilliland - Roy Van Ginneken + - Stephan Vock - David de Boer (ddeboer) - Gilles Doge (gido) - abulford @@ -768,7 +781,9 @@ Symfony is the result of the work of many people who made the code better - ConneXNL - Aharon Perkel - Abdul.Mohsen B. A. A + - Gintautas Miselis - Benoît Burnichon + - Remi Collet - pthompson - Malaney J. Hill - Christian Flach (cmfcmf) @@ -806,6 +821,7 @@ Symfony is the result of the work of many people who made the code better - Berat Doğan - twifty - Anthony Ferrara + - Klaas Cuvelier (kcuvelier) - ShiraNai7 - Janusz Jabłoński (yanoosh) - George Giannoulopoulos @@ -868,6 +884,7 @@ Symfony is the result of the work of many people who made the code better - Thomas Chmielowiec (chmielot) - Jānis Lukss - rkerner + - Alex Silcock - Rob Bast - Matthew J Mucklo - fdgdfg (psampaz) @@ -964,12 +981,14 @@ Symfony is the result of the work of many people who made the code better - Botond Dani (picur) - Thierry Marianne (thierrymarianne) - Nick Stemerdink + - David Stone - jjanvier - Julius Beckmann - Romain Dorgueil - Grayson Koonce (breerly) - Karim Cassam Chenaï (ka) - Nicolas Bastien (nicolas_bastien) + - Denis (yethee) - Andrew Zhilin (zhil) - Andy Stanberry - Luiz “Felds” Liscia @@ -977,6 +996,7 @@ Symfony is the result of the work of many people who made the code better - alefranz - avi123 - alsar + - Aarón Nieves Fernández - Mike Meier - Kirill Saksin - michalmarcinkowski @@ -1025,6 +1045,7 @@ Symfony is the result of the work of many people who made the code better - J Bruni - Alexey Prilipko - bertillon + - Victor Bocharsky (bocharsky_bw) - Luca Genuzio (genuzio) - Hans Nilsson (hansnilsson) - Andrew Marcinkevičius (ifdattic) @@ -1037,6 +1058,7 @@ Symfony is the result of the work of many people who made the code better - tante kinast (tante) - Vincent LEFORT (vlefort) - Sadicov Vladimir (xtech) + - Peter van Dommelen - Alexander Zogheb - Rémi Blaise - Joel Marcey @@ -1053,7 +1075,6 @@ Symfony is the result of the work of many people who made the code better - Grégory Pelletier (ip512) - John Nickell (jrnickell) - Julien DIDIER (juliendidier) - - Florian Pfitzer (marmelatze) - Martin Mayer (martin) - Grzegorz Łukaszewicz (newicz) - Omar Yepez (oyepez003) @@ -1068,6 +1089,7 @@ Symfony is the result of the work of many people who made the code better - Joseph Maarek - Alexander Menk - Alex Pods + - hadriengem - timaschew - Ian Phillips - Haritz @@ -1080,12 +1102,12 @@ Symfony is the result of the work of many people who made the code better - Per Modin - David Windell - Gabriel Birke - - Steffen Roßkamp - skafandri - Alan Chen - Maerlyn - Even André Fiskvik - Diego Agulló + - Dane Powell - Gerrit Drost - Lenar Lõhmus - Cristian Gonzalez @@ -1141,6 +1163,7 @@ Symfony is the result of the work of many people who made the code better - Alexey Popkov - Joseph Deray - Damian Sromek + - Ben - Arnaud Buathier (arnapou) - chesteroni (chesteroni) - Mauricio Lopez (diaspar) @@ -1205,6 +1228,7 @@ Symfony is the result of the work of many people who made the code better - Brian Freytag - Skorney - mieszko4 + - Steve Preston - Neophy7e - bokonet - Arrilot @@ -1235,6 +1259,7 @@ Symfony is the result of the work of many people who made the code better - DanSync - Peter Zwosta - parhs + - Diego Campoy - TeLiXj - Oncle Tom - Christian Stocker @@ -1247,11 +1272,12 @@ Symfony is the result of the work of many people who made the code better - ilyes kooli - Matthias Althaus - Michaël VEROUX + - Julia + - arduanov - sualko - Nicolas Roudaire - Alfonso (afgar) - Andreas Forsblom (aforsblo) - - Alaattin Kahramanlar (alaattin) - Alex Olmos (alexolmos) - Antonio Mansilla (amansilla) - Juan Ases García (ases) @@ -1305,6 +1331,7 @@ Symfony is the result of the work of many people who made the code better - Philipp Hoffmann (philipphoffmann) - Alex Carol (picard89) - Daniel Perez Pinazo (pitiflautico) + - Brayden Williams (redstar504) - Rich Sage (richsage) - Ruud Kamphuis (ruudk) - Bart Ruysseveldt (ruyss) @@ -1325,6 +1352,7 @@ Symfony is the result of the work of many people who made the code better - Vincent (vincent1870) - Eugene Babushkin (warl) - Xavier Amado (xamado) + - Yonel Ceruto González (yonelceruto) - Jesper Søndergaard Pedersen (zerrvox) - Florent Cailhol - szymek @@ -1349,7 +1377,6 @@ Symfony is the result of the work of many people who made the code better - Maxime COLIN (maximecolin) - Muharrem Demirci (mdemirci) - Evgeny Z (meze) - - Michiel Boeckaert (milio) - Nicolas de Marqué (nicola) - Kevin (oxfouzer) - Pierre Geyer (ptheg) diff --git a/composer.json b/composer.json index f3ff629ffb568..5f5ce93d65166 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "require": { "php": ">=5.3.9", "doctrine/common": "~2.4", - "twig/twig": "~1.20|~2.0", + "twig/twig": "~1.23|~2.0", "psr/log": "~1.0" }, "replace": { @@ -91,7 +91,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 726b91ef23668..b22aede91d94e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -40,6 +40,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 9141e9a2d39bc..37a72b07b6b02 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 468f21b7163ef..f727880491c11 100644 --- a/src/Symfony/Bridge/Doctrine/composer.json +++ b/src/Symfony/Bridge/Doctrine/composer.json @@ -41,7 +41,10 @@ "doctrine/orm": "" }, "autoload": { - "psr-4": { "Symfony\\Bridge\\Doctrine\\": "" } + "psr-4": { "Symfony\\Bridge\\Doctrine\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Bridge/Doctrine/phpunit.xml.dist b/src/Symfony/Bridge/Doctrine/phpunit.xml.dist index 5b576e52c95e9..c006d232219a4 100644 --- a/src/Symfony/Bridge/Doctrine/phpunit.xml.dist +++ b/src/Symfony/Bridge/Doctrine/phpunit.xml.dist @@ -22,6 +22,7 @@ ./Resources ./Tests + ./vendor diff --git a/src/Symfony/Bridge/Monolog/composer.json b/src/Symfony/Bridge/Monolog/composer.json index 912eee37657dd..9f7bd4444430d 100644 --- a/src/Symfony/Bridge/Monolog/composer.json +++ b/src/Symfony/Bridge/Monolog/composer.json @@ -30,7 +30,10 @@ "symfony/event-dispatcher": "Needed when using log messages in console commands." }, "autoload": { - "psr-4": { "Symfony\\Bridge\\Monolog\\": "" } + "psr-4": { "Symfony\\Bridge\\Monolog\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Bridge/Monolog/phpunit.xml.dist b/src/Symfony/Bridge/Monolog/phpunit.xml.dist index 34063ac548676..8a60f06a7a310 100644 --- a/src/Symfony/Bridge/Monolog/phpunit.xml.dist +++ b/src/Symfony/Bridge/Monolog/phpunit.xml.dist @@ -22,6 +22,7 @@ ./Resources ./Tests + ./vendor diff --git a/src/Symfony/Bridge/PhpUnit/README.md b/src/Symfony/Bridge/PhpUnit/README.md index afc9d8dd3bde0..7b3a7ef67762c 100644 --- a/src/Symfony/Bridge/PhpUnit/README.md +++ b/src/Symfony/Bridge/PhpUnit/README.md @@ -12,7 +12,7 @@ It comes with the following features: By default any non-legacy-tagged or any non-@-silenced deprecation notices will make tests fail. -This can be changed by setting the SYMFONY_DEPRECATIONS_HELPER environment +This can be changed by setting the `SYMFONY_DEPRECATIONS_HELPER` environment variable to `weak`. This will make the bridge ignore deprecation notices and is useful to projects that must use deprecated interfaces for backward compatibility reasons. @@ -33,7 +33,7 @@ A summary of deprecation notices is displayed at the end of the test suite: Usage ----- -Add this bridge to the `require-dev` section of your composer.json file +Add this bridge to the `require-dev` section of your `composer.json` file (not in `require`) with e.g. `composer require --dev "symfony/phpunit-bridge"`. When running `phpunit`, you will see a summary of deprecation notices at the end diff --git a/src/Symfony/Bridge/PhpUnit/composer.json b/src/Symfony/Bridge/PhpUnit/composer.json index 8412a277bae98..d4e79845069f0 100644 --- a/src/Symfony/Bridge/PhpUnit/composer.json +++ b/src/Symfony/Bridge/PhpUnit/composer.json @@ -16,14 +16,17 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" }, "suggest": { "symfony/debug": "For tracking deprecated interfaces usages at runtime with DebugClassLoader" }, "autoload": { "files": [ "bootstrap.php" ], - "psr-4": { "Symfony\\Bridge\\PhpUnit\\": "" } + "psr-4": { "Symfony\\Bridge\\PhpUnit\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { 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 904c4dcb4327b..137d24b9e82e3 100644 --- a/src/Symfony/Bridge/ProxyManager/composer.json +++ b/src/Symfony/Bridge/ProxyManager/composer.json @@ -24,7 +24,10 @@ "symfony/config": "~2.3" }, "autoload": { - "psr-4": { "Symfony\\Bridge\\ProxyManager\\": "" } + "psr-4": { "Symfony\\Bridge\\ProxyManager\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Bridge/Swiftmailer/composer.json b/src/Symfony/Bridge/Swiftmailer/composer.json index 3846799fa1a74..81b1d570eadc4 100644 --- a/src/Symfony/Bridge/Swiftmailer/composer.json +++ b/src/Symfony/Bridge/Swiftmailer/composer.json @@ -23,7 +23,10 @@ "symfony/http-kernel": "" }, "autoload": { - "psr-4": { "Symfony\\Bridge\\Swiftmailer\\": "" } + "psr-4": { "Symfony\\Bridge\\Swiftmailer\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Bridge/Twig/Extension/FormExtension.php b/src/Symfony/Bridge/Twig/Extension/FormExtension.php index 924d49d581863..3f0a423337311 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/Tests/Command/LintCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php index 877e4b98eb69f..56c03574b6ee6 100644 --- a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php @@ -16,9 +16,6 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Tester\CommandTester; -/** - * @covers \Symfony\Bridge\Twig\Command\LintCommand - */ class LintCommandTest extends \PHPUnit_Framework_TestCase { private $files; diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json index 0ac73712109a5..7ce35a9fac00b 100644 --- a/src/Symfony/Bridge/Twig/composer.json +++ b/src/Symfony/Bridge/Twig/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=5.3.9", - "twig/twig": "~1.20|~2.0" + "twig/twig": "~1.23|~2.0" }, "require-dev": { "symfony/asset": "~2.7", @@ -51,7 +51,10 @@ "symfony/expression-language": "For using the ExpressionExtension" }, "autoload": { - "psr-4": { "Symfony\\Bridge\\Twig\\": "" } + "psr-4": { "Symfony\\Bridge\\Twig\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Bundle/DebugBundle/composer.json b/src/Symfony/Bundle/DebugBundle/composer.json index b361945d277ac..d4cba7fc2410b 100644 --- a/src/Symfony/Bundle/DebugBundle/composer.json +++ b/src/Symfony/Bundle/DebugBundle/composer.json @@ -31,7 +31,10 @@ "symfony/dependency-injection": "For using as a service from the container" }, "autoload": { - "psr-4": { "Symfony\\Bundle\\DebugBundle\\": "" } + "psr-4": { "Symfony\\Bundle\\DebugBundle\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Bundle/DebugBundle/phpunit.xml.dist b/src/Symfony/Bundle/DebugBundle/phpunit.xml.dist index cbde5628a3987..90ec0a5dba514 100644 --- a/src/Symfony/Bundle/DebugBundle/phpunit.xml.dist +++ b/src/Symfony/Bundle/DebugBundle/phpunit.xml.dist @@ -20,8 +20,8 @@ ./ - ./Tests ./Resources + ./Tests ./vendor diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php index f61af1cc959ce..791593de07fe8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php @@ -157,7 +157,7 @@ protected function describeContainerParameter($parameter, array $options = array { $key = isset($options['parameter']) ? $options['parameter'] : ''; - $this->writeData(array($key => $this->formatParameter($parameter)), $options); + $this->writeData(array($key => $parameter), $options); } /** 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/Tests/Console/Descriptor/AbstractDescriptorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php index 8a9800bc865bd..192ba44bf737c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php @@ -113,6 +113,7 @@ public function getDescribeContainerParameterTestData() $data = $this->getDescriptionTestData(ObjectsProvider::getContainerParameter()); $data[0][] = array('parameter' => 'database_name'); + $data[1][] = array('parameter' => 'twig.form.resources'); return $data; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php index df3f338fbb318..52a6665416923 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php @@ -72,9 +72,16 @@ public static function getContainerParameter() { $builder = new ContainerBuilder(); $builder->setParameter('database_name', 'symfony'); + $builder->setParameter('twig.form.resources', array( + 'bootstrap_3_horizontal_layout.html.twig', + 'bootstrap_3_layout.html.twig', + 'form_div_layout.html.twig', + 'form_table_layout.html.twig', + )); return array( 'parameter' => $builder, + 'array_parameter' => $builder, ); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/array_parameter.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/array_parameter.json new file mode 100644 index 0000000000000..cb6809159ad2d --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/array_parameter.json @@ -0,0 +1,3 @@ +{ + "twig.form.resources": ["bootstrap_3_horizontal_layout.html.twig", "bootstrap_3_layout.html.twig", "form_div_layout.html.twig", "form_table_layout.html.twig"] +} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/array_parameter.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/array_parameter.md new file mode 100644 index 0000000000000..593be0cab77fb --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/array_parameter.md @@ -0,0 +1,4 @@ +twig.form.resources +=================== + +["bootstrap_3_horizontal_layout.html.twig","bootstrap_3_layo... diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/array_parameter.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/array_parameter.txt new file mode 100644 index 0000000000000..182037f2469dd --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/array_parameter.txt @@ -0,0 +1 @@ +["bootstrap_3_horizontal_layout.html.twig","bootstrap_3_layo... diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/array_parameter.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/array_parameter.xml new file mode 100644 index 0000000000000..0e16f57fc948a --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/array_parameter.xml @@ -0,0 +1,2 @@ + +["bootstrap_3_horizontal_layout.html.twig","bootstrap_3_layo... diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index 16f9ca9dba185..29ff39c46fac3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -57,7 +57,10 @@ "doctrine/cache": "For using alternative cache drivers" }, "autoload": { - "psr-4": { "Symfony\\Bundle\\FrameworkBundle\\": "" } + "psr-4": { "Symfony\\Bundle\\FrameworkBundle\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist b/src/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist index 269adda917a1b..1d25eeb3304c5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist +++ b/src/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist @@ -20,9 +20,9 @@ ./ - ./vendor ./Resources ./Tests + ./vendor diff --git a/src/Symfony/Bundle/SecurityBundle/composer.json b/src/Symfony/Bundle/SecurityBundle/composer.json index 053ded7469893..f00e09ca3c908 100644 --- a/src/Symfony/Bundle/SecurityBundle/composer.json +++ b/src/Symfony/Bundle/SecurityBundle/composer.json @@ -37,11 +37,14 @@ "symfony/yaml": "~2.0,>=2.0.5", "symfony/expression-language": "~2.6", "doctrine/doctrine-bundle": "~1.2", - "twig/twig": "~1.20|~2.0", + "twig/twig": "~1.23|~2.0", "ircmaxell/password-compat": "~1.0" }, "autoload": { - "psr-4": { "Symfony\\Bundle\\SecurityBundle\\": "" } + "psr-4": { "Symfony\\Bundle\\SecurityBundle\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Bundle/SecurityBundle/phpunit.xml.dist b/src/Symfony/Bundle/SecurityBundle/phpunit.xml.dist index 0ff2b570e2736..a7fdc326c4571 100644 --- a/src/Symfony/Bundle/SecurityBundle/phpunit.xml.dist +++ b/src/Symfony/Bundle/SecurityBundle/phpunit.xml.dist @@ -20,8 +20,8 @@ ./ - ./Tests ./Resources + ./Tests ./vendor diff --git a/src/Symfony/Bundle/TwigBundle/composer.json b/src/Symfony/Bundle/TwigBundle/composer.json index f75c019e99d99..c05ebe38e8db3 100644 --- a/src/Symfony/Bundle/TwigBundle/composer.json +++ b/src/Symfony/Bundle/TwigBundle/composer.json @@ -34,7 +34,10 @@ "symfony/framework-bundle": "~2.7" }, "autoload": { - "psr-4": { "Symfony\\Bundle\\TwigBundle\\": "" } + "psr-4": { "Symfony\\Bundle\\TwigBundle\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Bundle/TwigBundle/phpunit.xml.dist b/src/Symfony/Bundle/TwigBundle/phpunit.xml.dist index 763b8b68bf826..9a8c38f26ef33 100644 --- a/src/Symfony/Bundle/TwigBundle/phpunit.xml.dist +++ b/src/Symfony/Bundle/TwigBundle/phpunit.xml.dist @@ -20,8 +20,8 @@ ./ - ./Tests ./Resources + ./Tests ./vendor diff --git a/src/Symfony/Bundle/WebProfilerBundle/composer.json b/src/Symfony/Bundle/WebProfilerBundle/composer.json index 9774f8d72e583..a1de9a771b70b 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-4": { "Symfony\\Bundle\\WebProfilerBundle\\": "" } + "psr-4": { "Symfony\\Bundle\\WebProfilerBundle\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Bundle/WebProfilerBundle/phpunit.xml.dist b/src/Symfony/Bundle/WebProfilerBundle/phpunit.xml.dist index f449adf319706..2bcccd6667a26 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/phpunit.xml.dist +++ b/src/Symfony/Bundle/WebProfilerBundle/phpunit.xml.dist @@ -20,8 +20,8 @@ ./ - ./Tests ./Resources + ./Tests ./vendor diff --git a/src/Symfony/Component/Asset/Tests/Context/NullContextTest.php b/src/Symfony/Component/Asset/Tests/Context/NullContextTest.php new file mode 100644 index 0000000000000..13e0e43d92215 --- /dev/null +++ b/src/Symfony/Component/Asset/Tests/Context/NullContextTest.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Asset\Tests\Context; + +use Symfony\Component\Asset\Context\NullContext; + +class NullContextTest extends \PHPUnit_Framework_TestCase +{ + public function testGetBasePath() + { + $nullContext = new NullContext(); + + $this->assertEmpty($nullContext->getBasePath()); + } + + public function testIsSecure() + { + $nullContext = new NullContext(); + + $this->assertFalse($nullContext->isSecure()); + } +} diff --git a/src/Symfony/Component/Asset/Tests/Context/RequestStackContextTest.php b/src/Symfony/Component/Asset/Tests/Context/RequestStackContextTest.php new file mode 100644 index 0000000000000..07f75c9f5b734 --- /dev/null +++ b/src/Symfony/Component/Asset/Tests/Context/RequestStackContextTest.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Asset\Tests\Context; + +use Symfony\Component\Asset\Context\RequestStackContext; + +class RequestStackContextTest extends \PHPUnit_Framework_TestCase +{ + public function testGetBasePathEmpty() + { + $requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack'); + $requestStackContext = new RequestStackContext($requestStack); + + $this->assertEmpty($requestStackContext->getBasePath()); + } + + public function testGetBasePathSet() + { + $testBasePath = 'test-path'; + + $request = $this->getMock('Symfony\Component\HttpFoundation\Request'); + $request->method('getBasePath') + ->willReturn($testBasePath); + $requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack'); + $requestStack->method('getMasterRequest') + ->willReturn($request); + + $requestStackContext = new RequestStackContext($requestStack); + + $this->assertEquals($testBasePath, $requestStackContext->getBasePath()); + } + + public function testIsSecureFalse() + { + $requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack'); + $requestStackContext = new RequestStackContext($requestStack); + + $this->assertFalse($requestStackContext->isSecure()); + } + + public function testIsSecureTrue() + { + $request = $this->getMock('Symfony\Component\HttpFoundation\Request'); + $request->method('isSecure') + ->willReturn(true); + $requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack'); + $requestStack->method('getMasterRequest') + ->willReturn($request); + + $requestStackContext = new RequestStackContext($requestStack); + + $this->assertTrue($requestStackContext->isSecure()); + } +} diff --git a/src/Symfony/Component/Asset/Tests/VersionStrategy/EmptyVersionStrategyTest.php b/src/Symfony/Component/Asset/Tests/VersionStrategy/EmptyVersionStrategyTest.php new file mode 100644 index 0000000000000..fb842dd4f77a7 --- /dev/null +++ b/src/Symfony/Component/Asset/Tests/VersionStrategy/EmptyVersionStrategyTest.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Asset\Tests\VersionStrategy; + +use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy; + +class EmptyVersionStrategyTest extends \PHPUnit_Framework_TestCase +{ + public function testGetVersion() + { + $emptyVersionStrategy = new EmptyVersionStrategy(); + $path = 'test-path'; + + $this->assertEmpty($emptyVersionStrategy->getVersion($path)); + } + + public function testApplyVersion() + { + $emptyVersionStrategy = new EmptyVersionStrategy(); + $path = 'test-path'; + + $this->assertEquals($path, $emptyVersionStrategy->applyVersion($path)); + } +} diff --git a/src/Symfony/Component/Asset/composer.json b/src/Symfony/Component/Asset/composer.json index 0e3f66c9bd843..d15c52a9b802c 100644 --- a/src/Symfony/Component/Asset/composer.json +++ b/src/Symfony/Component/Asset/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" }, "suggest": { "symfony/http-foundation": "" @@ -25,7 +25,10 @@ "symfony/http-foundation": "~2.4" }, "autoload": { - "psr-4": { "Symfony\\Component\\Asset\\": "" } + "psr-4": { "Symfony\\Component\\Asset\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Asset/phpunit.xml.dist b/src/Symfony/Component/Asset/phpunit.xml.dist index 3e53da45d9ea3..b66906d6dab39 100644 --- a/src/Symfony/Component/Asset/phpunit.xml.dist +++ b/src/Symfony/Component/Asset/phpunit.xml.dist @@ -20,8 +20,8 @@ ./ - ./vendor ./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 2313c73943fa0..7c0234e1fed7b 100644 --- a/src/Symfony/Component/BrowserKit/composer.json +++ b/src/Symfony/Component/BrowserKit/composer.json @@ -27,7 +27,10 @@ "symfony/process": "" }, "autoload": { - "psr-4": { "Symfony\\Component\\BrowserKit\\": "" } + "psr-4": { "Symfony\\Component\\BrowserKit\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/ClassLoader/composer.json b/src/Symfony/Component/ClassLoader/composer.json index 828e59817efab..870c5c6da03f6 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-4": { "Symfony\\Component\\ClassLoader\\": "" } + "psr-4": { "Symfony\\Component\\ClassLoader\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "extra": { "branch-alias": { 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 f9d3d14a998c5..2a7308bef86df 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); } /** @@ -147,7 +150,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 0536107f0bc88..28252b13ef37f 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-4": { "Symfony\\Component\\Config\\": "" } + "psr-4": { "Symfony\\Component\\Config\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index e38633700eef9..e011beecac95e 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -1070,7 +1070,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); } @@ -1087,7 +1087,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 b288d446bdbae..156d8dc644cf9 100644 --- a/src/Symfony/Component/Console/Helper/Helper.php +++ b/src/Symfony/Component/Console/Helper/Helper.php @@ -55,7 +55,7 @@ public static 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/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php index 6e9c64fc2e9c3..365c03ae328f9 100644 --- a/src/Symfony/Component/Console/Style/SymfonyStyle.php +++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php @@ -294,7 +294,7 @@ public function createProgressBar($max = 0) { $progressBar = parent::createProgressBar($max); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' !== DIRECTORY_SEPARATOR) { $progressBar->setEmptyBarCharacter('░'); // light shade character \u2591 $progressBar->setProgressCharacter(''); $progressBar->setBarCharacter('▓'); // dark shade character \u2593 diff --git a/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php b/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php index bf58a456ed7c5..d615899ca9899 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'); @@ -111,9 +93,6 @@ public function testGetCommand() $this->assertEquals($cmd, $helperset->getCommand(), '->getCommand() retrieves stored command'); } - /** - * @covers \Symfony\Component\Console\Helper\HelperSet::getIterator - */ public function testIteration() { $helperset = new HelperSet(); diff --git a/src/Symfony/Component/Console/composer.json b/src/Symfony/Component/Console/composer.json index 38903abc0004e..b68129ddfc7e5 100644 --- a/src/Symfony/Component/Console/composer.json +++ b/src/Symfony/Component/Console/composer.json @@ -29,7 +29,10 @@ "psr/log": "For using the console logger" }, "autoload": { - "psr-4": { "Symfony\\Component\\Console\\": "" } + "psr-4": { "Symfony\\Component\\Console\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/CssSelector/composer.json b/src/Symfony/Component/CssSelector/composer.json index 99eb4da2da9d9..8836257df1f1d 100644 --- a/src/Symfony/Component/CssSelector/composer.json +++ b/src/Symfony/Component/CssSelector/composer.json @@ -23,7 +23,10 @@ "php": ">=5.3.9" }, "autoload": { - "psr-4": { "Symfony\\Component\\CssSelector\\": "" } + "psr-4": { "Symfony\\Component\\CssSelector\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Debug/composer.json b/src/Symfony/Component/Debug/composer.json index c1b128a25bc2c..51b0df6644e98 100644 --- a/src/Symfony/Component/Debug/composer.json +++ b/src/Symfony/Component/Debug/composer.json @@ -27,7 +27,10 @@ "symfony/http-kernel": "~2.3.24|~2.5.9|~2.6,>=2.6.2" }, "autoload": { - "psr-4": { "Symfony\\Component\\Debug\\": "" } + "psr-4": { "Symfony\\Component\\Debug\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { 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/ContainerAwareTrait.php b/src/Symfony/Component/DependencyInjection/ContainerAwareTrait.php index 57280aad60da2..ccf064f6f3b57 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerAwareTrait.php +++ b/src/Symfony/Component/DependencyInjection/ContainerAwareTrait.php @@ -24,9 +24,9 @@ trait ContainerAwareTrait 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/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index d692873b55ac6..2de60190b45a5 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -901,7 +901,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; } @@ -1088,7 +1088,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 8155e0b7c6b87..d470ed386ff80 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -30,12 +30,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(); @@ -63,9 +57,6 @@ public function testDefinitions() } } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::register - */ public function testRegister() { $builder = new ContainerBuilder(); @@ -74,9 +65,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(); @@ -87,9 +75,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(); @@ -122,7 +107,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. */ @@ -141,9 +125,6 @@ public function testGetUnsetLoadingServiceWhenCreateServiceThrowsAnException() $builder->get('foo'); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::get - */ public function testGetReturnsNullOnInactiveScope() { $builder = new ContainerBuilder(); @@ -152,9 +133,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(); @@ -162,9 +140,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(); @@ -174,11 +149,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(); @@ -205,9 +175,6 @@ public function testAliases() } } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getAliases - */ public function testGetAliases() { $builder = new ContainerBuilder(); @@ -230,9 +197,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(); @@ -243,9 +207,6 @@ public function testSetAliases() $this->assertTrue(isset($aliases['foobar'])); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::addAliases - */ public function testAddAliases() { $builder = new ContainerBuilder(); @@ -257,10 +218,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(); @@ -271,9 +228,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(); @@ -284,9 +238,6 @@ public function testCreateService() $this->assertInstanceOf('\Bar\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(); @@ -300,9 +251,6 @@ public function testCreateProxyWithRealServiceInstantiator() $this->assertSame('Bar\FooClass', get_class($foo1)); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService - */ public function testCreateServiceClass() { $builder = new ContainerBuilder(); @@ -311,9 +259,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(); @@ -323,9 +268,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 testCreateServiceFactory() { $builder = new ContainerBuilder(); @@ -356,9 +298,6 @@ public function testLegacyCreateServiceFactory() $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 testLegacyCreateServiceFactoryService() { $builder = new ContainerBuilder(); @@ -372,9 +311,6 @@ public function testLegacyCreateServiceFactoryService() $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(); @@ -384,9 +320,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', 'Bar\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', 'Bar\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(); @@ -414,7 +365,6 @@ public function testCreateServiceConfigurator() } /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService * @expectedException \RuntimeException */ public function testCreateSyntheticService() @@ -433,9 +383,6 @@ public function testCreateServiceWithExpression() $this->assertEquals('foobar', $builder->get('foo')->arguments['foo']); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::resolveServices - */ public function testResolveServices() { $builder = new ContainerBuilder(); @@ -445,9 +392,6 @@ public function testResolveServices() $this->assertEquals($builder->get('foo'), $builder->resolveServices(new Expression('service("foo")')), '->resolveServices() resolves expressions'); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::merge - */ public function testMerge() { $container = new ContainerBuilder(new ParameterBag(array('bar' => 'foo'))); @@ -493,7 +437,6 @@ public function testMerge() } /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::merge * @expectedException \LogicException */ public function testMergeLogicException() @@ -504,9 +447,6 @@ public function testMergeLogicException() $container->merge(new ContainerBuilder()); } - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::findTaggedServiceIds - */ public function testfindTaggedServiceIds() { $builder = new ContainerBuilder(); @@ -525,9 +465,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(); @@ -537,9 +474,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(); @@ -563,9 +497,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(); @@ -589,9 +520,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(); @@ -614,10 +542,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(); @@ -634,10 +558,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(); @@ -789,10 +709,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 472bd1ff62bcd..40e7e86a910bf 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(); @@ -75,9 +72,6 @@ public function dataForTestUnderscore() ); } - /** - * @covers Symfony\Component\DependencyInjection\Container::compile - */ public function testCompile() { $sc = new Container(new ParameterBag(array('foo' => 'bar'))); @@ -88,9 +82,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'))); @@ -99,19 +90,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'))); @@ -134,9 +118,6 @@ public function testGetSetParameter() } } - /** - * @covers Symfony\Component\DependencyInjection\Container::getServiceIds - */ public function testGetServiceIds() { $sc = new Container(); @@ -149,9 +130,6 @@ public function testGetServiceIds() $this->assertEquals(array('scoped', 'scoped_foo', 'scoped_synchronized_foo', 'inactive', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'service_container', 'foo'), $sc->getServiceIds(), '->getServiceIds() returns defined service ids by getXXXService() methods, followed by service ids defined by set()'); } - /** - * @covers Symfony\Component\DependencyInjection\Container::set - */ public function testSet() { $sc = new Container(); @@ -159,9 +137,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(); @@ -209,9 +184,6 @@ public function testSetAlsoCallsSynchronizeService() $this->assertTrue($c->synchronized, '->set() calls synchronize*Service() if it is defined for the service'); } - /** - * @covers Symfony\Component\DependencyInjection\Container::get - */ public function testGet() { $sc = new ProjectServiceContainer(); @@ -271,18 +243,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(); @@ -295,9 +261,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 b501f11839017..3439a5912384a 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'); @@ -27,10 +24,6 @@ public function testConstructor() $this->assertEquals(array('foo'), $def->getArguments(), '__construct() takes an optional array of arguments as its second argument'); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::setFactory - * @covers Symfony\Component\DependencyInjection\Definition::getFactory - */ public function testSetGetFactory() { $def = new Definition('stdClass'); @@ -42,10 +35,6 @@ public function testSetGetFactory() $this->assertEquals(array('Foo', 'bar'), $def->getFactory(), '->setFactory() converts string static method call to the array'); } - /** - * @covers Symfony\Component\DependencyInjection\Definition::setClass - * @covers Symfony\Component\DependencyInjection\Definition::getClass - */ public function testSetGetClass() { $def = new Definition('stdClass'); @@ -73,11 +62,6 @@ public function testSetGetDecoratedService() $def->setDecoratedService('foo', 'foo'); } - /** - * @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'); @@ -87,12 +71,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'); @@ -116,10 +94,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'); @@ -127,10 +101,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'); @@ -139,10 +109,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'); @@ -151,10 +117,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'); @@ -164,8 +126,6 @@ public function testSetIsSynthetic() } /** - * @covers Symfony\Component\DependencyInjection\Definition::setSynchronized - * @covers Symfony\Component\DependencyInjection\Definition::isSynchronized * @group legacy */ public function testLegacySetIsSynchronized() @@ -176,10 +136,6 @@ public function testLegacySetIsSynchronized() $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'); @@ -188,10 +144,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'); @@ -200,10 +152,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'); @@ -211,9 +159,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'); @@ -223,9 +168,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'); @@ -242,12 +184,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'); @@ -265,9 +201,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/services21.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services21.yml index da717a8bb2967..a2617c1688025 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services21.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services21.yml @@ -6,7 +6,7 @@ services: calls: - method: setLogger arguments: - - @logger + - '@logger' - method: setClass arguments: - User diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml index f06bf6f0a4e12..45f3c76c7be6e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml @@ -7,7 +7,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 @@ -29,5 +29,5 @@ services: decorates: decorated decoration_inner_name: decorated.pif-pouf new_factory1: { class: FooBarClass, factory: factory} - new_factory2: { class: FooBarClass, factory: [@baz, getClass]} + new_factory2: { class: FooBarClass, factory: ['@baz', getClass]} new_factory3: { class: FooBarClass, factory: [BazClass, getInstance]} 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/LegacyContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/LegacyContainerBuilderTest.php index 40aec20065662..81d2b51a2fa91 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/LegacyContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/LegacyContainerBuilderTest.php @@ -19,9 +19,6 @@ */ class LegacyContainerBuilderTest extends \PHPUnit_Framework_TestCase { - /** - * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService - */ public function testCreateServiceFactoryMethod() { $builder = new ContainerBuilder(); @@ -32,9 +29,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(); 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 8bf524ae4f32f..34eec1601024a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -390,9 +390,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 c94f40bf5bdb1..13fce639a75c9 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -211,9 +211,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 87ea6fd9c66f0..c2b2550607005 100644 --- a/src/Symfony/Component/DependencyInjection/composer.json +++ b/src/Symfony/Component/DependencyInjection/composer.json @@ -32,7 +32,10 @@ "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them" }, "autoload": { - "psr-4": { "Symfony\\Component\\DependencyInjection\\": "" } + "psr-4": { "Symfony\\Component\\DependencyInjection\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php index 4cfd06f5c5f11..ae975ce30f921 100755 --- a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php @@ -25,9 +25,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(); @@ -63,9 +60,6 @@ public function testAddInvalidNode() $crawler->add(1); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::addHtmlContent - */ public function testAddHtmlContent() { $crawler = new Crawler(); @@ -80,7 +74,6 @@ public function testAddHtmlContent() } /** - * @covers Symfony\Component\DomCrawler\Crawler::addHtmlContent * @requires extension mbstring */ public function testAddHtmlContentCharset() @@ -91,9 +84,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'); @@ -103,9 +93,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(); @@ -115,7 +102,6 @@ public function testAddHtmlContentUnsupportedCharset() } /** - * @covers Symfony\Component\DomCrawler\Crawler::addHtmlContent * @requires extension mbstring */ public function testAddHtmlContentCharsetGbk() @@ -127,9 +113,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); @@ -155,9 +138,6 @@ public function testAddHtmlContentWithErrors() libxml_use_internal_errors($internalErrors); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::addXmlContent - */ public function testAddXmlContent() { $crawler = new Crawler(); @@ -166,9 +146,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(); @@ -177,9 +154,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); @@ -203,9 +177,6 @@ public function testAddXmlContentWithErrors() libxml_use_internal_errors($internalErrors); } - /** - * @covers Symfony\Component\DomCrawler\Crawler::addContent - */ public function testAddContent() { $crawler = new Crawler(); @@ -241,9 +212,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(); @@ -252,9 +220,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(); @@ -263,9 +228,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) { @@ -278,9 +240,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(); @@ -430,9 +389,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(); @@ -595,9 +551,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 f8033c52d185f..5ea57b2657041 100644 --- a/src/Symfony/Component/DomCrawler/composer.json +++ b/src/Symfony/Component/DomCrawler/composer.json @@ -25,7 +25,10 @@ "symfony/css-selector": "" }, "autoload": { - "psr-4": { "Symfony\\Component\\DomCrawler\\": "" } + "psr-4": { "Symfony\\Component\\DomCrawler\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/EventDispatcher/composer.json b/src/Symfony/Component/EventDispatcher/composer.json index 8a6a750c6e37a..3a20c35f3892b 100644 --- a/src/Symfony/Component/EventDispatcher/composer.json +++ b/src/Symfony/Component/EventDispatcher/composer.json @@ -30,7 +30,10 @@ "symfony/http-kernel": "" }, "autoload": { - "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" } + "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/ExpressionLanguage/composer.json b/src/Symfony/Component/ExpressionLanguage/composer.json index 2b5f91ab83dad..5bff703b0ebec 100644 --- a/src/Symfony/Component/ExpressionLanguage/composer.json +++ b/src/Symfony/Component/ExpressionLanguage/composer.json @@ -19,7 +19,10 @@ "php": ">=5.3.9" }, "autoload": { - "psr-4": { "Symfony\\Component\\ExpressionLanguage\\": "" } + "psr-4": { "Symfony\\Component\\ExpressionLanguage\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Filesystem/composer.json b/src/Symfony/Component/Filesystem/composer.json index f2210ef4a74a9..20a13bbd92b0d 100644 --- a/src/Symfony/Component/Filesystem/composer.json +++ b/src/Symfony/Component/Filesystem/composer.json @@ -19,7 +19,10 @@ "php": ">=5.3.9" }, "autoload": { - "psr-4": { "Symfony\\Component\\Filesystem\\": "" } + "psr-4": { "Symfony\\Component\\Filesystem\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Filesystem/phpunit.xml.dist b/src/Symfony/Component/Filesystem/phpunit.xml.dist index 7c6ba7aba3fb3..d066ed7969868 100644 --- a/src/Symfony/Component/Filesystem/phpunit.xml.dist +++ b/src/Symfony/Component/Filesystem/phpunit.xml.dist @@ -21,6 +21,7 @@ ./ ./Tests + ./vendor diff --git a/src/Symfony/Component/Finder/composer.json b/src/Symfony/Component/Finder/composer.json index da8ac00604390..ec0f77a24235c 100644 --- a/src/Symfony/Component/Finder/composer.json +++ b/src/Symfony/Component/Finder/composer.json @@ -19,7 +19,10 @@ "php": ">=5.3.9" }, "autoload": { - "psr-4": { "Symfony\\Component\\Finder\\": "" } + "psr-4": { "Symfony\\Component\\Finder\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php index 8aef383fe4705..2c884b983bef6 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php @@ -197,7 +197,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/Core/Type/ChoiceType.php b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php index 5102efb55c9ed..528834d1e3cb8 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php @@ -248,13 +248,8 @@ public function configureOptions(OptionsResolver $resolver) return ''; }; - $emptyValue = function (Options $options) { - return $options['required'] ? null : ''; - }; - - // for BC with the "empty_value" option $placeholder = function (Options $options) { - return $options['empty_value']; + return $options['required'] ? null : ''; }; $choiceListNormalizer = function (Options $options, $choiceList) use ($choiceListFactory) { @@ -287,6 +282,12 @@ public function configureOptions(OptionsResolver $resolver) }; $placeholderNormalizer = function (Options $options, $placeholder) { + if (!is_object($options['empty_value']) || !$options['empty_value'] instanceof \Exception) { + @trigger_error('The form option "empty_value" is deprecated since version 2.6 and will be removed in 3.0. Use "placeholder" instead.', E_USER_DEPRECATED); + + $placeholder = $options['empty_value']; + } + if ($options['multiple']) { // never use an empty value for this case return; @@ -328,7 +329,7 @@ public function configureOptions(OptionsResolver $resolver) 'preferred_choices' => array(), 'group_by' => null, 'empty_data' => $emptyData, - 'empty_value' => $emptyValue, // deprecated + 'empty_value' => new \Exception(), // deprecated 'placeholder' => $placeholder, 'error_bubbling' => false, 'compound' => $compound, @@ -340,7 +341,6 @@ public function configureOptions(OptionsResolver $resolver) )); $resolver->setNormalizer('choice_list', $choiceListNormalizer); - $resolver->setNormalizer('empty_value', $placeholderNormalizer); $resolver->setNormalizer('placeholder', $placeholderNormalizer); $resolver->setNormalizer('choice_translation_domain', $choiceTranslationDomainNormalizer); diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php index 4b79dcb662138..fb3e9a7182fc8 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php @@ -175,15 +175,17 @@ public function configureOptions(OptionsResolver $resolver) return $options['widget'] !== 'single_text'; }; - $emptyValue = $placeholderDefault = function (Options $options) { + $placeholder = $placeholderDefault = function (Options $options) { return $options['required'] ? null : ''; }; - $placeholder = function (Options $options) { - return $options['empty_value']; - }; - $placeholderNormalizer = function (Options $options, $placeholder) use ($placeholderDefault) { + if (!is_object($options['empty_value']) || !$options['empty_value'] instanceof \Exception) { + @trigger_error('The form option "empty_value" is deprecated since version 2.6 and will be removed in 3.0. Use "placeholder" instead.', E_USER_DEPRECATED); + + $placeholder = $options['empty_value']; + } + if (is_array($placeholder)) { $default = $placeholderDefault($options); @@ -213,7 +215,7 @@ public function configureOptions(OptionsResolver $resolver) 'format' => $format, 'model_timezone' => null, 'view_timezone' => null, - 'empty_value' => $emptyValue, // deprecated + 'empty_value' => new \Exception(), // deprecated 'placeholder' => $placeholder, 'html5' => true, // Don't modify \DateTime classes by reference, we treat @@ -228,7 +230,6 @@ public function configureOptions(OptionsResolver $resolver) 'compound' => $compound, )); - $resolver->setNormalizer('empty_value', $placeholderNormalizer); $resolver->setNormalizer('placeholder', $placeholderNormalizer); $resolver->setAllowedValues('input', array( diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php index 49f77c5bd1d66..8002f0b4ee7c1 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php @@ -163,16 +163,17 @@ public function configureOptions(OptionsResolver $resolver) return $options['widget'] !== 'single_text'; }; - $emptyValue = $placeholderDefault = function (Options $options) { + $placeholder = $placeholderDefault = function (Options $options) { return $options['required'] ? null : ''; }; - // for BC with the "empty_value" option - $placeholder = function (Options $options) { - return $options['empty_value']; - }; - $placeholderNormalizer = function (Options $options, $placeholder) use ($placeholderDefault) { + if (!is_object($options['empty_value']) || !$options['empty_value'] instanceof \Exception) { + @trigger_error('The form option "empty_value" is deprecated since version 2.6 and will be removed in 3.0. Use "placeholder" instead.', E_USER_DEPRECATED); + + $placeholder = $options['empty_value']; + } + if (is_array($placeholder)) { $default = $placeholderDefault($options); @@ -199,7 +200,7 @@ public function configureOptions(OptionsResolver $resolver) 'with_seconds' => false, 'model_timezone' => null, 'view_timezone' => null, - 'empty_value' => $emptyValue, // deprecated + 'empty_value' => new \Exception(), // deprecated 'placeholder' => $placeholder, 'html5' => true, // Don't modify \DateTime classes by reference, we treat @@ -214,7 +215,6 @@ public function configureOptions(OptionsResolver $resolver) 'compound' => $compound, )); - $resolver->setNormalizer('empty_value', $placeholderNormalizer); $resolver->setNormalizer('placeholder', $placeholderNormalizer); $resolver->setAllowedValues('input', array( diff --git a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php index eadd7e2912775..7e25a122c6f74 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; + @trigger_error('The '.__NAMESPACE__.'\DefaultCsrfProvider is deprecated since version 2.4 and will be removed in version 3.0. Use the \Symfony\Component\Security\Csrf\TokenStorage\NativeSessionTokenStorage class instead.', E_USER_DEPRECATED); /** @@ -61,7 +63,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/Tests/Extension/DataCollector/DataCollectorExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php index ce4367cbe4f97..abef0b335896d 100644 --- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php @@ -13,9 +13,6 @@ use Symfony\Component\Form\Extension\DataCollector\DataCollectorExtension; -/** - * @covers Symfony\Component\Form\Extension\DataCollector\DataCollectorExtension - */ class DataCollectorExtensionTest extends \PHPUnit_Framework_TestCase { /** diff --git a/src/Symfony/Component/Form/composer.json b/src/Symfony/Component/Form/composer.json index 83d503d8e60c0..5e3eb9ed585f6 100644 --- a/src/Symfony/Component/Form/composer.json +++ b/src/Symfony/Component/Form/composer.json @@ -42,7 +42,10 @@ "symfony/framework-bundle": "For templating with PHP." }, "autoload": { - "psr-4": { "Symfony\\Component\\Form\\": "" } + "psr-4": { "Symfony\\Component\\Form\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Form/phpunit.xml.dist b/src/Symfony/Component/Form/phpunit.xml.dist index fd668a9e8b779..1c4acf476238d 100644 --- a/src/Symfony/Component/Form/phpunit.xml.dist +++ b/src/Symfony/Component/Form/phpunit.xml.dist @@ -20,6 +20,7 @@ ./ + ./Resources ./Tests ./vendor diff --git a/src/Symfony/Component/HttpFoundation/ParameterBag.php b/src/Symfony/Component/HttpFoundation/ParameterBag.php index ecc0de1070011..2cfebfba23a36 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 cb706d517e05c..690535157135a 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -455,7 +455,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 16fedbf83afbc..b0e21edd0a214 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'); @@ -251,9 +212,6 @@ public function testCount() $this->assertEquals(count($parameters), count($bag)); } - /** - * @covers Symfony\Component\HttpFoundation\ParameterBag::getBoolean - */ public function testGetBoolean() { $parameters = array('string_true' => 'true', 'string_false' => 'false'); diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 15f262e98f976..f13f4791d93c2 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'); @@ -610,14 +586,11 @@ public function getRelativeUriForPathData() ); } - /** - * @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()); @@ -630,9 +603,6 @@ public function testGetUserInfo() $this->assertEquals('0:0', $request->getUserInfo()); } - /** - * @covers Symfony\Component\HttpFoundation\Request::getSchemeAndHttpHost - */ public function testGetSchemeAndHttpHost() { $request = new Request(); @@ -657,8 +627,6 @@ public function testGetSchemeAndHttpHost() } /** - * @covers Symfony\Component\HttpFoundation\Request::getQueryString - * @covers Symfony\Component\HttpFoundation\Request::normalizeQueryString * @dataProvider getQueryStringNormalizationData */ public function testGetQueryString($query, $expectedQuery, $msg) @@ -794,10 +762,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 96d9d55680d63..8e487d6127ec8 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 0f4ddfb7f08d0..97674d48fdf55 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -695,7 +695,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 44ad61b5e722b..1dbbabd5a1a8a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php @@ -133,7 +133,6 @@ public function testPeekAll() } /** - * @covers Symfony\Component\HttpFoundation\Session\Flash\FlashBag::getIterator * @group legacy */ public function testLegacyGetIterator() 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 32f88cac6d4b6..556f26a33c403 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( @@ -241,13 +242,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 09f96799e73d0..a9c8b406180ce 100644 --- a/src/Symfony/Component/HttpFoundation/composer.json +++ b/src/Symfony/Component/HttpFoundation/composer.json @@ -23,7 +23,10 @@ }, "autoload": { "psr-4": { "Symfony\\Component\\HttpFoundation\\": "" }, - "classmap": [ "Resources/stubs" ] + "classmap": [ "Resources/stubs" ], + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php index 044d14e0c5775..f9f3bdf01e4c2 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 a02dcd966ec6a..c29f9ac93d8fd 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.7.6'; - const VERSION_ID = 20706; + const VERSION = '2.7.7'; + const VERSION_ID = 20707; const MAJOR_VERSION = 2; const MINOR_VERSION = 7; - const RELEASE_VERSION = 6; + const RELEASE_VERSION = 7; const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '05/2018'; diff --git a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php index 581ab6434b789..29da4abf32ccf 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)); } } @@ -128,6 +128,8 @@ public function read($token) /** * {@inheritdoc} + * + * @throws \RuntimeException */ public function write(Profile $profile) { @@ -137,8 +139,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 b2903b84a10ae..f8955f1248e53 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 { private $requestStack; diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php index 53caf60c96680..1fcd2107519bd 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 { @@ -33,9 +32,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 623d732939528..d1ae16be54be8 100644 --- a/src/Symfony/Component/HttpKernel/composer.json +++ b/src/Symfony/Component/HttpKernel/composer.json @@ -52,7 +52,10 @@ "symfony/var-dumper": "" }, "autoload": { - "psr-4": { "Symfony\\Component\\HttpKernel\\": "" } + "psr-4": { "Symfony\\Component\\HttpKernel\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/HttpKernel/phpunit.xml.dist b/src/Symfony/Component/HttpKernel/phpunit.xml.dist index 13149663e488a..17c48935c7158 100644 --- a/src/Symfony/Component/HttpKernel/phpunit.xml.dist +++ b/src/Symfony/Component/HttpKernel/phpunit.xml.dist @@ -25,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 b80608d084591..74b8f88c4bac0 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() @@ -867,7 +865,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 72c79939bacd5..2310fbb396c00 100644 --- a/src/Symfony/Component/Intl/composer.json +++ b/src/Symfony/Component/Intl/composer.json @@ -35,7 +35,10 @@ "autoload": { "psr-4": { "Symfony\\Component\\Intl\\": "" }, "classmap": [ "Resources/stubs" ], - "files": [ "Resources/stubs/functions.php" ] + "files": [ "Resources/stubs/functions.php" ], + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Intl/phpunit.xml.dist b/src/Symfony/Component/Intl/phpunit.xml.dist index e42226a1b1240..9e7ce2f0b2642 100644 --- a/src/Symfony/Component/Intl/phpunit.xml.dist +++ b/src/Symfony/Component/Intl/phpunit.xml.dist @@ -26,6 +26,7 @@ ./ + ./Resources ./Tests ./vendor diff --git a/src/Symfony/Component/Locale/composer.json b/src/Symfony/Component/Locale/composer.json index 215356df0a7fc..5f58de2259e90 100644 --- a/src/Symfony/Component/Locale/composer.json +++ b/src/Symfony/Component/Locale/composer.json @@ -20,7 +20,10 @@ "symfony/intl": "~2.7" }, "autoload": { - "psr-4": { "Symfony\\Component\\Locale\\": "" } + "psr-4": { "Symfony\\Component\\Locale\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolver2Dot6Test.php b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolver2Dot6Test.php index 367ee3fecdf70..9158c5ba069ce 100644 --- a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolver2Dot6Test.php +++ b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolver2Dot6Test.php @@ -499,27 +499,28 @@ public function testFailIfSetAllowedTypesFromLazyOption() } /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @expectedExceptionMessage The option "foo" with value 42 is expected to be of type "string", but is of type "integer". + * @dataProvider provideInvalidTypes */ - public function testResolveFailsIfInvalidType() + public function testResolveFailsIfInvalidType($actualType, $allowedType, $exceptionMessage) { - $this->resolver->setDefined('foo'); - $this->resolver->setAllowedTypes('foo', 'string'); - - $this->resolver->resolve(array('foo' => 42)); + $this->resolver->setDefined('option'); + $this->resolver->setAllowedTypes('option', $allowedType); + $this->setExpectedException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException', $exceptionMessage); + $this->resolver->resolve(array('option' => $actualType)); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @expectedExceptionMessage The option "foo" with value null is expected to be of type "string", but is of type "NULL". - */ - public function testResolveFailsIfInvalidTypeIsNull() + public function provideInvalidTypes() { - $this->resolver->setDefault('foo', null); - $this->resolver->setAllowedTypes('foo', 'string'); - - $this->resolver->resolve(); + return array( + array(true, 'string', 'The option "option" with value true is expected to be of type "string", but is of type "boolean".'), + array(false, 'string', 'The option "option" with value false is expected to be of type "string", but is of type "boolean".'), + array(fopen(__FILE__, 'r'), 'string', 'The option "option" with value resource is expected to be of type "string", but is of type "resource".'), + array(array(), 'string', 'The option "option" with value array is expected to be of type "string", but is of type "array".'), + array(new OptionsResolver(), 'string', 'The option "option" with value Symfony\Component\OptionsResolver\OptionsResolver is expected to be of type "string", but is of type "Symfony\Component\OptionsResolver\OptionsResolver".'), + array(42, 'string', 'The option "option" with value 42 is expected to be of type "string", but is of type "integer".'), + array(null, 'string', 'The option "option" with value null is expected to be of type "string", but is of type "NULL".'), + array('bar', '\stdClass', 'The option "option" with value "bar" is expected to be of type "\stdClass", but is of type "string".'), + ); } public function testResolveSucceedsIfValidType() @@ -550,17 +551,6 @@ public function testResolveSucceedsIfValidTypeMultiple() $this->assertNotEmpty($this->resolver->resolve()); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - */ - public function testResolveFailsIfNotInstanceOfClass() - { - $this->resolver->setDefault('foo', 'bar'); - $this->resolver->setAllowedTypes('foo', '\stdClass'); - - $this->resolver->resolve(); - } - public function testResolveSucceedsIfInstanceOfClass() { $this->resolver->setDefault('foo', new \stdClass()); diff --git a/src/Symfony/Component/OptionsResolver/composer.json b/src/Symfony/Component/OptionsResolver/composer.json index 67a32ffa39240..bbabc6fb73982 100644 --- a/src/Symfony/Component/OptionsResolver/composer.json +++ b/src/Symfony/Component/OptionsResolver/composer.json @@ -19,7 +19,10 @@ "php": ">=5.3.9" }, "autoload": { - "psr-4": { "Symfony\\Component\\OptionsResolver\\": "" } + "psr-4": { "Symfony\\Component\\OptionsResolver\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/OptionsResolver/phpunit.xml.dist b/src/Symfony/Component/OptionsResolver/phpunit.xml.dist index 5a2316a1c9df5..abf84614bcf76 100644 --- a/src/Symfony/Component/OptionsResolver/phpunit.xml.dist +++ b/src/Symfony/Component/OptionsResolver/phpunit.xml.dist @@ -22,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 699151f384921..78a0195f7aa07 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -280,8 +280,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 b2f60f9ffd984..fca3729be8e20 100644 --- a/src/Symfony/Component/Process/Tests/AbstractProcessTest.php +++ b/src/Symfony/Component/Process/Tests/AbstractProcessTest.php @@ -28,7 +28,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() @@ -81,7 +81,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); @@ -470,7 +470,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()); @@ -730,7 +730,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); @@ -756,18 +756,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.9" }, "autoload": { - "psr-4": { "Symfony\\Component\\Process\\": "" } + "psr-4": { "Symfony\\Component\\Process\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Process/phpunit.xml.dist b/src/Symfony/Component/Process/phpunit.xml.dist index b5d605c2efbbe..788500084abf8 100644 --- a/src/Symfony/Component/Process/phpunit.xml.dist +++ b/src/Symfony/Component/Process/phpunit.xml.dist @@ -21,6 +21,7 @@ ./ ./Tests + ./vendor diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index 81d0eed0f7ce3..008f55001f20e 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -20,12 +20,24 @@ * Default implementation of {@link PropertyAccessorInterface}. * * @author Bernhard Schussek + * @author Kévin Dunglas */ class PropertyAccessor implements PropertyAccessorInterface { const VALUE = 0; const IS_REF = 1; const IS_REF_CHAINED = 2; + 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; /** * @var bool @@ -37,6 +49,16 @@ class PropertyAccessor implements PropertyAccessorInterface */ private $ignoreInvalidIndices; + /** + * @var array + */ + private $readPropertyCache = array(); + + /** + * @var array + */ + private $writePropertyCache = array(); + /** * Should not be used by application code. Use * {@link PropertyAccess::createPropertyAccessor()} instead. @@ -78,7 +100,7 @@ public function setValue(&$objectOrArray, $propertyPath, $value) self::IS_REF => true, self::IS_REF_CHAINED => true, )); - + $propertyMaxIndex = count($propertyValues) - 1; for ($i = $propertyMaxIndex; $i >= 0; --$i) { @@ -330,51 +352,31 @@ private function &readProperty(&$object, $property) throw new NoSuchPropertyException(sprintf('Cannot read property "%s" from an array. Maybe you intended to write the property path as "[%s]" instead.', $property, $property)); } - $camelized = $this->camelize($property); - $reflClass = new \ReflectionClass($object); - $getter = 'get'.$camelized; - $getsetter = lcfirst($camelized); // jQuery style, e.g. read: last(), write: last($item) - $isser = 'is'.$camelized; - $hasser = 'has'.$camelized; - $classHasProperty = $reflClass->hasProperty($property); + $access = $this->getReadAccessInfo($object, $property); - if ($reflClass->hasMethod($getter) && $reflClass->getMethod($getter)->isPublic()) { - $result[self::VALUE] = $object->$getter(); - } elseif ($this->isMethodAccessible($reflClass, $getsetter, 0)) { - $result[self::VALUE] = $object->$getsetter(); - } 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 ($classHasProperty && $reflClass->getProperty($property)->isPublic()) { - $result[self::VALUE] = &$object->$property; - $result[self::IS_REF] = true; - } elseif ($reflClass->hasMethod('__get') && $reflClass->getMethod('__get')->isPublic()) { - $result[self::VALUE] = $object->$property; - } elseif (!$classHasProperty && property_exists($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, $getsetter, $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 @@ -385,6 +387,81 @@ 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; + $getsetter = lcfirst($camelProp); // jQuery style, e.g. read: last(), write: last($item) + $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($getsetter) && $reflClass->getMethod($getsetter)->isPublic()) { + $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD; + $access[self::ACCESS_NAME] = $getsetter; + } 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, $getsetter, $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 an index in a given array-accessible value. * @@ -419,55 +496,26 @@ private function writeProperty(&$object, $property, $value) 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); - $camelized = $this->camelize($property); - $singulars = (array) StringUtil::singularify($camelized); - - if (is_array($value) || $value instanceof \Traversable) { - $methods = $this->findAdderAndRemover($reflClass, $singulars); - - // Use addXxx() and removeXxx() to write the collection - if (null !== $methods) { - $this->writeCollection($object, $property, $value, $methods[0], $methods[1]); + $access = $this->getWriteAccessInfo($object, $property, $value); - return; - } - } - - $setter = 'set'.$camelized; - $getsetter = lcfirst($camelized); // jQuery style, e.g. read: last(), write: last($item) - $classHasProperty = $reflClass->hasProperty($property); - - if ($this->isMethodAccessible($reflClass, $setter, 1)) { - $object->$setter($value); - } elseif ($this->isMethodAccessible($reflClass, $getsetter, 1)) { - $object->$getsetter($value); - } elseif ($classHasProperty && $reflClass->getProperty($property)->isPublic()) { - $object->$property = $value; - } elseif ($this->isMethodAccessible($reflClass, '__set', 2)) { - $object->$property = $value; - } elseif (!$classHasProperty && property_exists($object, $property)) { + 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]) { + $this->writeCollection($object, $property, $value, $access[self::ACCESS_ADDER], $access[self::ACCESS_REMOVER]); + } 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 && $this->isMethodAccessible($reflClass, '__call', 2)) { - // 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()", "%s()", '. - '"__set()" or "__call()" exist and have public access in class "%s".', - $property, - implode('', array_map(function ($singular) { - return '"add'.$singular.'()"/"remove'.$singular.'()", '; - }, $singulars)), - $setter, - $getsetter, - $reflClass->name - )); + throw new NoSuchPropertyException($access[self::ACCESS_NAME]); } } @@ -519,6 +567,90 @@ private function writeCollection($object, $property, $collection, $addMethod, $r } } + /** + * Guesses how to write the property value. + * + * @param string $object + * @param string $property + * @param mixed $value + * + * @return array + */ + private function getWriteAccessInfo($object, $property, $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); + $camelized = $this->camelize($property); + $singulars = (array) StringUtil::singularify($camelized); + + 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); + $getsetter = lcfirst($camelized); // jQuery style, e.g. read: last(), write: last($item) + + $classHasProperty = $reflClass->hasProperty($property); + + if ($this->isMethodAccessible($reflClass, $setter, 1)) { + $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD; + $access[self::ACCESS_NAME] = $setter; + } elseif ($this->isMethodAccessible($reflClass, $getsetter, 1)) { + $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD; + $access[self::ACCESS_NAME] = $getsetter; + } elseif ($this->isMethodAccessible($reflClass, '__set', 2)) { + $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 && $this->isMethodAccessible($reflClass, '__call', 2)) { + // 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()", "%s()", '. + '"__set()" or "__call()" exist and have public access in class "%s".', + $property, + implode('', array_map(function ($singular) { + return '"add'.$singular.'()"/"remove'.$singular.'()", '; + }, $singulars)), + $setter, + $getsetter, + $reflClass->name + ); + } + } + + $this->writePropertyCache[$key] = $access; + } + + return $access; + } + /** * Returns whether a property is writable in the given object. * diff --git a/src/Symfony/Component/PropertyAccess/composer.json b/src/Symfony/Component/PropertyAccess/composer.json index fe1b78efb180c..c02990a198a15 100644 --- a/src/Symfony/Component/PropertyAccess/composer.json +++ b/src/Symfony/Component/PropertyAccess/composer.json @@ -19,7 +19,10 @@ "php": ">=5.3.9" }, "autoload": { - "psr-4": { "Symfony\\Component\\PropertyAccess\\": "" } + "psr-4": { "Symfony\\Component\\PropertyAccess\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/PropertyAccess/phpunit.xml.dist b/src/Symfony/Component/PropertyAccess/phpunit.xml.dist index fcf5f6ae56dd3..b0b20c1bd9460 100644 --- a/src/Symfony/Component/PropertyAccess/phpunit.xml.dist +++ b/src/Symfony/Component/PropertyAccess/phpunit.xml.dist @@ -22,6 +22,7 @@ ./Resources ./Tests + ./vendor diff --git a/src/Symfony/Component/Routing/composer.json b/src/Symfony/Component/Routing/composer.json index 02837f630506f..5b0f24416f486 100644 --- a/src/Symfony/Component/Routing/composer.json +++ b/src/Symfony/Component/Routing/composer.json @@ -37,7 +37,10 @@ "doctrine/annotations": "For using the annotation loader" }, "autoload": { - "psr-4": { "Symfony\\Component\\Routing\\": "" } + "psr-4": { "Symfony\\Component\\Routing\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Routing/phpunit.xml.dist b/src/Symfony/Component/Routing/phpunit.xml.dist index a9083088a9644..b69f066ac1b2f 100644 --- a/src/Symfony/Component/Routing/phpunit.xml.dist +++ b/src/Symfony/Component/Routing/phpunit.xml.dist @@ -20,8 +20,8 @@ ./ - ./vendor ./Tests + ./vendor diff --git a/src/Symfony/Component/Security/Acl/composer.json b/src/Symfony/Component/Security/Acl/composer.json index 7cd89a81bf830..b29274297c177 100644 --- a/src/Symfony/Component/Security/Acl/composer.json +++ b/src/Symfony/Component/Security/Acl/composer.json @@ -30,7 +30,10 @@ "doctrine/dbal": "For using the built-in ACL implementation" }, "autoload": { - "psr-4": { "Symfony\\Component\\Security\\Acl\\": "" } + "psr-4": { "Symfony\\Component\\Security\\Acl\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Security/Acl/phpunit.xml.dist b/src/Symfony/Component/Security/Acl/phpunit.xml.dist index 755233957585a..b1ea04797a370 100644 --- a/src/Symfony/Component/Security/Acl/phpunit.xml.dist +++ b/src/Symfony/Component/Security/Acl/phpunit.xml.dist @@ -25,8 +25,9 @@ ./ - ./vendor + ./Resources ./Tests + ./vendor diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php index 6f2b6edf40106..1a786d7c4543e 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php +++ b/src/Symfony/Component/Security/Core/Tests/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/Core/Tests/User/UserTest.php b/src/Symfony/Component/Security/Core/Tests/User/UserTest.php index f514edad690ff..b589b4af45136 100644 --- a/src/Symfony/Component/Security/Core/Tests/User/UserTest.php +++ b/src/Symfony/Component/Security/Core/Tests/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'); @@ -124,9 +93,6 @@ public function testEraseCredentials() $this->assertEquals('superpass', $user->getPassword()); } - /** - * @covers Symfony\Component\Security\Core\User\User::__toString - */ public function testToString() { $user = new User('fabien', 'superpass'); diff --git a/src/Symfony/Component/Security/Core/composer.json b/src/Symfony/Component/Security/Core/composer.json index c73a5b516cf33..bae25188bbedd 100644 --- a/src/Symfony/Component/Security/Core/composer.json +++ b/src/Symfony/Component/Security/Core/composer.json @@ -22,8 +22,7 @@ "symfony/event-dispatcher": "~2.1", "symfony/expression-language": "~2.6", "symfony/http-foundation": "~2.4", - "symfony/translation": "~2.0,>=2.0.5", - "symfony/validator": "~2.5,>=2.5.5", + "symfony/validator": "~2.5,>=2.5.9", "psr/log": "~1.0", "ircmaxell/password-compat": "1.0.*" }, @@ -35,7 +34,10 @@ "ircmaxell/password-compat": "For using the BCrypt password encoder in PHP <5.5" }, "autoload": { - "psr-4": { "Symfony\\Component\\Security\\Core\\": "" } + "psr-4": { "Symfony\\Component\\Security\\Core\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Security/Core/phpunit.xml.dist b/src/Symfony/Component/Security/Core/phpunit.xml.dist index 8a1a2914b095b..2dc341abcba02 100644 --- a/src/Symfony/Component/Security/Core/phpunit.xml.dist +++ b/src/Symfony/Component/Security/Core/phpunit.xml.dist @@ -25,8 +25,9 @@ ./ - ./vendor + ./Resources ./Tests + ./vendor diff --git a/src/Symfony/Component/Security/Csrf/composer.json b/src/Symfony/Component/Security/Csrf/composer.json index 12077d47eab11..2930e325f3bb7 100644 --- a/src/Symfony/Component/Security/Csrf/composer.json +++ b/src/Symfony/Component/Security/Csrf/composer.json @@ -26,7 +26,10 @@ "symfony/http-foundation": "For using the class SessionTokenStorage." }, "autoload": { - "psr-4": { "Symfony\\Component\\Security\\Csrf\\": "" } + "psr-4": { "Symfony\\Component\\Security\\Csrf\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Security/Csrf/phpunit.xml.dist b/src/Symfony/Component/Security/Csrf/phpunit.xml.dist index 8f950a3d3d441..f5b1e65c7192a 100644 --- a/src/Symfony/Component/Security/Csrf/phpunit.xml.dist +++ b/src/Symfony/Component/Security/Csrf/phpunit.xml.dist @@ -25,8 +25,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 15b71efd4d8bb..f2048fdbe41a9 100644 --- a/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Security\Http\Firewall; 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('Unexpected response from the DigestAuth received; is the header returning a clear text passwords?', array('expected' => $serverDigestMd5, 'received' => $digestAuth->getResponse())); } diff --git a/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php b/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php index ccadf94732d68..4186430708910 100644 --- a/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php @@ -21,6 +21,7 @@ use Symfony\Component\Security\Http\SecurityEvents; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface; +use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy; /** * RememberMeListener implements authentication capabilities via a cookie. @@ -56,7 +57,7 @@ public function __construct(TokenStorageInterface $tokenStorage, RememberMeServi $this->logger = $logger; $this->dispatcher = $dispatcher; $this->catchExceptions = $catchExceptions; - $this->sessionStrategy = $sessionStrategy; + $this->sessionStrategy = null === $sessionStrategy ? new SessionAuthenticationStrategy(SessionAuthenticationStrategy::MIGRATE) : $sessionStrategy; } /** @@ -77,7 +78,7 @@ public function handle(GetResponseEvent $event) try { $token = $this->authenticationManager->authenticate($token); - if (null !== $this->sessionStrategy && $request->hasSession() && $request->getSession()->isStarted()) { + if ($request->hasSession() && $request->getSession()->isStarted()) { $this->sessionStrategy->onAuthentication($request, $token); } $this->tokenStorage->setToken($token); diff --git a/src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php b/src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php index 4fb7e09c147ff..5f131cf8a5f21 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/Tests/Firewall/RememberMeListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php index b16d55b66b02e..7309042d4764b 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php @@ -246,6 +246,69 @@ public function testSessionStrategy() $listener->handle($event); } + public function testSessionIsMigratedByDefault() + { + list($listener, $tokenStorage, $service, $manager, , $dispatcher, $sessionStrategy) = $this->getListener(false, true, false); + + $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); + } + public function testOnCoreSecurityInteractiveLoginEventIsDispatchedIfDispatcherIsPresent() { list($listener, $tokenStorage, $service, $manager, , $dispatcher) = $this->getListener(true); diff --git a/src/Symfony/Component/Security/Http/composer.json b/src/Symfony/Component/Security/Http/composer.json index 1d40882a5e676..1b36428ff6120 100644 --- a/src/Symfony/Component/Security/Http/composer.json +++ b/src/Symfony/Component/Security/Http/composer.json @@ -32,7 +32,10 @@ "symfony/routing": "For using the HttpUtils class to create sub-requests, redirect the user, and match URLs" }, "autoload": { - "psr-4": { "Symfony\\Component\\Security\\Http\\": "" } + "psr-4": { "Symfony\\Component\\Security\\Http\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Security/Http/phpunit.xml.dist b/src/Symfony/Component/Security/Http/phpunit.xml.dist index 49b36f271804e..8d636e93f1be6 100644 --- a/src/Symfony/Component/Security/Http/phpunit.xml.dist +++ b/src/Symfony/Component/Security/Http/phpunit.xml.dist @@ -25,8 +25,8 @@ ./ - ./vendor ./Tests + ./vendor diff --git a/src/Symfony/Component/Security/composer.json b/src/Symfony/Component/Security/composer.json index f2c4e13bd986a..39fdb6fc64950 100644 --- a/src/Symfony/Component/Security/composer.json +++ b/src/Symfony/Component/Security/composer.json @@ -31,8 +31,7 @@ "symfony/finder": "~2.3", "symfony/intl": "~2.3", "symfony/routing": "~2.2", - "symfony/translation": "~2.0,>=2.0.5", - "symfony/validator": "~2.5,>=2.5.5", + "symfony/validator": "~2.5,>=2.5.9", "doctrine/common": "~2.2", "doctrine/dbal": "~2.2", "psr/log": "~1.0", @@ -51,7 +50,10 @@ "paragonie/random_compat": "" }, "autoload": { - "psr-4": { "Symfony\\Component\\Security\\": "" } + "psr-4": { "Symfony\\Component\\Security\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Security/phpunit.xml.dist b/src/Symfony/Component/Security/phpunit.xml.dist index 3e7ec385260e9..6b56bf247124c 100644 --- a/src/Symfony/Component/Security/phpunit.xml.dist +++ b/src/Symfony/Component/Security/phpunit.xml.dist @@ -13,9 +13,7 @@ ./Tests/ - ./Acl/Tests/ - ./Core/Tests/ - ./Http/Tests/ + ./*/Tests/ @@ -23,11 +21,12 @@ ./ - ./vendor + ./Resources ./Tests - ./Acl/Tests - ./Core/Tests - ./Http/Tests + ./vendor + ./*/Resources + ./*/Tests + ./*/vendor diff --git a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php index 44a71cf1b487f..183417c254f46 100644 --- a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php @@ -114,7 +114,7 @@ public function denormalize($data, $class, $format = null, array $context = arra if ($allowed && !$ignored) { $setter = 'set'.ucfirst($attribute); - if (in_array($setter, $classMethods)) { + if (in_array($setter, $classMethods) && !$reflectionClass->getMethod($setter)->isStatic()) { $object->$setter($value); } } @@ -170,10 +170,13 @@ private function isGetMethod(\ReflectionMethod $method) { $methodLength = strlen($method->name); - return ( - ((0 === strpos($method->name, 'get') && 3 < $methodLength) || - (0 === strpos($method->name, 'is') && 2 < $methodLength)) && - 0 === $method->getNumberOfRequiredParameters() - ); + return + !$method->isStatic() && + ( + ((0 === strpos($method->name, 'get') && 3 < $methodLength) || + (0 === strpos($method->name, 'is') && 2 < $methodLength)) && + 0 === $method->getNumberOfRequiredParameters() + ) + ; } } diff --git a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php index ba84ac717f075..fe1676fbf36fb 100644 --- a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php @@ -68,6 +68,7 @@ public function normalize($object, $format = null, array $context = array()) $reflClass = new \ReflectionClass($object); foreach ($reflClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflMethod) { if ( + !$reflMethod->isStatic() && !$reflMethod->isConstructor() && !$reflMethod->isDestructor() && 0 === $reflMethod->getNumberOfRequiredParameters() @@ -86,7 +87,9 @@ public function normalize($object, $format = null, array $context = array()) // properties foreach ($reflClass->getProperties(\ReflectionProperty::IS_PUBLIC) as $reflProperty) { - $attributes[$reflProperty->getName()] = true; + if (!$reflProperty->isStatic()) { + $attributes[$reflProperty->getName()] = true; + } } $attributes = array_keys($attributes); diff --git a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php index c8e83d1f790f5..abbc74f27c5bc 100644 --- a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php @@ -50,7 +50,7 @@ public function normalize($object, $format = null, array $context = array()) $allowedAttributes = $this->getAllowedAttributes($object, $context, true); foreach ($reflectionObject->getProperties() as $property) { - if (in_array($property->name, $this->ignoredAttributes)) { + if (in_array($property->name, $this->ignoredAttributes) || $property->isStatic()) { continue; } @@ -110,6 +110,10 @@ public function denormalize($data, $class, $format = null, array $context = arra if ($allowed && !$ignored && $reflectionClass->hasProperty($propertyName)) { $property = $reflectionClass->getProperty($propertyName); + if ($property->isStatic()) { + continue; + } + // Override visibility if (!$property->isPublic()) { $property->setAccessible(true); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php index 3baf58703f48c..1d487c2fdd5c1 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php @@ -549,11 +549,24 @@ public function testDenormalizeNonExistingAttribute() ); } + public function testDenormalizeShouldNotSetStaticAttribute() + { + $obj = $this->normalizer->denormalize(array('staticObject' => true), __NAMESPACE__.'\GetSetDummy'); + + $this->assertEquals(new GetSetDummy(), $obj); + $this->assertNull(GetSetDummy::getStaticObject()); + } + public function testNoTraversableSupport() { $this->assertFalse($this->normalizer->supportsNormalization(new \ArrayObject())); } + public function testNoStaticGetSetSupport() + { + $this->assertFalse($this->normalizer->supportsNormalization(new ObjectWithJustStaticSetterDummy())); + } + public function testPrivateSetter() { $obj = $this->normalizer->denormalize(array('foo' => 'foobar'), __NAMESPACE__.'\ObjectWithPrivateSetterDummy'); @@ -568,6 +581,7 @@ class GetSetDummy private $baz; protected $camelCase; protected $object; + private static $staticObject; public function getFoo() { @@ -628,6 +642,16 @@ public function getObject() { return $this->object; } + + public static function getStaticObject() + { + return self::$staticObject; + } + + public static function setStaticObject($object) + { + self::$staticObject = $object; + } } class GetConstructorDummy @@ -799,3 +823,18 @@ private function setFoo($foo) { } } + +class ObjectWithJustStaticSetterDummy +{ + private static $foo = 'bar'; + + public static function getFoo() + { + return self::$foo; + } + + public static function setFoo($foo) + { + self::$foo = $foo; + } +} diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php index 1cadee52b196f..80a021d08fa25 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php @@ -456,6 +456,11 @@ public function testNoTraversableSupport() { $this->assertFalse($this->normalizer->supportsNormalization(new \ArrayObject())); } + + public function testNormalizeStatic() + { + $this->assertEquals(array('foo' => 'K'), $this->normalizer->normalize(new ObjectWithStaticPropertiesAndMethods())); + } } class ObjectDummy @@ -605,3 +610,14 @@ public function otherMethod() throw new \RuntimeException('Dummy::otherMethod() should not be called'); } } + +class ObjectWithStaticPropertiesAndMethods +{ + public $foo = 'K'; + public static $bar = 'A'; + + public static function getBaz() + { + return 'L'; + } +} diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php index 62e6d5d925ca3..fd303818006ff 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php @@ -409,6 +409,14 @@ public function testDenormalizeNonExistingAttribute() ); } + public function testDenormalizeShouldIgnoreStaticProperty() + { + $obj = $this->normalizer->denormalize(array('outOfScope' => true), __NAMESPACE__.'\PropertyDummy'); + + $this->assertEquals(new PropertyDummy(), $obj); + $this->assertEquals('out_of_scope', PropertyDummy::$outOfScope); + } + /** * @expectedException \Symfony\Component\Serializer\Exception\LogicException * @expectedExceptionMessage Cannot normalize attribute "bar" because injected serializer is not a normalizer @@ -429,10 +437,16 @@ public function testNoTraversableSupport() { $this->assertFalse($this->normalizer->supportsNormalization(new \ArrayObject())); } + + public function testNoStaticPropertySupport() + { + $this->assertFalse($this->normalizer->supportsNormalization(new StaticPropertyDummy())); + } } class PropertyDummy { + public static $outOfScope = 'out_of_scope'; public $foo; private $bar; protected $camelCase; @@ -491,3 +505,9 @@ public function __construct($kevinDunglas = null) $this->kevinDunglas = $kevinDunglas; } } + +class StaticPropertyDummy +{ + private static $property = 'value'; +} + diff --git a/src/Symfony/Component/Serializer/composer.json b/src/Symfony/Component/Serializer/composer.json index 0db008bfad756..d6b63120c1cad 100644 --- a/src/Symfony/Component/Serializer/composer.json +++ b/src/Symfony/Component/Serializer/composer.json @@ -33,7 +33,10 @@ "symfony/property-access": "For using the ObjectNormalizer." }, "autoload": { - "psr-4": { "Symfony\\Component\\Serializer\\": "" } + "psr-4": { "Symfony\\Component\\Serializer\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Serializer/phpunit.xml.dist b/src/Symfony/Component/Serializer/phpunit.xml.dist index 279e1eb3aa53c..4799e3cf2f1dd 100644 --- a/src/Symfony/Component/Serializer/phpunit.xml.dist +++ b/src/Symfony/Component/Serializer/phpunit.xml.dist @@ -20,8 +20,8 @@ ./ - ./vendor ./Tests + ./vendor diff --git a/src/Symfony/Component/Stopwatch/composer.json b/src/Symfony/Component/Stopwatch/composer.json index a0c165295ef33..a132756a195ec 100644 --- a/src/Symfony/Component/Stopwatch/composer.json +++ b/src/Symfony/Component/Stopwatch/composer.json @@ -19,7 +19,10 @@ "php": ">=5.3.9" }, "autoload": { - "psr-4": { "Symfony\\Component\\Stopwatch\\": "" } + "psr-4": { "Symfony\\Component\\Stopwatch\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Templating/composer.json b/src/Symfony/Component/Templating/composer.json index f183b4eda0b92..74f4412623328 100644 --- a/src/Symfony/Component/Templating/composer.json +++ b/src/Symfony/Component/Templating/composer.json @@ -25,7 +25,10 @@ "psr/log": "For using debug logging in loaders" }, "autoload": { - "psr-4": { "Symfony\\Component\\Templating\\": "" } + "psr-4": { "Symfony\\Component\\Templating\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { 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 f250423908035..09748211b13b3 100644 --- a/src/Symfony/Component/Translation/PluralizationRules.php +++ b/src/Symfony/Component/Translation/PluralizationRules.php @@ -131,6 +131,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 af5ea3c7bf691..eab501ae5fffe 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 ac833a4224f64..877904708b740 100644 --- a/src/Symfony/Component/Translation/composer.json +++ b/src/Symfony/Component/Translation/composer.json @@ -33,7 +33,10 @@ "psr/log": "To use logging capability in translator" }, "autoload": { - "psr-4": { "Symfony\\Component\\Translation\\": "" } + "psr-4": { "Symfony\\Component\\Translation\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { 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 1fd76a8fa79b9..3f114fa335fa2 100644 --- a/src/Symfony/Component/Validator/Constraints/UrlValidator.php +++ b/src/Symfony/Component/Validator/Constraints/UrlValidator.php @@ -34,7 +34,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 0cb7aba637372..ab22876a1feb1 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php @@ -118,7 +118,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 c0a898aea5532..463a686e7f1d3 100644 --- a/src/Symfony/Component/Validator/composer.json +++ b/src/Symfony/Component/Validator/composer.json @@ -43,7 +43,10 @@ "symfony/expression-language": "For using the 2.4 Expression validator" }, "autoload": { - "psr-4": { "Symfony\\Component\\Validator\\": "" } + "psr-4": { "Symfony\\Component\\Validator\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { 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/VarDumper/Caster/ReflectionCaster.php b/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php index 04cf7b05526ca..cacd2113d7694 100644 --- a/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php @@ -157,6 +157,9 @@ public static function castParameter(\ReflectionParameter $c, array $a, Stub $st { $prefix = Caster::PREFIX_VIRTUAL; + // Added by HHVM + unset($a['info']); + self::addMap($a, $c, array( 'position' => 'getPosition', 'isVariadic' => 'isVariadic', @@ -164,7 +167,11 @@ public static function castParameter(\ReflectionParameter $c, array $a, Stub $st )); try { - if ($c->isArray()) { + if (method_exists($c, 'hasType')) { + if ($c->hasType()) { + $a[$prefix.'typeHint'] = $c->getType()->__toString(); + } + } elseif ($c->isArray()) { $a[$prefix.'typeHint'] = 'array'; } elseif (method_exists($c, 'isCallable') && $c->isCallable()) { $a[$prefix.'typeHint'] = 'callable'; @@ -172,6 +179,9 @@ public static function castParameter(\ReflectionParameter $c, array $a, Stub $st $a[$prefix.'typeHint'] = $v->name; } } catch (\ReflectionException $e) { + if (preg_match('/^Class ([^ ]++) does not exist$/', $e->getMessage(), $m)) { + $a[$prefix.'typeHint'] = $m[1]; + } } try { @@ -180,6 +190,9 @@ public static function castParameter(\ReflectionParameter $c, array $a, Stub $st $a[$prefix.'default'] = new ConstStub($c->getDefaultValueConstantName(), $v); } } catch (\ReflectionException $e) { + if (isset($a[$prefix.'typeHint']) && $c->allowsNull()) { + $a[$prefix.'default'] = null; + } } return $a; diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php index edb6b1f4aadcd..5c306a671085c 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php @@ -61,20 +61,58 @@ public function testReflectionCaster() ); } + public function testReflectionParameter() + { + $var = new \ReflectionParameter(__NAMESPACE__.'\reflectionParameterFixture', 0); + + $this->assertDumpMatchesFormat( + <<<'EOTXT' +ReflectionParameter { + +name: "arg1" + position: 0 + typeHint: "Symfony\Component\VarDumper\Tests\Caster\NotExistingClass" + default: null +} +EOTXT + , $var + ); + } + + /** + * @requires PHP 7.0 + */ + public function testReflectionParameterScalar() + { + $f = eval('return function (int $a) {};'); + $var = new \ReflectionParameter($f, 0); + + $this->assertDumpMatchesFormat( + <<<'EOTXT' +ReflectionParameter { + +name: "a" + position: 0 + typeHint: "int" +} +EOTXT + , $var + ); + } + /** * @requires PHP 7.0 */ public function testReturnType() { $f = eval('return function ():int {};'); + $line = __LINE__ - 1; $this->assertDumpMatchesFormat( - <<<'EOTXT' + <<=')) { - require 'VarDumpTestTraitRequire54.php'; +if (PHP_VERSION_ID >= 50400) { + require __DIR__.'/VarDumperTestTraitRequire54.php'; } diff --git a/src/Symfony/Component/VarDumper/composer.json b/src/Symfony/Component/VarDumper/composer.json index 5b611b8eab8d9..422e13c087189 100644 --- a/src/Symfony/Component/VarDumper/composer.json +++ b/src/Symfony/Component/VarDumper/composer.json @@ -23,7 +23,10 @@ }, "autoload": { "files": [ "Resources/functions/dump.php" ], - "psr-4": { "Symfony\\Component\\VarDumper\\": "" } + "psr-4": { "Symfony\\Component\\VarDumper\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/VarDumper/phpunit.xml.dist b/src/Symfony/Component/VarDumper/phpunit.xml.dist index 05128b9fa1a34..bb16a3a4ec02c 100644 --- a/src/Symfony/Component/VarDumper/phpunit.xml.dist +++ b/src/Symfony/Component/VarDumper/phpunit.xml.dist @@ -20,8 +20,8 @@ ./ - ./Tests ./Resources + ./Tests ./vendor diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index 0ccc6ee979660..19078220bbafd 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -572,8 +572,6 @@ public function testScalarInSequence() * * @see http://yaml.org/spec/1.2/spec.html#id2759572 * @see http://yaml.org/spec/1.1/#id932806 - * - * @covers \Symfony\Component\Yaml\Parser::parse */ public function testMappingDuplicateKeyBlock() { @@ -593,9 +591,6 @@ public function testMappingDuplicateKeyBlock() $this->assertSame($expected, Yaml::parse($input)); } - /** - * @covers \Symfony\Component\Yaml\Inline::parseMapping - */ public function testMappingDuplicateKeyFlow() { $input = <<=5.3.9" }, "autoload": { - "psr-4": { "Symfony\\Component\\Yaml\\": "" } + "psr-4": { "Symfony\\Component\\Yaml\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "minimum-stability": "dev", "extra": { diff --git a/src/Symfony/Component/Yaml/phpunit.xml.dist b/src/Symfony/Component/Yaml/phpunit.xml.dist index 418b2c6c9ad5a..6bdbea16e6426 100644 --- a/src/Symfony/Component/Yaml/phpunit.xml.dist +++ b/src/Symfony/Component/Yaml/phpunit.xml.dist @@ -20,8 +20,8 @@ ./ - ./vendor ./Tests + ./vendor