Merge branch '3.0' into 3.1

* 3.0:
  [travis] Fix deps=low/high builds
  fixed CS
  skip test with current phpunit bridge
  Fix for #19183 to add support for new PHP MongoDB extension in sessions.
  [Console] Fix for block() padding formatting after #19189
  [Security][Guard] check if session exist before using it
  bumped Symfony version to 3.0.9
  updated VERSION for 3.0.8
  updated CHANGELOG for 3.0.8
  bumped Symfony version to 2.8.9
  updated VERSION for 2.8.8
  updated CHANGELOG for 2.8.8
  bumped Symfony version to 2.7.16
  updated VERSION for 2.7.15
  update CONTRIBUTORS for 2.7.15
  updated CHANGELOG for 2.7.15
  Fix some lowest deps
  Fixed typos in the expectedException annotations

Conflicts:
	src/Symfony/Component/HttpKernel/Kernel.php
	src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php
This commit is contained in:
Nicolas Grekas 2016-07-01 18:00:00 +02:00
commit 3726aa15dd
18 changed files with 523 additions and 158 deletions

4
.github/travis.php vendored
View File

@ -46,8 +46,8 @@ foreach ($dirs as $dir) {
$versions = @file_get_contents('https://packagist.org/packages/'.$package->name.'.json') ?: '{"package":{"versions":[]}}';
$versions = json_decode($versions);
foreach ($versions->package->versions as $version => $package) {
$packages[$package->name] += array($version => $package);
foreach ($versions->package->versions as $v => $package) {
$packages[$package->name] += array($v => $package);
}
}

View File

@ -7,6 +7,39 @@ in 3.0 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/v3.0.0...v3.0.1
* 3.0.8 (2016-06-30)
* bug #19217 [HttpKernel] Inline ValidateRequestListener logic into HttpKernel (nicolas-grekas)
* bug #18688 [HttpFoundation] Warning when request has both Forwarded and X-Forwarded-For (magnusnordlander)
* bug #19173 [Console] Decouple SymfonyStyle from TableCell (ro0NL)
* bug #19189 [Console] Fix formatting of SymfonyStyle::comment() (chalasr)
* bug #19211 [Form] fix post max size translation type extension for >= 2.8 (Tobion)
* bug #17822 [WIP] [Form] fix `empty_data` option in expanded `ChoiceType` (HeahDude)
* bug #19134 Distinguish between first and subsequent progress bar displays (rquadling)
* bug #19061 [FORM] fix post_max_size_message translation (alt. 2) (David Badura)
* bug #19100 [Console] Fixed SymfonyQuestionHelper multi-choice with defaults (sstok)
* bug #18924 [DoctrineBridge] Don't use object IDs in DoctrineChoiceLoader when passing a value closure (webmozart)
* bug #19138 [DomCrawler] No more exception on field name with strange format (guiled, fabpot)
* bug #18935 [Form] Consider a violation even if the form is not submitted (egeloen)
* bug #19127 [Form] Add exception to FormRenderer about non-unique block names (enumag)
* bug #19118 [Process] Fix pipes cleaning on Windows (nicolas-grekas)
* bug #19128 Avoid phpunit 5.4 warnings on getMock (2.7+) (iltar)
* bug #19114 [HttpKernel] Dont close the reponse stream in debug (nicolas-grekas)
* bug #19101 [Session] fix PDO transaction aborted under PostgreSQL (Tobion)
* bug #18501 [HttpFoundation] changed MERGE queries (hjkl)
* bug #19062 [HttpFoundation] Fix UPSERT for PgSql >= 9.5 (nicolas-grekas)
* bug #18548 [Form] minor fixes in DateTime transformers (HeahDude)
* bug #18732 [PropertyAccess][DX] Enhance exception that say that some methods are missing if they don't (nykopol)
* bug #19048 [HttpFoundation] Use UPSERT for sessions stored in PgSql >= 9.5 (nicolas-grekas)
* bug #19038 Fix feature detection for IE (Alsciende)
* bug #18915 [DependencyInjection] force enabling the external XML entity loaders (xabbuh)
* bug #19020 [Form] Fixed collapsed choice attributes (HeahDude)
* bug #19028 [Yaml] properly count skipped comment lines (xabbuh)
* bug #19009 [WebProfilerBundle] Fix invalid CSS style (romainneutron)
* bug #17733 [Yaml] Fix wrong line number when comments are inserted in the middle of a block. (paradajozsef)
* bug #18911 Fixed singular of committee (peterrehm)
* bug #18971 Do not inject web debug toolbar on attachments (peterrehm)
* 3.0.7 (2016-06-06)
* bug #18908 [DependencyInjection] force enabling the external XML entity loaders (xabbuh)

View File

@ -8,8 +8,8 @@ Symfony is the result of the work of many people who made the code better
- Nicolas Grekas (nicolas-grekas)
- Bernhard Schussek (bschussek)
- Tobias Schultze (tobion)
- Christophe Coevoet (stof)
- Christian Flothmann (xabbuh)
- Christophe Coevoet (stof)
- Jordi Boggiano (seldaek)
- Victor Berchet (victor)
- Johannes S (johannes)
@ -17,12 +17,12 @@ Symfony is the result of the work of many people who made the code better
- Jakub Zalas (jakubzalas)
- Ryan Weaver (weaverryan)
- Javier Eguiluz (javier.eguiluz)
- Hugo Hamon (hhamon)
- Kévin Dunglas (dunglas)
- Hugo Hamon (hhamon)
- Abdellatif Ait boudad (aitboudad)
- Pascal Borreli (pborreli)
- Joseph Bielawski (stloyd)
- Wouter De Jong (wouterj)
- Joseph Bielawski (stloyd)
- Romain Neutron (romain)
- Karma Dordrak (drak)
- Lukas Kahwe Smith (lsmith)
@ -34,16 +34,16 @@ Symfony is the result of the work of many people who made the code better
- Grégoire Pineau (lyrixx)
- Eriksen Costa (eriksencosta)
- Sarah Khalil (saro0h)
- Jules Pietri (heah)
- Jonathan Wage (jwage)
- Diego Saint Esteben (dosten)
- Maxime Steinhausser (ogizanagi)
- Diego Saint Esteben (dosten)
- Alexandre Salomé (alexandresalome)
- William Durand (couac)
- Jules Pietri (heah)
- ornicar
- Francis Besset (francisbesset)
- stealth35 (stealth35)
- Alexander Mols (asm89)
- Francis Besset (francisbesset)
- Bulat Shakirzyanov (avalanche123)
- Saša Stamenković (umpirsky)
- Henrik Bjørnskov (henrikbjorn)
@ -52,21 +52,21 @@ Symfony is the result of the work of many people who made the code better
- Konstantin Kudryashov (everzet)
- Bilal Amarni (bamarni)
- Florin Patan (florinpatan)
- Kevin Bond (kbond)
- Peter Rehm (rpet)
- Kevin Bond (kbond)
- Gábor Egyed (1ed)
- Ener-Getick (energetick)
- Michel Weimerskirch (mweimerskirch)
- Eric Clemmons (ericclemmons)
- Iltar van der Berg (kjarli)
- Andrej Hudec (pulzarraider)
- Christian Raue
- Charles Sarrazin (csarrazi)
- Matthias Pigulla (mpdude)
- Deni
- Henrik Westphal (snc)
- Dariusz Górecki (canni)
- Arnout Boks (aboks)
- Iltar van der Berg (kjarli)
- Charles Sarrazin (csarrazi)
- Ener-Getick (energetick)
- Douglas Greenshields (shieldo)
- Lee McDermott
- Brandon Turner
@ -82,49 +82,50 @@ Symfony is the result of the work of many people who made the code better
- Antoine Hérault (herzult)
- Arnaud Le Blanc (arnaud-lb)
- Jérôme Tamarelle (gromnan)
- Paráda József (paradajozsef)
- Michal Piotrowski (eventhorizon)
- Tim Nagel (merk)
- Paráda József (paradajozsef)
- Brice BERNARD (brikou)
- Robin Chalas (chalas_r)
- Alexander M. Turek (derrabus)
- Dariusz Ruminski
- marc.weistroff
- Issei Murasawa (issei_m)
- lenar
- Włodzimierz Gajda (gajdaw)
- Konstantin Myakshin (koc)
- Baptiste Clavié (talus)
- Alexander Schwenn (xelaris)
- Florian Voutzinos (florianv)
- Konstantin Myakshin (koc)
- Colin Frei
- Adrien Brault (adrienbrault)
- Joshua Thijssen
- Baptiste Clavié (talus)
- Peter Kokot (maastermedia)
- excelwebzone
- Jacob Dreesen (jdreesen)
- Jáchym Toušek (enumag)
- Jérémy DERUSSÉ (jderusse)
- Vladimir Reznichenko (kalessil)
- Tomáš Votruba (tomas_votruba)
- Fabien Pennequin (fabienpennequin)
- Gordon Franke (gimler)
- Eric GELOEN (gelo)
- David Buchmann (dbu)
- Tomáš Votruba (tomas_votruba)
- Jáchym Toušek
- Robert Schönthal (digitalkaoz)
- Florian Lonqueu-Brochard (florianlb)
- Eric GELOEN (gelo)
- Stefano Sala (stefano.sala)
- Juti Noppornpitak (shiroyuki)
- Titouan Galopin (tgalopin)
- Tigran Azatyan (tigranazatyan)
- Sebastian Hörl (blogsh)
- Daniel Gomes (danielcsgomes)
- Hidenori Goto (hidenorigoto)
- Sebastiaan Stok (sstok)
- Evgeniy (ewgraf)
- Tugdual Saunier (tucksaun)
- Guilherme Blanco (guilhermeblanco)
- Pablo Godel (pgodel)
- Titouan Galopin (tgalopin)
- Jérémie Augustin (jaugustin)
- Sebastiaan Stok (sstok)
- Tugdual Saunier (tucksaun)
- Andréia Bohner (andreia)
- Rafael Dohms (rdohms)
- Arnaud Kleinpeter (nanocom)
@ -141,6 +142,7 @@ Symfony is the result of the work of many people who made the code better
- Richard van Laak (rvanlaak)
- Matthieu Ouellette-Vachon (maoueh)
- Michał Pipa (michal.pipa)
- Javier Spagnoletti (phansys)
- Amal Raghav (kertz)
- Jonathan Ingram (jonathaningram)
- Artur Kotyrba
@ -150,7 +152,6 @@ Symfony is the result of the work of many people who made the code better
- Daniel Wehner
- Possum
- Dorian Villet (gnutix)
- Javier Spagnoletti (phansys)
- Richard Miller (mr_r_miller)
- Mario A. Alvarez Garcia (nomack84)
- Dennis Benkert (denderello)
@ -179,6 +180,7 @@ Symfony is the result of the work of many people who made the code better
- Sven Paulus (subsven)
- Lars Strojny (lstrojny)
- Rui Marinho (ruimarinho)
- Daniel Espendiller
- Eugene Wissner
- Julien Brochet (mewt)
- Sergey Linnik (linniksa)
@ -212,9 +214,7 @@ Symfony is the result of the work of many people who made the code better
- Kristen Gilden (kgilden)
- Dawid Nowak
- Pierre-Yves LEBECQ (pylebecq)
- Daniel Espendiller
- Jakub Kucharovic (jkucharovic)
- Robin Chalas (chalas_r)
- Eugene Leonovich (rybakit)
- Filippo Tessarotto
- Joseph Rouff (rouffj)
@ -238,6 +238,7 @@ Symfony is the result of the work of many people who made the code better
- Roumen Damianoff (roumen)
- Antonio J. García Lagar (ajgarlag)
- Kim Hemsø Rasmussen (kimhemsoe)
- Christian Schmidt
- Wouter Van Hecke
- Peter Kruithof (pkruithof)
- Michael Holm (hollo)
@ -245,6 +246,7 @@ Symfony is the result of the work of many people who made the code better
- Hidde Wieringa (hiddewie)
- Chris Smith (cs278)
- Florian Klein (docteurklein)
- Oleg Voronkovich
- Manuel Kiessling (manuelkiessling)
- Daniel Wehner
- Atsuhiro KUBO (iteman)
@ -294,7 +296,6 @@ 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)
- Christian Schmidt
- François-Xavier de Guillebon (de-gui_f)
- Damien Alexandre (damienalexandre)
- Felix Labrecque
@ -322,6 +323,7 @@ Symfony is the result of the work of many people who made the code better
- Endre Fejes
- Tobias Naumann (tna)
- Daniel Beyer
- Jhonny Lidfors (jhonne)
- Shein Alexey
- Baptiste Lafontaine
- Joe Lencioni
@ -335,7 +337,6 @@ Symfony is the result of the work of many people who made the code better
- Ivan Kurnosov
- Xavier HAUSHERR
- Albert Jessurum (ajessu)
- Oleg Voronkovich
- Laszlo Korte
- Pavel Batanov (scaytrase)
- Miha Vrhovnik
@ -355,6 +356,7 @@ Symfony is the result of the work of many people who made the code better
- Brian King
- Michel Salib (michelsalib)
- geoffrey
- Steffen Roßkamp
- Valentin Jonovs (valentins-jonovs)
- Jeanmonod David (jeanmonod)
- Jan Schumann
@ -364,6 +366,7 @@ Symfony is the result of the work of many people who made the code better
- Mihai Stancu
- Olivier Dolbeau (odolbeau)
- Jan Rosier (rosier)
- Magnus Nordlander (magnusnordlander)
- vagrant
- EdgarPE
- Florian Pfitzer (marmelatze)
@ -379,6 +382,7 @@ Symfony is the result of the work of many people who made the code better
- Christian Schmidt
- Marek Štípek (maryo)
- Marcin Sikoń (marphi)
- Roland Franssen (ro0)
- Dominik Zogg (dominik.zogg)
- Marek Pietrzak
- Chad Sikorra (chadsikorra)
@ -390,6 +394,7 @@ Symfony is the result of the work of many people who made the code better
- Zander Baldwin
- Adam Harvey
- Alex Bakhturin
- Alexander Obuhovich (aik099)
- boombatower
- Fabrice Bernhard (fabriceb)
- Jérôme Macias (jeromemacias)
@ -412,10 +417,12 @@ Symfony is the result of the work of many people who made the code better
- ondrowan
- Barry vd. Heuvel (barryvdh)
- Jerzy Zawadzki (jzawadzki)
- Théo FIDRY (theofidry)
- Evan S Kaufman (evanskaufman)
- mcben
- Jérôme Vieilledent (lolautruche)
- Maks Slesarenko
- Filip Procházka (fprochazka)
- mmoreram
- Markus Lanthaler (lanthaler)
- Vicent Soria Durá (vicentgodella)
@ -440,7 +447,6 @@ Symfony is the result of the work of many people who made the code better
- Benjamin Leveque (benji07)
- Nate (frickenate)
- jhonnyL
- Jhonny Lidfors (jhonne)
- sasezaki
- Dawid Pakuła (zulusx)
- Florian Rey (nervo)
@ -503,6 +509,7 @@ Symfony is the result of the work of many people who made the code better
- Maxime Douailin
- Javier López (loalf)
- Reinier Kip
- Geoffrey Brier (geoffrey-brier)
- Dustin Dobervich (dustin10)
- dantleech
- Anne-Sophie Bachelard (annesophie)
@ -535,9 +542,11 @@ Symfony is the result of the work of many people who made the code better
- Arturs Vonda
- Sascha Grossenbacher
- Szijarto Tamas
- David Badura (davidbadura)
- Catalin Dan
- Stephan Vock
- Benjamin Zikarsky (bzikarsky)
- Anton Bakai
- Simon Schick (simonsimcity)
- redstar504
- Tristan Roussel
@ -556,7 +565,7 @@ Symfony is the result of the work of many people who made the code better
- Richard van den Brand (ricbra)
- develop
- Mark Sonnabaum
- Alexander Obuhovich (aik099)
- Richard Quadling
- jochenvdv
- Arturas Smorgun (asarturas)
- Alexander Volochnev (exelenz)
@ -573,6 +582,7 @@ Symfony is the result of the work of many people who made the code better
- Baldur Rensch (brensch)
- Vladyslav Petrovych
- Alex Xandra Albert Sim
- Carson Full
- Trent Steel (trsteel88)
- Yuen-Chi Lian
- Besnik Br
@ -589,6 +599,7 @@ Symfony is the result of the work of many people who made the code better
- Leevi Graham (leevigraham)
- Casper Valdemar Poulsen
- Josiah (josiah)
- Joschi Kuphal
- John Bohn (jbohn)
- Marc Morera (mmoreram)
- Andrew Hilobok (hilobok)
@ -618,7 +629,6 @@ Symfony is the result of the work of many people who made the code better
- Adrien Lucas (adrienlucas)
- James Michael DuPont
- Tom Klingenberg
- Filip Procházka (fprochazka)
- Christopher Hall (mythmakr)
- Paul Kamer (pkamer)
- Rafał Wrzeszcz (rafalwrzeszcz)
@ -637,7 +647,6 @@ Symfony is the result of the work of many people who made the code better
- Neil Ferreira
- Nathanael Noblet (gnat)
- Dmitry Parnas (parnas)
- Théo FIDRY (theofidry)
- Paul LE CORRE
- DQNEO
- Emanuele Iannone
@ -652,7 +661,6 @@ Symfony is the result of the work of many people who made the code better
- Matt Robinson (inanimatt)
- Aleksey Podskrebyshev
- Calin Mihai Pristavu
- Steffen Roßkamp
- David Marín Carreño (davefx)
- Jörn Lang (j.lang)
- Omar Yepez (oyepez003)
@ -677,6 +685,7 @@ Symfony is the result of the work of many people who made the code better
- Don Pinkster
- Maksim Muruev
- Emil Einarsson
- Thomas Landauer
- Thibault Duplessis
- Marc Abramowitz
- Martijn Evers
@ -697,7 +706,6 @@ Symfony is the result of the work of many people who made the code better
- David Lima
- Jérôme Vasseur
- Brunet Laurent (lbrunet)
- Magnus Nordlander (magnusnordlander)
- Mikhail Yurasov (mym)
- LOUARDI Abdeltif (ouardisoft)
- Robert Gruendler (pulse00)
@ -709,6 +717,7 @@ Symfony is the result of the work of many people who made the code better
- Raul Fraile (raulfraile)
- sensio
- Patrick Kaufmann
- Piotr Stankowski
- Reece Fowell (reecefowell)
- Mátyás Somfai (smatyas)
- stefan.r
@ -728,6 +737,7 @@ Symfony is the result of the work of many people who made the code better
- Pieter
- Michael Tibben
- Sander Marechal
- Andre Rømcke (andrerom)
- Radosław Benkel
- ttomor
- Mei Gwilym (meigwilym)
@ -743,6 +753,7 @@ Symfony is the result of the work of many people who made the code better
- Danilo Silva
- Zachary Tong (polyfractal)
- Hryhorii Hrebiniuk
- Dennis Fridrich (dfridrich)
- mcfedr (mcfedr)
- hamza
- dantleech
@ -752,6 +763,7 @@ Symfony is the result of the work of many people who made the code better
- Guillaume Royer
- Artem (digi)
- boite
- MGDSoft
- Vadim Tyukov (vatson)
- Sortex
- chispita
@ -804,10 +816,12 @@ Symfony is the result of the work of many people who made the code better
- Benoit Garret
- Thomas Royer (cydonia7)
- DerManoMann
- Olaf Klischat
- Jhonny Lidfors (jhonny)
- Julien Bianchi (jubianchi)
- Robert Meijers
- Marcin Chwedziak
- Roland Franssen (ro0)
- hjkl
- Tony Cosentino (tony-co)
- Rodrigo Díez Villamuera (rodrigodiez)
- e-ivanov
@ -815,6 +829,7 @@ Symfony is the result of the work of many people who made the code better
- Jeremy Bush
- wizhippo
- Viacheslav Sychov
- Carlos Ortega Huetos
- rpg600
- Péter Buri (burci)
- Davide Borsatto (davide.borsatto)
@ -834,6 +849,7 @@ Symfony is the result of the work of many people who made the code better
- spdionis
- Eduardo García Sanz (coma)
- James Gilliland
- Rhodri Pugh (rodnaph)
- David de Boer (ddeboer)
- Gilles Doge (gido)
- abulford
@ -855,7 +871,6 @@ Symfony is the result of the work of many people who made the code better
- Juan Traverso
- Philipp Strube
- Christian Sciberras
- Anton Bakai
- Clement Herreman (clemherreman)
- Dan Ionut Dumitriu (danionut90)
- Nyro (nyro)
@ -893,7 +908,6 @@ Symfony is the result of the work of many people who made the code better
- azine
- Dawid Sajdak
- Ludek Stepan
- Geoffrey Brier
- Aaron Stephens (astephens)
- Craig Menning (cmenning)
- Balázs Benyó (duplabe)
@ -917,6 +931,7 @@ Symfony is the result of the work of many people who made the code better
- Cédric Lahouste (rapotor)
- Samuel Vogel (samuelvogel)
- Berat Doğan
- Juanmi Rodriguez Cerón
- Anthony Ferrara
- Klaas Cuvelier (kcuvelier)
- Steve Frécinaux
@ -934,6 +949,7 @@ Symfony is the result of the work of many people who made the code better
- Philip Frank
- Lance McNearney
- Giorgio Premi
- Ian Carroll
- caponica
- Matt Daum (daum)
- Alberto Pirovano (geezmo)
@ -945,6 +961,7 @@ Symfony is the result of the work of many people who made the code better
- Max Summe
- WedgeSama
- Felds Liscia
- Ahmed TAILOULOUTE (ahmedtai)
- James Halsall (jaitsu)
- Maxime Veber (nek-)
- Sullivan SENECHAL
@ -968,6 +985,7 @@ Symfony is the result of the work of many people who made the code better
- Max Romanovsky (maxromanovsky)
- Mathieu Morlon
- Daniel Tschinder
- Nykopol (nykopol)
- Rafał Muszyński (rafmus90)
- Timothy Anido (xanido)
- Rick Prent
@ -1006,6 +1024,7 @@ Symfony is the result of the work of many people who made the code better
- Konrad Mohrfeldt
- Lance Chen
- Andrey Astakhov (aast)
- Nikolay Labinskiy (e-moe)
- kor3k kor3k (kor3k)
- Stelian Mocanita (stelian)
- Flavian (2much)
@ -1015,6 +1034,7 @@ Symfony is the result of the work of many people who made the code better
- Hoffmann András
- Olivier
- pscheit
- Zdeněk Drahoš
- Dan Harper
- moldcraft
- Ramon Kleiss (akathos)
@ -1137,6 +1157,7 @@ Symfony is the result of the work of many people who made the code better
- Daan van Renterghem
- Nicole Cordes
- Bram Van der Sype (brammm)
- Guile (guile)
- Julien Moulin (lizjulien)
- Nikita Nefedov (nikita2206)
- Mauro Foti (skler)
@ -1209,7 +1230,6 @@ Symfony is the result of the work of many people who made the code better
- Haritz
- Matthieu Prat
- Grummfy
- Thomas Landauer
- Filipe Guerra
- Gerben Wijnja
- Rowan Manning
@ -1260,6 +1280,7 @@ Symfony is the result of the work of many people who made the code better
- Muriel (metalmumu)
- Michael Pohlers (mick_the_big)
- Cayetano Soriano Gallego (neoshadybeat)
- Jean Pasdeloup (pasdeloup)
- Patrick McDougle (patrick-mcdougle)
- Pablo Monterde Perez (plebs)
- Jimmy Leger (redpanda)
@ -1298,7 +1319,6 @@ Symfony is the result of the work of many people who made the code better
- Mantas Urnieža
- Cas
- Dusan Kasan
- Carson Full
- Myke79
- Brian Debuire
- Piers Warmers
@ -1332,6 +1352,7 @@ Symfony is the result of the work of many people who made the code better
- Andras Ratz
- andreabreu98
- Michael Schneider
- Cédric Bertolini
- n-aleha
- Şəhriyar İmanov
- Kaipi Yann
@ -1358,6 +1379,7 @@ Symfony is the result of the work of many people who made the code better
- Jon Cave
- Sébastien HOUZE
- Abdulkadir N. A.
- Ivan Menshykov
- Yevgen Kovalienia
- Lebnik
- Sema
@ -1385,8 +1407,8 @@ Symfony is the result of the work of many people who made the code better
- Oncle Tom
- Christian Stocker
- Dawid Nowak
- Richard Quadling
- Karolis Daužickas
- Sergio Santoro
- tirnanog06
- phc
- Дмитрий Пацура
@ -1412,7 +1434,6 @@ Symfony is the result of the work of many people who made the code better
- Loïc Vernet (coil)
- Christoph Schaefer (cvschaefer)
- Damon Jones (damon__jones)
- David Badura (davidbadura)
- Daniel Londero (dlondero)
- Sebastian Landwehr (dword123)
- Adel ELHAIBA (eadel)
@ -1420,6 +1441,7 @@ Symfony is the result of the work of many people who made the code better
- Elliot Anderson (elliot)
- Sergey Zolotov (enleur)
- Fabien D. (fabd)
- Carsten Eilers (fnc)
- Sorin Gitlan (forapathy)
- Yohan Giarelli (frequence-web)
- Gerry Vandermaesen (gerryvdm)

View File

@ -546,6 +546,7 @@ abstract class FrameworkExtensionTest extends TestCase
/**
* @group legacy
* @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
*/
public function testDeprecatedSerializerCacheOption()
{

View File

@ -86,6 +86,7 @@ class TemplateNameParserTest extends TestCase
/**
* @group legacy
* @dataProvider provideAbsolutePaths
* @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
*/
public function testAbsolutePathsAreDeprecated($name, $logicalName, $path, $ref)
{

View File

@ -14,8 +14,6 @@ namespace Symfony\Component\Asset\Tests;
use Symfony\Component\Asset\Package;
use Symfony\Component\Asset\Packages;
use Symfony\Component\Asset\VersionStrategy\StaticVersionStrategy;
use Symfony\Component\Asset\Exception\InvalidArgumentException;
use Symfony\Component\Asset\Exception\LogicException;
class PackagesTest extends \PHPUnit_Framework_TestCase
{
@ -57,7 +55,7 @@ class PackagesTest extends \PHPUnit_Framework_TestCase
}
/**
* @expectedException LogicException
* @expectedException \Symfony\Component\Asset\Exception\LogicException
*/
public function testNoDefaultPackage()
{
@ -66,7 +64,7 @@ class PackagesTest extends \PHPUnit_Framework_TestCase
}
/**
* @expectedException InvalidArgumentException
* @expectedException \Symfony\Component\Asset\Exception\InvalidArgumentException
*/
public function testUndefinedPackage()
{

View File

@ -410,9 +410,16 @@ class SymfonyStyle extends OutputStyle
}
}
$firstLineIndex = 0;
if ($padding && $this->isDecorated()) {
$firstLineIndex = 1;
array_unshift($lines, '');
$lines[] = '';
}
foreach ($lines as $i => &$line) {
if (null !== $type) {
$line = 0 === $i ? $type.$line : $lineIndentation.$line;
$line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
}
$line = $prefix.$line;
@ -423,11 +430,6 @@ class SymfonyStyle extends OutputStyle
}
}
if ($padding && $this->isDecorated()) {
array_unshift($lines, '');
$lines[] = '';
}
return $lines;
}
}

View File

@ -0,0 +1,15 @@
<?php
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength;
// ensure that block() output is properly formatted (even padding lines)
return function (InputInterface $input, OutputInterface $output) {
$output->setDecorated(true);
$output = new SymfonyStyleWithForcedLineLength($input, $output);
$output->success(
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum',
'TEST'
);
};

View File

@ -0,0 +1,8 @@
 
 [OK] Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore 
 magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo 
 consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. 
 Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum 
 

View File

@ -58,6 +58,9 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
}
}
/**
* @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
*/
public function testCreateDeprecatedService()
{
ErrorAssert::assertDeprecationsAreTriggered('The "deprecated_foo" service is deprecated. You should stop using it, as it will soon be removed.', function () {

View File

@ -544,6 +544,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
/**
* @group legacy
* @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
*/
public function testAliasDefinitionContainsUnsupportedElements()
{

View File

@ -19,7 +19,7 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
class MongoDbSessionHandler implements \SessionHandlerInterface
{
/**
* @var \Mongo
* @var \Mongo|\MongoClient|\MongoDB\Client
*/
private $mongo;
@ -61,15 +61,15 @@ class MongoDbSessionHandler implements \SessionHandlerInterface
* If you use such an index, you can drop `gc_probability` to 0 since
* no garbage-collection is required.
*
* @param \Mongo|\MongoClient $mongo A MongoClient or Mongo instance
* @param array $options An associative array of field options
* @param \Mongo|\MongoClient|\MongoDB\Client $mongo A MongoDB\Client, MongoClient or Mongo instance
* @param array $options An associative array of field options
*
* @throws \InvalidArgumentException When MongoClient or Mongo instance not provided
* @throws \InvalidArgumentException When "database" or "collection" not provided
*/
public function __construct($mongo, array $options)
{
if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo)) {
if (!($mongo instanceof \MongoDB\Client || $mongo instanceof \MongoClient || $mongo instanceof \Mongo)) {
throw new \InvalidArgumentException('MongoClient or Mongo instance required');
}
@ -108,7 +108,9 @@ class MongoDbSessionHandler implements \SessionHandlerInterface
*/
public function destroy($sessionId)
{
$this->getCollection()->remove(array(
$methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteOne' : 'remove';
$this->getCollection()->$methodName(array(
$this->options['id_field'] => $sessionId,
));
@ -120,8 +122,10 @@ class MongoDbSessionHandler implements \SessionHandlerInterface
*/
public function gc($maxlifetime)
{
$this->getCollection()->remove(array(
$this->options['expiry_field'] => array('$lt' => new \MongoDate()),
$methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteOne' : 'remove';
$this->getCollection()->$methodName(array(
$this->options['expiry_field'] => array('$lt' => $this->createDateTime()),
));
return true;
@ -132,18 +136,28 @@ class MongoDbSessionHandler implements \SessionHandlerInterface
*/
public function write($sessionId, $data)
{
$expiry = new \MongoDate(time() + (int) ini_get('session.gc_maxlifetime'));
$expiry = $this->createDateTime(time() + (int) ini_get('session.gc_maxlifetime'));
$fields = array(
$this->options['data_field'] => new \MongoBinData($data, \MongoBinData::BYTE_ARRAY),
$this->options['time_field'] => new \MongoDate(),
$this->options['time_field'] => $this->createDateTime(),
$this->options['expiry_field'] => $expiry,
);
$this->getCollection()->update(
$options = array('upsert' => true);
if ($this->mongo instanceof \MongoDB\Client) {
$fields[$this->options['data_field']] = new \MongoDB\BSON\Binary($data, \MongoDB\BSON\Binary::TYPE_OLD_BINARY);
} else {
$fields[$this->options['data_field']] = new \MongoBinData($data, \MongoBinData::BYTE_ARRAY);
$options['multiple'] = false;
}
$methodName = $this->mongo instanceof \MongoDB\Client ? 'updateOne' : 'update';
$this->getCollection()->$methodName(
array($this->options['id_field'] => $sessionId),
array('$set' => $fields),
array('upsert' => true, 'multiple' => false)
$options
);
return true;
@ -156,10 +170,18 @@ class MongoDbSessionHandler implements \SessionHandlerInterface
{
$dbData = $this->getCollection()->findOne(array(
$this->options['id_field'] => $sessionId,
$this->options['expiry_field'] => array('$gte' => new \MongoDate()),
$this->options['expiry_field'] => array('$gte' => $this->createDateTime()),
));
return null === $dbData ? '' : $dbData[$this->options['data_field']]->bin;
if (null === $dbData) {
return '';
}
if ($dbData[$this->options['data_field']] instanceof \MongoDB\BSON\Binary) {
return $dbData[$this->options['data_field']]->getData();
}
return $dbData[$this->options['data_field']]->bin;
}
/**
@ -179,10 +201,30 @@ class MongoDbSessionHandler implements \SessionHandlerInterface
/**
* Return a Mongo instance.
*
* @return \Mongo
* @return \Mongo|\MongoClient|\MongoDB\Client
*/
protected function getMongo()
{
return $this->mongo;
}
/**
* Create a date object using the class appropriate for the current mongo connection.
*
* Return an instance of a MongoDate or \MongoDB\BSON\UTCDateTime
*
* @param int $seconds An integer representing UTC seconds since Jan 1 1970. Defaults to now.
*/
private function createDateTime($seconds = null)
{
if (null === $seconds) {
$seconds = time();
}
if ($this->mongo instanceof \MongoDB\Client) {
return new \MongoDB\BSON\UTCDateTime($seconds * 1000);
}
return new \MongoDate($seconds);
}
}

View File

@ -15,7 +15,6 @@ use Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandl
/**
* @author Markus Bachmann <markus.bachmann@bachi.biz>
* @requires extension mongo
* @group time-sensitive
*/
class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
@ -31,7 +30,15 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
{
parent::setUp();
$mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient';
if (!extension_loaded('mongo') && !extension_loaded('mongodb')) {
$this->markTestSkipped('The Mongo or MongoDB extension is required.');
}
if (phpversion('mongodb')) {
$mongoClass = 'MongoDB\Client';
} else {
$mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient';
}
$this->mongo = $this->getMockBuilder($mongoClass)
->disableOriginalConstructor()
@ -96,14 +103,28 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
$this->assertArrayHasKey($this->options['expiry_field'], $criteria);
$this->assertArrayHasKey('$gte', $criteria[$this->options['expiry_field']]);
$this->assertInstanceOf('MongoDate', $criteria[$this->options['expiry_field']]['$gte']);
$this->assertGreaterThanOrEqual($criteria[$this->options['expiry_field']]['$gte']->sec, $testTimeout);
return array(
if (phpversion('mongodb')) {
$this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $criteria[$this->options['expiry_field']]['$gte']);
$this->assertGreaterThanOrEqual(round(intval((string) $criteria[$this->options['expiry_field']]['$gte']) / 1000), $testTimeout);
} else {
$this->assertInstanceOf('MongoDate', $criteria[$this->options['expiry_field']]['$gte']);
$this->assertGreaterThanOrEqual($criteria[$this->options['expiry_field']]['$gte']->sec, $testTimeout);
}
$fields = array(
$this->options['id_field'] => 'foo',
$this->options['data_field'] => new \MongoBinData('bar', \MongoBinData::BYTE_ARRAY),
$this->options['id_field'] => new \MongoDate(),
);
if (phpversion('mongodb')) {
$fields[$this->options['data_field']] = new \MongoDB\BSON\Binary('bar', \MongoDB\BSON\Binary::TYPE_OLD_BINARY);
$fields[$this->options['id_field']] = new \MongoDB\BSON\UTCDateTime(time() * 1000);
} else {
$fields[$this->options['data_field']] = new \MongoBinData('bar', \MongoBinData::BYTE_ARRAY);
$fields[$this->options['id_field']] = new \MongoDate();
}
return $fields;
}));
$this->assertEquals('bar', $this->storage->read('foo'));
@ -120,11 +141,18 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
$data = array();
$methodName = phpversion('mongodb') ? 'updateOne' : 'update';
$collection->expects($this->once())
->method('update')
->method($methodName)
->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) {
$this->assertEquals(array($this->options['id_field'] => 'foo'), $criteria);
$this->assertEquals(array('upsert' => true, 'multiple' => false), $options);
if (phpversion('mongodb')) {
$this->assertEquals(array('upsert' => true), $options);
} else {
$this->assertEquals(array('upsert' => true, 'multiple' => false), $options);
}
$data = $updateData['$set'];
}));
@ -132,10 +160,17 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
$expectedExpiry = time() + (int) ini_get('session.gc_maxlifetime');
$this->assertTrue($this->storage->write('foo', 'bar'));
$this->assertEquals('bar', $data[$this->options['data_field']]->bin);
$this->assertInstanceOf('MongoDate', $data[$this->options['time_field']]);
$this->assertInstanceOf('MongoDate', $data[$this->options['expiry_field']]);
$this->assertGreaterThanOrEqual($expectedExpiry, $data[$this->options['expiry_field']]->sec);
if (phpversion('mongodb')) {
$this->assertEquals('bar', $data[$this->options['data_field']]->getData());
$this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$this->options['time_field']]);
$this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$this->options['expiry_field']]);
$this->assertGreaterThanOrEqual($expectedExpiry, round(intval((string) $data[$this->options['expiry_field']]) / 1000));
} else {
$this->assertEquals('bar', $data[$this->options['data_field']]->bin);
$this->assertInstanceOf('MongoDate', $data[$this->options['time_field']]);
$this->assertInstanceOf('MongoDate', $data[$this->options['expiry_field']]);
$this->assertGreaterThanOrEqual($expectedExpiry, $data[$this->options['expiry_field']]->sec);
}
}
public function testWriteWhenUsingExpiresField()
@ -160,20 +195,33 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
$data = array();
$methodName = phpversion('mongodb') ? 'updateOne' : 'update';
$collection->expects($this->once())
->method('update')
->method($methodName)
->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) {
$this->assertEquals(array($this->options['id_field'] => 'foo'), $criteria);
$this->assertEquals(array('upsert' => true, 'multiple' => false), $options);
if (phpversion('mongodb')) {
$this->assertEquals(array('upsert' => true), $options);
} else {
$this->assertEquals(array('upsert' => true, 'multiple' => false), $options);
}
$data = $updateData['$set'];
}));
$this->assertTrue($this->storage->write('foo', 'bar'));
$this->assertEquals('bar', $data[$this->options['data_field']]->bin);
$this->assertInstanceOf('MongoDate', $data[$this->options['time_field']]);
$this->assertInstanceOf('MongoDate', $data[$this->options['expiry_field']]);
if (phpversion('mongodb')) {
$this->assertEquals('bar', $data[$this->options['data_field']]->getData());
$this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$this->options['time_field']]);
$this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$this->options['expiry_field']]);
} else {
$this->assertEquals('bar', $data[$this->options['data_field']]->bin);
$this->assertInstanceOf('MongoDate', $data[$this->options['time_field']]);
$this->assertInstanceOf('MongoDate', $data[$this->options['expiry_field']]);
}
}
public function testReplaceSessionData()
@ -187,8 +235,10 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
$data = array();
$methodName = phpversion('mongodb') ? 'updateOne' : 'update';
$collection->expects($this->exactly(2))
->method('update')
->method($methodName)
->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) {
$data = $updateData;
}));
@ -196,7 +246,11 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
$this->storage->write('foo', 'bar');
$this->storage->write('foo', 'foobar');
$this->assertEquals('foobar', $data['$set'][$this->options['data_field']]->bin);
if (phpversion('mongodb')) {
$this->assertEquals('foobar', $data['$set'][$this->options['data_field']]->getData());
} else {
$this->assertEquals('foobar', $data['$set'][$this->options['data_field']]->bin);
}
}
public function testDestroy()
@ -208,8 +262,10 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
->with($this->options['database'], $this->options['collection'])
->will($this->returnValue($collection));
$methodName = phpversion('mongodb') ? 'deleteOne' : 'remove';
$collection->expects($this->once())
->method('remove')
->method($methodName)
->with(array($this->options['id_field'] => 'foo'));
$this->assertTrue($this->storage->destroy('foo'));
@ -224,11 +280,18 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
->with($this->options['database'], $this->options['collection'])
->will($this->returnValue($collection));
$methodName = phpversion('mongodb') ? 'deleteOne' : 'remove';
$collection->expects($this->once())
->method('remove')
->method($methodName)
->will($this->returnCallback(function ($criteria) {
$this->assertInstanceOf('MongoDate', $criteria[$this->options['expiry_field']]['$lt']);
$this->assertGreaterThanOrEqual(time() - 1, $criteria[$this->options['expiry_field']]['$lt']->sec);
if (phpversion('mongodb')) {
$this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $criteria[$this->options['expiry_field']]['$lt']);
$this->assertGreaterThanOrEqual(time() - 1, round(intval((string) $criteria[$this->options['expiry_field']]['$lt']) / 1000));
} else {
$this->assertInstanceOf('MongoDate', $criteria[$this->options['expiry_field']]['$lt']);
$this->assertGreaterThanOrEqual(time() - 1, $criteria[$this->options['expiry_field']]['$lt']->sec);
}
}));
$this->assertTrue($this->storage->gc(1));
@ -239,14 +302,23 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
$method = new \ReflectionMethod($this->storage, 'getMongo');
$method->setAccessible(true);
$mongoClass = (version_compare(phpversion('mongo'), '1.3.0', '<')) ? '\Mongo' : '\MongoClient';
if (phpversion('mongodb')) {
$mongoClass = 'MongoDB\Client';
} else {
$mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient';
}
$this->assertInstanceOf($mongoClass, $method->invoke($this->storage));
}
private function createMongoCollectionMock()
{
$collection = $this->getMockBuilder('MongoCollection')
$collectionClass = 'MongoCollection';
if (phpversion('mongodb')) {
$collectionClass = 'MongoDB\Collection';
}
$collection = $this->getMockBuilder($collectionClass)
->disableOriginalConstructor()
->getMock();

View File

@ -28,6 +28,7 @@ class EsiFragmentRendererTest extends \PHPUnit_Framework_TestCase
/**
* @group legacy
* @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
*/
public function testRenderFallbackWithObjectAttributesIsDeprecated()
{

View File

@ -11,6 +11,7 @@
namespace Symfony\Component\Security\Guard\Authenticator;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
@ -45,7 +46,10 @@ abstract class AbstractFormLoginAuthenticator extends AbstractGuardAuthenticator
*/
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
{
$request->getSession()->set(Security::AUTHENTICATION_ERROR, $exception);
if ($request->getSession() instanceof SessionInterface) {
$request->getSession()->set(Security::AUTHENTICATION_ERROR, $exception);
}
$url = $this->getLoginUrl();
return new RedirectResponse($url);
@ -65,12 +69,16 @@ abstract class AbstractFormLoginAuthenticator extends AbstractGuardAuthenticator
@trigger_error(sprintf('The AbstractFormLoginAuthenticator::onAuthenticationSuccess() implementation was deprecated in Symfony 3.1 and will be removed in Symfony 4.0. You should implement this method yourself in %s and remove getDefaultSuccessRedirectUrl().', get_class($this)), E_USER_DEPRECATED);
if (!method_exists($this, 'getDefaultSuccessRedirectUrl')) {
throw new \Exception(sprintf('You must implement onAuthenticationSuccess() or getDefaultSuccessRedirectURL() in %s.', get_class($this)));
throw new \Exception(sprintf('You must implement onAuthenticationSuccess() or getDefaultSuccessRedirectUrl() in %s.', get_class($this)));
}
// if the user hits a secure page and start() was called, this was
$targetPath = null;
// if the user hit a secure page and start() was called, this was
// the URL they were on, and probably where you want to redirect to
$targetPath = $this->getTargetPath($request->getSession(), $providerKey);
if ($request->getSession() instanceof SessionInterface) {
$targetPath = $this->getTargetPath($request->getSession(), $providerKey);
}
if (!$targetPath) {
$targetPath = $this->getDefaultSuccessRedirectUrl();

View File

@ -1,64 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Guard\Tests\Authenticator;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Guard\Authenticator\AbstractFormLoginAuthenticator;
class AbstractFormLoginAuthenticatorTest extends \PHPUnit_Framework_TestCase
{
/**
* @group legacy
*/
public function testLegacyWithLoginUrl()
{
$request = new Request();
$request->setSession($this->getMock('Symfony\Component\HttpFoundation\Session\Session'));
$authenticator = new LegacyFormLoginAuthenticator();
/** @var RedirectResponse $actualResponse */
$actualResponse = $authenticator->onAuthenticationSuccess(
$request,
$this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'),
'provider_key'
);
$this->assertEquals('/default_url', $actualResponse->getTargetUrl());
}
}
class LegacyFormLoginAuthenticator extends AbstractFormLoginAuthenticator
{
protected function getDefaultSuccessRedirectUrl()
{
return '/default_url';
}
protected function getLoginUrl()
{
}
public function getCredentials(Request $request)
{
}
public function getUser($credentials, UserProviderInterface $userProvider)
{
}
public function checkCredentials($credentials, UserInterface $user)
{
}
}

View File

@ -0,0 +1,221 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Guard\Tests\Authenticator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Guard\Authenticator\AbstractFormLoginAuthenticator;
/**
* @author Jean Pasdeloup <jpasdeloup@sedona.fr>
*/
class FormLoginAuthenticatorTest extends \PHPUnit_Framework_TestCase
{
private $requestWithoutSession;
private $requestWithSession;
private $authenticator;
const LOGIN_URL = 'http://login';
const DEFAULT_SUCCESS_URL = 'http://defaultsuccess';
const CUSTOM_SUCCESS_URL = 'http://customsuccess';
public function testAuthenticationFailureWithoutSession()
{
$failureResponse = $this->authenticator->onAuthenticationFailure($this->requestWithoutSession, new AuthenticationException());
$this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $failureResponse);
$this->assertEquals(self::LOGIN_URL, $failureResponse->getTargetUrl());
}
public function testAuthenticationFailureWithSession()
{
$this->requestWithSession->getSession()
->expects($this->once())
->method('set');
$failureResponse = $this->authenticator->onAuthenticationFailure($this->requestWithSession, new AuthenticationException());
$this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $failureResponse);
$this->assertEquals(self::LOGIN_URL, $failureResponse->getTargetUrl());
}
/**
* @group legacy
*/
public function testAuthenticationSuccessWithoutSession()
{
$token = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface')
->disableOriginalConstructor()
->getMock();
$redirectResponse = $this->authenticator->onAuthenticationSuccess($this->requestWithoutSession, $token, 'providerkey');
$this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $redirectResponse);
$this->assertEquals(self::DEFAULT_SUCCESS_URL, $redirectResponse->getTargetUrl());
}
/**
* @group legacy
*/
public function testAuthenticationSuccessWithSessionButEmpty()
{
$token = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface')
->disableOriginalConstructor()
->getMock();
$this->requestWithSession->getSession()
->expects($this->once())
->method('get')
->will($this->returnValue(null));
$redirectResponse = $this->authenticator->onAuthenticationSuccess($this->requestWithSession, $token, 'providerkey');
$this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $redirectResponse);
$this->assertEquals(self::DEFAULT_SUCCESS_URL, $redirectResponse->getTargetUrl());
}
/**
* @group legacy
*/
public function testAuthenticationSuccessWithSessionAndTarget()
{
$token = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface')
->disableOriginalConstructor()
->getMock();
$this->requestWithSession->getSession()
->expects($this->once())
->method('get')
->will($this->returnValue(self::CUSTOM_SUCCESS_URL));
$redirectResponse = $this->authenticator->onAuthenticationSuccess($this->requestWithSession, $token, 'providerkey');
$this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $redirectResponse);
$this->assertEquals(self::CUSTOM_SUCCESS_URL, $redirectResponse->getTargetUrl());
}
public function testRememberMe()
{
$doSupport = $this->authenticator->supportsRememberMe();
$this->assertTrue($doSupport);
}
public function testStartWithoutSession()
{
$failureResponse = $this->authenticator->start($this->requestWithoutSession, new AuthenticationException());
$this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $failureResponse);
$this->assertEquals(self::LOGIN_URL, $failureResponse->getTargetUrl());
}
public function testStartWithSession()
{
$failureResponse = $this->authenticator->start($this->requestWithSession, new AuthenticationException());
$this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $failureResponse);
$this->assertEquals(self::LOGIN_URL, $failureResponse->getTargetUrl());
}
protected function setUp()
{
$this->requestWithoutSession = new Request(array(), array(), array(), array(), array(), array());
$this->requestWithSession = new Request(array(), array(), array(), array(), array(), array());
$session = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\Session\\SessionInterface')
->disableOriginalConstructor()
->getMock();
$this->requestWithSession->setSession($session);
$this->authenticator = new TestFormLoginAuthenticator();
$this->authenticator
->setLoginUrl(self::LOGIN_URL)
->setDefaultSuccessRedirectUrl(self::DEFAULT_SUCCESS_URL)
;
}
protected function tearDown()
{
$this->request = null;
$this->requestWithSession = null;
}
}
class TestFormLoginAuthenticator extends AbstractFormLoginAuthenticator
{
private $loginUrl;
private $defaultSuccessRedirectUrl;
/**
* @param mixed $defaultSuccessRedirectUrl
*
* @return TestFormLoginAuthenticator
*/
public function setDefaultSuccessRedirectUrl($defaultSuccessRedirectUrl)
{
$this->defaultSuccessRedirectUrl = $defaultSuccessRedirectUrl;
return $this;
}
/**
* @param mixed $loginUrl
*
* @return TestFormLoginAuthenticator
*/
public function setLoginUrl($loginUrl)
{
$this->loginUrl = $loginUrl;
return $this;
}
/**
* {@inheritdoc}
*/
protected function getLoginUrl()
{
return $this->loginUrl;
}
/**
* {@inheritdoc}
*/
protected function getDefaultSuccessRedirectUrl()
{
return $this->defaultSuccessRedirectUrl;
}
/**
* {@inheritdoc}
*/
public function getCredentials(Request $request)
{
return 'credentials';
}
/**
* {@inheritdoc}
*/
public function getUser($credentials, UserProviderInterface $userProvider)
{
return $userProvider->loadUserByUsername($credentials);
}
/**
* {@inheritdoc}
*/
public function checkCredentials($credentials, UserInterface $user)
{
return true;
}
}

View File

@ -255,6 +255,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase
/**
* @group legacy
* @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
* throws \Symfony\Component\Yaml\Exception\ParseException in 4.0
*/
public function testParseUnquotedScalarStartingWithPercentCharacter()