Merge branch '2.7' into 2.8

* 2.7:
  fix some risky tests
  bumped Symfony version to 2.7.27
  updated VERSION for 2.7.26
  update CONTRIBUTORS for 2.7.26
  updated CHANGELOG for 2.7.26
This commit is contained in:
Fabien Potencier 2017-04-04 08:24:26 -07:00
commit 945fee14db
27 changed files with 272 additions and 158 deletions

View File

@ -7,6 +7,37 @@ 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.26 (2017-04-04)
* bug #22229 [ExpressionLanguage] Provide the expression in syntax errors (k0pernikus, stof)
* bug #22240 [DI] Fix fatal error at ContainerBuilder::compile() if config is not installed (chalasr)
* bug #22140 [Form] Improve the exceptions when trying to get the data in a PRE_SET_DATA listener and the data has not already been set (fancyweb)
* bug #22217 [Console] Fix table cell styling (ro0NL)
* bug #22194 [Console] CommandTester: disable color support detection (julienfalque)
* bug #22188 [Console] Revised exception rendering (ro0NL)
* bug #22154 [WebProfilerBundle] Normalize whitespace in exceptions passed in headers (curry684)
* bug #22142 [Console] Escape exception messages in renderException (chalasr)
* bug #22172 Fix port usage in server:status command (alcaeus)
* bug #22164 [Bridge\Doctrine] Fix change breaking doctrine-bundle test suite (nicolas-grekas)
* bug #22133 [Filesystem] normalize paths before making them relative (xabbuh)
* bug #22138 [HttpFoundation][bugfix] $bags should always be initialized (MacDada)
* bug #21810 #21809 [SecurityBundle] bugfix: if security provider's name contains upper cases then container didn't compile (Antanas Arvasevicius)
* bug #19778 [Security] Fixed roles serialization on token from user object (eko)
* bug #22022 [Validator] fix URL validator to detect non supported chars according to RFC 3986 (e-moe)
* bug #21968 Fixed pathinfo calculation for requests starting with a question mark. (syzygymsu)
* bug #21846 [HttpFoundation] Fix Request::getHost() when having several hosts in X_FORWARDED_HOST (nicolas-grekas)
* bug #21208 [Validator] Add object handling of invalid constraints in Composite (SenseException)
* bug #22044 [Serializer] [XML] Ignore Process Instruction (jordscream)
* bug #22079 [HttpKernel] Fixed bug with purging of HTTPS URLs (ausi)
* bug #21523 #20411 fix Yaml parsing for very long quoted strings (RichardBradley)
* bug #22001 [Doctrine Bridge] fix priority for doctrine event listeners (dmaicher)
* bug #21981 [Console] Use proper line endings in BufferedOutput (julienfalque)
* bug #21957 [Form] Choice type int values (BC Fix) (mcfedr)
* bug #21923 [travis] Test with hhvm 3.18 (nicolas-grekas)
* bug #21823 dumpFile(), preserve existing file permissions (chs2)
* bug #21865 [Security] context listener: hardening user provider handling (xabbuh)
* bug #21883 [HttpKernel] fix Kernel name when stored in a directory starting with a number (fabpot)
* 2.7.25 (2017-03-06)
* bug #21671 [Serializer] Xml encoder throws exception for valid data (gr1ev0us)

View File

@ -23,25 +23,26 @@ Symfony is the result of the work of many people who made the code better
- Pascal Borreli (pborreli)
- Wouter De Jong (wouterj)
- Romain Neutron (romain)
- Grégoire Pineau (lyrixx)
- Joseph Bielawski (stloyd)
- Karma Dordrak (drak)
- Lukas Kahwe Smith (lsmith)
- Grégoire Pineau (lyrixx)
- Martin Hasoň (hason)
- Jeremy Mikola (jmikola)
- Robin Chalas (chalas_r)
- Maxime Steinhausser (ogizanagi)
- Jeremy Mikola (jmikola)
- Jean-François Simon (jfsimon)
- Benjamin Eberlei (beberlei)
- Igor Wiedler (igorw)
- Robin Chalas (chalas_r)
- Eriksen Costa (eriksencosta)
- Jules Pietri (heah)
- Sarah Khalil (saro0h)
- Jonathan Wage (jwage)
- Guilhem Niot (energetick)
- Diego Saint Esteben (dosten)
- Roland Franssen (ro0)
- Alexandre Salomé (alexandresalome)
- William Durand (couac)
- Guilhem Niot (energetick)
- ornicar
- Francis Besset (francisbesset)
- stealth35 (stealth35)
@ -50,20 +51,20 @@ Symfony is the result of the work of many people who made the code better
- Peter Rehm (rpet)
- Saša Stamenković (umpirsky)
- Henrik Bjørnskov (henrikbjorn)
- Roland Franssen (ro0)
- Miha Vrhovnik
- Iltar van der Berg (kjarli)
- Diego Saint Esteben (dii3g0)
- Konstantin Kudryashov (everzet)
- Bilal Amarni (bamarni)
- Florin Patan (florinpatan)
- Matthias Pigulla (mpdude)
- Kevin Bond (kbond)
- Andrej Hudec (pulzarraider)
- Gábor Egyed (1ed)
- Michel Weimerskirch (mweimerskirch)
- Eric Clemmons (ericclemmons)
- Charles Sarrazin (csarrazi)
- Matthias Pigulla (mpdude)
- Pierre du Plessis (pierredup)
- Christian Raue
- Arnout Boks (aboks)
- Deni
@ -71,39 +72,38 @@ Symfony is the result of the work of many people who made the code better
- Dariusz Górecki (canni)
- Titouan Galopin (tgalopin)
- Douglas Greenshields (shieldo)
- Pierre du Plessis (pierredup)
- Konstantin Myakshin (koc)
- Lee McDermott
- Brandon Turner
- Luis Cordova (cordoval)
- Jáchym Toušek (enumag)
- Graham Campbell (graham)
- Daniel Holmes (dholmes)
- Toni Uebernickel (havvg)
- Bart van den Burg (burgov)
- Jordan Alliot (jalliot)
- Jérémy DERUSSÉ (jderusse)
- John Wards (johnwards)
- Fran Moreno (franmomu)
- Jáchym Toušek (enumag)
- Antoine Hérault (herzult)
- Paráda József (paradajozsef)
- Dariusz Ruminski
- Arnaud Le Blanc (arnaud-lb)
- Jérôme Tamarelle (gromnan)
- Maxime STEINHAUSSER
- Michal Piotrowski (eventhorizon)
- Tim Nagel (merk)
- Maxime STEINHAUSSER
- Issei Murasawa (issei_m)
- Brice BERNARD (brikou)
- Alexander M. Turek (derrabus)
- Baptiste Clavié (talus)
- marc.weistroff
- lenar
- Włodzimierz Gajda (gajdaw)
- Baptiste Clavié (talus)
- Vladimir Reznichenko (kalessil)
- Alexander Schwenn (xelaris)
- Florian Voutzinos (florianv)
- Colin Frei
- Jérémy DERUSSÉ (jderusse)
- Adrien Brault (adrienbrault)
- Joshua Thijssen
- Peter Kokot (maastermedia)
@ -148,6 +148,7 @@ Symfony is the result of the work of many people who made the code better
- Teoh Han Hui (teohhanhui)
- Clemens Tolboom
- Helmer Aaviksoo
- Grégoire Paris (greg0ire)
- Hiromi Hishida (77web)
- Richard van Laak (rvanlaak)
- Matthieu Ouellette-Vachon (maoueh)
@ -160,7 +161,7 @@ Symfony is the result of the work of many people who made the code better
- Warnar Boekkooi (boekkooi)
- Dmitrii Chekaliuk (lazyhammer)
- Clément JOBEILI (dator)
- Grégoire Paris (greg0ire)
- Dawid Nowak
- Possum
- Dorian Villet (gnutix)
- Richard Miller (mr_r_miller)
@ -168,6 +169,7 @@ Symfony is the result of the work of many people who made the code better
- Dennis Benkert (denderello)
- Benjamin Dulau (dbenjamin)
- Mathieu Lemoine (lemoinem)
- Chris Wilkinson (thewilkybarkid)
- Andreas Hucks (meandmymonkey)
- Noel Guilbert (noel)
- Lars Strojny (lstrojny)
@ -191,16 +193,15 @@ Symfony is the result of the work of many people who made the code better
- John Kary (johnkary)
- Justin Hileman (bobthecow)
- Blanchon Vincent (blanchonvincent)
- Chris Wilkinson (thewilkybarkid)
- Christian Schmidt
- Michele Orselli (orso)
- Tom Van Looy (tvlooy)
- Sven Paulus (subsven)
- Rui Marinho (ruimarinho)
- SpacePossum
- Dawid Nowak
- Eugene Wissner
- Julien Brochet (mewt)
- Julien Falque (julienfalque)
- Tristan Darricau (nicofuma)
- Sergey Linnik (linniksa)
- Michaël Perrin (michael.perrin)
@ -211,6 +212,7 @@ Symfony is the result of the work of many people who made the code better
- julien pauli (jpauli)
- Lorenz Schori
- Sébastien Lavoie (lavoiesl)
- David Maicher (dmaicher)
- Francois Zaninotto
- Alexander Kotynia (olden)
- Daniel Tschinder
@ -236,7 +238,6 @@ Symfony is the result of the work of many people who made the code better
- Uwe Jäger (uwej711)
- Eugene Leonovich (rybakit)
- Filippo Tessarotto
- Julien Falque (julienfalque)
- Joseph Rouff (rouffj)
- Félix Labrecque (woodspire)
- GordonsLondon
@ -258,7 +259,6 @@ Symfony is the result of the work of many people who made the code better
- Beau Simensen (simensen)
- Michael Hirschler (mvhirsch)
- Robert Kiss (kepten)
- David Maicher (dmaicher)
- Roumen Damianoff (roumen)
- Antonio J. García Lagar (ajgarlag)
- Kim Hemsø Rasmussen (kimhemsoe)
@ -396,6 +396,7 @@ Symfony is the result of the work of many people who made the code better
- EdgarPE
- Florian Pfitzer (marmelatze)
- Asier Illarramendi (doup)
- Andreas Braun
- Chris Sedlmayr (catchamonkey)
- Seb Koelen
- Dany Maillard (maidmaid)
@ -415,6 +416,7 @@ Symfony is the result of the work of many people who made the code better
- Gintautas Miselis
- Rob Bast
- David Badura (davidbadura)
- Jordan Samouh (jordansamouh)
- Zander Baldwin
- Adam Harvey
- Alex Bakhturin
@ -459,11 +461,13 @@ Symfony is the result of the work of many people who made the code better
- Jakub Škvára (jskvara)
- Andrew Udvare (audvare)
- alexpods
- Nikolay Labinskiy (e-moe)
- Arjen van der Meijden
- Michele Locati
- Dariusz Ruminski
- Erik Trapman (eriktrapman)
- De Cock Xavier (xdecock)
- Arthur de Moulins (4rthem)
- Almog Baku (almogbaku)
- Scott Arciszewski
- Norbert Orzechowicz (norzechowicz)
@ -510,8 +514,10 @@ Symfony is the result of the work of many people who made the code better
- Disquedur
- Michiel Boeckaert (milio)
- Geoffrey Tran (geoff)
- Romain Pierre (romain-pierre)
- Jan Behrens
- Mantas Var (mvar)
- Frank de Jonge (frenkynet)
- Sebastian Krebs
- Jean-Christophe Cuvelier [Artack]
- Christopher Davis (chrisguitarguy)
@ -539,8 +545,8 @@ Symfony is the result of the work of many people who made the code better
- Maxime Douailin
- Jean Pasdeloup (pasdeloup)
- Benjamin Cremer (bcremer)
- Thierry Thuon (lepiaf)
- Javier López (loalf)
- Andreas Braun
- Reinier Kip
- Geoffrey Brier (geoffrey-brier)
- Dustin Dobervich (dustin10)
@ -553,6 +559,7 @@ Symfony is the result of the work of many people who made the code better
- Kamil Kokot (pamil)
- Aurimas Niekis (gcds)
- Max Grigorian (maxakawizard)
- mcfedr (mcfedr)
- Rostyslav Kinash
- Maciej Malarz (malarzm)
- Daisuke Ohata
@ -570,6 +577,7 @@ Symfony is the result of the work of many people who made the code better
- Denis Brumann (dbrumann)
- Quentin de Longraye (quentinus95)
- Chris Heng (gigablah)
- Richard Bradley
- Ulumuddin Yunus (joenoez)
- Luc Vieillescazes (iamluc)
- Johann Saunier (prophet777)
@ -629,6 +637,7 @@ Symfony is the result of the work of many people who made the code better
- Besnik Br
- Dariusz Ruminski
- Joshua Nye
- Claudio Zizza
- Dave Marshall (davedevelopment)
- avorobiev
- Venu
@ -647,6 +656,7 @@ Symfony is the result of the work of many people who made the code better
- John Bohn (jbohn)
- Marc Morera (mmoreram)
- Andrew Hilobok (hilobok)
- Noah Heck (myesain)
- Christian Soronellas (theunic)
- Yosmany Garcia (yosmanyga)
- Wouter de Wild
@ -654,17 +664,18 @@ Symfony is the result of the work of many people who made the code better
- Degory Valentine
- Benoit Lévêque (benoit_leveque)
- Jeroen Fiege (fieg)
- Arthur de Moulins (4rthem)
- Krzysiek Łabuś
- Xavier Lacot (xavier)
- possum
- Denis Zunke (donalberto)
- Ahmed TAILOULOUTE (ahmedtai)
- Olivier Maisonneuve (olineuve)
- Masterklavi
- Francis Turmel (fturmel)
- Nikita Nefedov (nikita2206)
- cgonzalez
- Ben
- Vincent Composieux (eko)
- Jayson Xu (superjavason)
- Jaik Dean (jaikdean)
- fago
@ -675,6 +686,7 @@ Symfony is the result of the work of many people who made the code better
- James Michael DuPont
- Tom Klingenberg
- Christopher Hall (mythmakr)
- Patrick Dawkins (pjcdawkins)
- Paul Kamer (pkamer)
- Rafał Wrzeszcz (rafalwrzeszcz)
- Reen Lokum
@ -720,6 +732,7 @@ Symfony is the result of the work of many people who made the code better
- corphi
- grizlik
- Derek ROTH
- Dmytro Boiko (eagle)
- Shin Ohno (ganchiku)
- Geert De Deckere (geertdd)
- Jan Kramer (jankramer)
@ -782,7 +795,6 @@ Symfony is the result of the work of many people who made the code better
- Phan Thanh Ha (haphan)
- Chris Jones (leek)
- Colin O'Dell (colinodell)
- Frank de Jonge (frenkynet)
- xaav
- Mahmoud Mostafa (mahmoud)
- Alessandro Lai
@ -808,7 +820,6 @@ Symfony is the result of the work of many people who made the code better
- Zachary Tong (polyfractal)
- Hryhorii Hrebiniuk
- Dennis Fridrich (dfridrich)
- mcfedr (mcfedr)
- hamza
- dantleech
- Bastien DURAND (deamon)
@ -841,6 +852,7 @@ Symfony is the result of the work of many people who made the code better
- Troy McCabe
- Ville Mattila
- ilyes kooli
- gr1ev0us
- Boris Vujicic (boris.vujicic)
- Max Beutel
- Antanas Arvasevicius
@ -864,10 +876,12 @@ Symfony is the result of the work of many people who made the code better
- Martynas Narbutas
- Bailey Parker
- Eddie Jaoude
- Antanas Arvasevicius
- Haritz Iturbe (hizai)
- Nerijus Arlauskas (nercury)
- SPolischook
- Diego Sapriza
- Anton A. Sumin
- Joan Cruz
- inspiran
- Cristobal Dabed
@ -964,6 +978,7 @@ Symfony is the result of the work of many people who made the code better
- Aharon Perkel
- matze
- Abdul.Mohsen B. A. A
- Martin Auswöger
- Benoît Burnichon
- pthompson
- Malaney J. Hill
@ -1009,7 +1024,9 @@ Symfony is the result of the work of many people who made the code better
- Klaas Cuvelier (kcuvelier)
- markusu49
- Steve Frécinaux
- Jules Lamur
- ShiraNai7
- Markus Fasselt (digilist)
- Vašek Purchart (vasek-purchart)
- Janusz Jabłoński (yanoosh)
- Sandro Hopf
@ -1034,17 +1051,16 @@ Symfony is the result of the work of many people who made the code better
- Luis Galeas
- Martin Pärtel
- George Mponos (gmponos)
- Noah Heck (myesain)
- Patrick Daley (padrig)
- Xavier Briand (xavierbriand)
- Max Summe
- WedgeSama
- Felds Liscia
- Ahmed TAILOULOUTE (ahmedtai)
- Maxime Veber (nek-)
- Sullivan SENECHAL
- Tadcka
- Beth Binkovitz
- Gonzalo Míguez
- Romain Geissler
- Adrien Moiruad
- Tomaz Ahlin
@ -1104,7 +1120,6 @@ Symfony is the result of the work of many people who made the code better
- Konrad Mohrfeldt
- Lance Chen
- Andrew (drew)
- Nikolay Labinskiy (e-moe)
- kor3k kor3k (kor3k)
- Stelian Mocanita (stelian)
- Flavian (2much)
@ -1143,11 +1158,9 @@ Symfony is the result of the work of many people who made the code better
- victoria
- Francisco Facioni (fran6co)
- Iwan van Staveren (istaveren)
- Thierry Thuon (lepiaf)
- Povilas S. (povilas)
- pborreli
- Eric Caron
- Richard Bradley
- 2manypeople
- Wing
- Thomas Bibb
@ -1171,6 +1184,7 @@ Symfony is the result of the work of many people who made the code better
- Michal Gebauer
- Gleb Sidora
- David Stone
- Niels Keurentjes (curry684)
- Jovan Perovic (jperovic)
- Pablo Maria Martelletti (pmartelletti)
- Yassine Guedidi (yguedidi)
@ -1228,6 +1242,7 @@ Symfony is the result of the work of many people who made the code better
- Brian Graham (incognito)
- Kevin Vergauwen (innocenzo)
- Alessio Baglio (ioalessio)
- Johannes Müller (johmue)
- Jordi Llonch (jordillonch)
- Cédric Dugat (ph3nol)
- Philip Dahlstrøm (phidah)
@ -1289,6 +1304,7 @@ Symfony is the result of the work of many people who made the code better
- Jérémy M (th3mouk)
- Vincent LEFORT (vlefort)
- Sadicov Vladimir (xtech)
- Kevin EMO (zarcox)
- Alexander Zogheb
- Rémi Blaise
- Joel Marcey
@ -1301,7 +1317,6 @@ Symfony is the result of the work of many people who made the code better
- adenkejawen
- Ari Pringle (apringle)
- Dan Ordille (dordille)
- Dmytro Boiko (eagle)
- Jan Eichhorn (exeu)
- Grégory Pelletier (ip512)
- John Nickell (jrnickell)
@ -1350,7 +1365,6 @@ Symfony is the result of the work of many people who made the code better
- ddebree
- Tomas Liubinas
- Alex
- Patrick Dawkins
- Klaas Naaijkens
- Daniel González Cerviño
- Rafał
@ -1363,7 +1377,6 @@ Symfony is the result of the work of many people who made the code better
- David Joos (djoos)
- Denis Klementjev (dklementjev)
- Tomáš Polívka (draczris)
- Vincent Composieux (eko)
- Franz Liedke (franzliedke)
- Christophe BECKER (goabonga)
- gondo (gondo)
@ -1399,6 +1412,7 @@ Symfony is the result of the work of many people who made the code better
- Curtis
- Gabriel Moreira
- Alexey Popkov
- ChS
- Joseph Deray
- Damian Sromek
- Ben
@ -1437,6 +1451,7 @@ Symfony is the result of the work of many people who made the code better
- znerol
- Christian Eikermann
- Antonio Angelino
- Matt Fields
- Shawn Iwinski
- Niklas Keller
- Vladimir Sazhin
@ -1562,6 +1577,7 @@ Symfony is the result of the work of many people who made the code better
- ibasaw (ibasaw)
- Vladislav Krupenkin (ideea)
- Imangazaliev Muhammad (imangazaliev)
- j0k (j0k)
- joris de wit (jdewit)
- Jérémy CROMBEZ (jeremy)
- Jose Manuel Gonzalez (jgonzalez)

View File

@ -145,13 +145,16 @@ class ArrayNodeDefinitionTest extends TestCase
public function testNestedPrototypedArrayNodes()
{
$node = new ArrayNodeDefinition('root');
$node
$nodeDefinition = new ArrayNodeDefinition('root');
$nodeDefinition
->addDefaultChildrenIfNoneSet()
->prototype('array')
->prototype('array')
;
$node->getNode();
$node = $nodeDefinition->getNode();
$this->assertInstanceOf('Symfony\Component\Config\Definition\PrototypedArrayNode', $node);
$this->assertInstanceOf('Symfony\Component\Config\Definition\PrototypedArrayNode', $node->getPrototype());
}
public function testEnabledNodeDefaults()

View File

@ -71,6 +71,8 @@ class TreeBuilderTest extends TestCase
$root = $builder->root('override', 'array', new CustomNodeBuilder());
$root->prototype('bar')->end();
$this->assertInstanceOf('Symfony\Component\Config\Tests\Fixtures\BarNode', $root->getNode(true)->getPrototype());
}
public function testAnExtendedNodeBuilderGetsPropagatedToTheChildren()
@ -79,7 +81,7 @@ class TreeBuilderTest extends TestCase
$builder->root('propagation')
->children()
->setNodeClass('extended', 'Symfony\Component\Config\Tests\Definition\Builder\VariableNodeDefinition')
->setNodeClass('extended', 'Symfony\Component\Config\Definition\Builder\BooleanNodeDefinition')
->node('foo', 'extended')->end()
->arrayNode('child')
->children()
@ -88,6 +90,15 @@ class TreeBuilderTest extends TestCase
->end()
->end()
->end();
$node = $builder->buildTree();
$children = $node->getChildren();
$this->assertInstanceOf('Symfony\Component\Config\Definition\BooleanNode', $children['foo']);
$childChildren = $children['child']->getChildren();
$this->assertInstanceOf('Symfony\Component\Config\Definition\BooleanNode', $childChildren['foo']);
}
public function testDefinitionInfoGetsTransferredToNode()

View File

@ -0,0 +1,18 @@
<?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\Config\Tests\Fixtures;
use Symfony\Component\Config\Definition\ArrayNode;
class BarNode extends ArrayNode
{
}

View File

@ -12,10 +12,12 @@
namespace Symfony\Component\Config\Tests\Definition\Builder;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\Config\Tests\Fixtures\BarNode;
class BarNodeDefinition extends NodeDefinition
{
protected function createNode()
{
return new BarNode($this->name);
}
}

View File

@ -299,6 +299,8 @@ class CompoundFormTest extends AbstractFormTest
public function testRemoveIgnoresUnknownName()
{
$this->form->remove('notexisting');
$this->assertCount(0, $this->form);
}
public function testArrayAccess()

View File

@ -135,9 +135,9 @@ class ChoiceTypeTest extends BaseTypeTest
public function testChoiceListAndChoicesCanBeEmpty()
{
$this->factory->create(static::TESTED_TYPE, null, array(
$this->assertInstanceOf('Symfony\Component\Form\FormInterface', $this->factory->create(static::TESTED_TYPE, null, array(
'choices_as_values' => true,
));
)));
}
public function testExpandedChoicesOptionsTurnIntoChildren()
@ -2260,10 +2260,10 @@ class ChoiceTypeTest extends BaseTypeTest
// https://github.com/symfony/symfony/issues/3298
public function testInitializeWithEmptyChoices()
{
$this->factory->createNamed('name', static::TESTED_TYPE, null, array(
$this->assertInstanceOf('Symfony\Component\Form\FormInterface', $this->factory->createNamed('name', static::TESTED_TYPE, null, array(
'choices' => array(),
'choices_as_values' => true,
));
)));
}
public function testInitializeWithDefaultObjectChoice()

View File

@ -53,11 +53,13 @@ class CountryTypeTest extends BaseTypeTest
$choices = $this->factory->create(static::TESTED_TYPE, 'country')
->createView()->vars['choices'];
$countryCodes = array();
foreach ($choices as $choice) {
if ('ZZ' === $choice->value) {
$this->fail('Should not contain choice "ZZ"');
}
$countryCodes[] = $choice->value;
}
$this->assertNotContains('ZZ', $countryCodes);
}
public function testSubmitNull($expected = null, $norm = null, $view = null)

View File

@ -283,7 +283,7 @@ class DateTimeTypeTest extends BaseTypeTest
{
// Throws an exception if "data_class" option is not explicitly set
// to null in the type
$this->factory->create(static::TESTED_TYPE, new \DateTime());
$this->assertInstanceOf('Symfony\Component\Form\FormInterface', $this->factory->create(static::TESTED_TYPE, new \DateTime()));
}
public function testSingleTextWidgetShouldUseTheRightInputType()

View File

@ -721,7 +721,7 @@ class DateTypeTest extends BaseTypeTest
{
// Throws an exception if "data_class" option is not explicitly set
// to null in the type
$this->factory->create(static::TESTED_TYPE, new \DateTime());
$this->assertInstanceOf('Symfony\Component\Form\FormInterface', $this->factory->create(static::TESTED_TYPE, new \DateTime()));
}
public function testSingleTextWidgetShouldUseTheRightInputType()

View File

@ -198,23 +198,23 @@ class FormTypeTest extends BaseTypeTest
public function testDataClassMayBeNull()
{
$this->factory->createBuilder(static::TESTED_TYPE, null, array(
$this->assertInstanceOf('Symfony\Component\Form\FormBuilderInterface', $this->factory->createBuilder(static::TESTED_TYPE, null, array(
'data_class' => null,
));
)));
}
public function testDataClassMayBeAbstractClass()
{
$this->factory->createBuilder(static::TESTED_TYPE, null, array(
$this->assertInstanceOf('Symfony\Component\Form\FormBuilderInterface', $this->factory->createBuilder(static::TESTED_TYPE, null, array(
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\AbstractAuthor',
));
)));
}
public function testDataClassMayBeInterface()
{
$this->factory->createBuilder(static::TESTED_TYPE, null, array(
$this->assertInstanceOf('Symfony\Component\Form\FormBuilderInterface', $this->factory->createBuilder(static::TESTED_TYPE, null, array(
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\AuthorInterface',
));
)));
}
/**
@ -701,7 +701,7 @@ class FormTypeTest extends BaseTypeTest
$form = $builder->getForm();
//This method should not throw a Fatal Error Exception.
$form->getErrorsAsString();
$this->assertInternalType('string', $form->getErrorsAsString());
}
public function testSubmitNull($expected = null, $norm = null, $view = null)

View File

@ -498,7 +498,7 @@ class TimeTypeTest extends BaseTypeTest
{
// Throws an exception if "data_class" option is not explicitly set
// to null in the type
$this->factory->create(static::TESTED_TYPE, new \DateTime());
$this->assertInstanceOf('Symfony\Component\Form\FormInterface', $this->factory->create(static::TESTED_TYPE, new \DateTime()));
}
public function testSingleTextWidgetShouldUseTheRightInputType()

View File

@ -62,21 +62,21 @@ class DependencyInjectionExtensionTest extends TestCase
*/
public function testThrowExceptionForInvalidExtendedType()
{
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
$formTypeExtension = $this->createFormTypeExtensionMock('unmatched');
$typeExtension = $this->getMockBuilder('Symfony\Component\Form\FormTypeExtensionInterface')->getMock();
$typeExtension->expects($this->any())
->method('getExtendedType')
->willReturn('unmatched');
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
$container->expects($this->any())
->method('get')
->with('extension')
->willReturn($typeExtension);
->willReturn($formTypeExtension);
$extension = new DependencyInjectionExtension($container, array(), array('test' => array('extension')), array());
$extension->getTypeExtensions('test');
$extensions = $extension->getTypeExtensions('test');
$this->assertCount(1, $extensions);
$this->assertSame($formTypeExtension, $extensions[0]);
}
public function testGetTypeGuesser()

View File

@ -161,6 +161,8 @@ class FormBuilderTest extends TestCase
{
$this->builder->add(new ButtonBuilder('reset'));
$this->builder->add(new SubmitButtonBuilder('submit'));
$this->assertCount(2, $this->builder->all());
}
public function testGetUnknown()

View File

@ -12,9 +12,7 @@
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\FormConfigBuilder;
use Symfony\Component\Form\Exception\InvalidArgumentException;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
@ -24,72 +22,65 @@ class FormConfigTest extends TestCase
public function getHtml4Ids()
{
return array(
array('z0', true),
array('A0', true),
array('A9', true),
array('Z0', true),
array('#', false),
array('a#', false),
array('a$', false),
array('a%', false),
array('a ', false),
array("a\t", false),
array("a\n", false),
array('a-', true),
array('a_', true),
array('a:', true),
array('z0'),
array('A0'),
array('A9'),
array('Z0'),
array('#', 'Symfony\Component\Form\Exception\InvalidArgumentException'),
array('a#', 'Symfony\Component\Form\Exception\InvalidArgumentException'),
array('a$', 'Symfony\Component\Form\Exception\InvalidArgumentException'),
array('a%', 'Symfony\Component\Form\Exception\InvalidArgumentException'),
array('a ', 'Symfony\Component\Form\Exception\InvalidArgumentException'),
array("a\t", 'Symfony\Component\Form\Exception\InvalidArgumentException'),
array("a\n", 'Symfony\Component\Form\Exception\InvalidArgumentException'),
array('a-'),
array('a_'),
array('a:'),
// Periods are allowed by the HTML4 spec, but disallowed by us
// because they break the generated property paths
array('a.', false),
array('a.', 'Symfony\Component\Form\Exception\InvalidArgumentException'),
// Contrary to the HTML4 spec, we allow names starting with a
// number, otherwise naming fields by collection indices is not
// possible.
// For root forms, leading digits will be stripped from the
// "id" attribute to produce valid HTML4.
array('0', true),
array('9', true),
array('0'),
array('9'),
// Contrary to the HTML4 spec, we allow names starting with an
// underscore, since this is already a widely used practice in
// Symfony.
// For root forms, leading underscores will be stripped from the
// "id" attribute to produce valid HTML4.
array('_', true),
array('_'),
// Integers are allowed
array(0, true),
array(123, true),
array(0),
array(123),
// NULL is allowed
array(null, true),
array(null),
// Other types are not
array(1.23, false),
array(5., false),
array(true, false),
array(new \stdClass(), false),
array(1.23, 'Symfony\Component\Form\Exception\UnexpectedTypeException'),
array(5., 'Symfony\Component\Form\Exception\UnexpectedTypeException'),
array(true, 'Symfony\Component\Form\Exception\UnexpectedTypeException'),
array(new \stdClass(), 'Symfony\Component\Form\Exception\UnexpectedTypeException'),
);
}
/**
* @dataProvider getHtml4Ids
*/
public function testNameAcceptsOnlyNamesValidAsIdsInHtml4($name, $accepted)
public function testNameAcceptsOnlyNamesValidAsIdsInHtml4($name, $expectedException = null)
{
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
try {
new FormConfigBuilder($name, null, $dispatcher);
if (!$accepted) {
$this->fail(sprintf('The value "%s" should not be accepted', $name));
}
} catch (UnexpectedTypeException $e) {
// if the value was not accepted, but should be, rethrow exception
if ($accepted) {
throw $e;
}
} catch (InvalidArgumentException $e) {
// if the value was not accepted, but should be, rethrow exception
if ($accepted) {
throw $e;
}
if (null !== $expectedException && method_exists($this, 'expectException')) {
$this->expectException($expectedException);
} elseif (null !== $expectedException) {
$this->setExpectedException($expectedException);
}
$formConfigBuilder = new FormConfigBuilder($name, null, $dispatcher);
$this->assertSame((string) $name, $formConfigBuilder->getName());
}
public function testGetRequestHandlerCreatesNativeRequestHandlerIfNotSet()
@ -109,27 +100,42 @@ class FormConfigTest extends TestCase
public function testSetMethodAllowsGet()
{
$this->getConfigBuilder()->setMethod('GET');
$formConfigBuilder = $this->getConfigBuilder();
$formConfigBuilder->setMethod('GET');
self::assertSame('GET', $formConfigBuilder->getMethod());
}
public function testSetMethodAllowsPost()
{
$this->getConfigBuilder()->setMethod('POST');
$formConfigBuilder = $this->getConfigBuilder();
$formConfigBuilder->setMethod('POST');
self::assertSame('POST', $formConfigBuilder->getMethod());
}
public function testSetMethodAllowsPut()
{
$this->getConfigBuilder()->setMethod('PUT');
$formConfigBuilder = $this->getConfigBuilder();
$formConfigBuilder->setMethod('PUT');
self::assertSame('PUT', $formConfigBuilder->getMethod());
}
public function testSetMethodAllowsDelete()
{
$this->getConfigBuilder()->setMethod('DELETE');
$formConfigBuilder = $this->getConfigBuilder();
$formConfigBuilder->setMethod('DELETE');
self::assertSame('DELETE', $formConfigBuilder->getMethod());
}
public function testSetMethodAllowsPatch()
{
$this->getConfigBuilder()->setMethod('PATCH');
$formConfigBuilder = $this->getConfigBuilder();
$formConfigBuilder->setMethod('PATCH');
self::assertSame('PATCH', $formConfigBuilder->getMethod());
}
/**

View File

@ -919,12 +919,11 @@ class SimpleFormTest extends AbstractFormTest
public function testSubmittingWrongDataIsIgnored()
{
$test = $this;
$called = 0;
$child = $this->getBuilder('child', $this->dispatcher);
$child->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($test) {
// child form doesn't receive the wrong data that is submitted on parent
$test->assertNull($event->getData());
$child->addEventListener(FormEvents::PRE_SUBMIT, function () use (&$called) {
++$called;
});
$parent = $this->getBuilder('parent', new EventDispatcher())
@ -934,6 +933,8 @@ class SimpleFormTest extends AbstractFormTest
->getForm();
$parent->submit('not-an-array');
$this->assertSame(0, $called, 'PRE_SUBMIT event listeners are not called for wrong data');
}
public function testHandleRequestForwardsToRequestHandler()
@ -1037,15 +1038,17 @@ class SimpleFormTest extends AbstractFormTest
public function testSubmitIsNeverFiredIfInheritData()
{
$test = $this;
$called = 0;
$form = $this->getBuilder()
->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) use ($test) {
$test->fail('The SUBMIT event should not be fired');
->addEventListener(FormEvents::SUBMIT, function () use (&$called) {
++$called;
})
->setInheritData(true)
->getForm();
$form->submit('foo');
$this->assertSame(0, $called, 'The SUBMIT event is not fired when data are inherited from the parent form');
}
public function testInitializeSetsDefaultData()

View File

@ -114,8 +114,11 @@ class OrderedHashMapTest extends TestCase
public function testUnsetNonExistingSucceeds()
{
$map = new OrderedHashMap();
$map['second'] = 2;
unset($map['first']);
$this->assertSame(array('second' => 2), iterator_to_array($map));
}
public function testEmptyIteration()

View File

@ -17,14 +17,14 @@ use Symfony\Component\HttpFoundation\IpUtils;
class IpUtilsTest extends TestCase
{
/**
* @dataProvider testIpv4Provider
* @dataProvider getIpv4Data
*/
public function testIpv4($matches, $remoteAddr, $cidr)
{
$this->assertSame($matches, IpUtils::checkIp($remoteAddr, $cidr));
}
public function testIpv4Provider()
public function getIpv4Data()
{
return array(
array(true, '192.168.1.1', '192.168.1.1'),
@ -43,7 +43,7 @@ class IpUtilsTest extends TestCase
}
/**
* @dataProvider testIpv6Provider
* @dataProvider getIpv6Data
*/
public function testIpv6($matches, $remoteAddr, $cidr)
{
@ -54,7 +54,7 @@ class IpUtilsTest extends TestCase
$this->assertSame($matches, IpUtils::checkIp($remoteAddr, $cidr));
}
public function testIpv6Provider()
public function getIpv6Data()
{
return array(
array(true, '2a01:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'),

View File

@ -18,7 +18,7 @@ use Symfony\Component\HttpFoundation\Request;
class RequestMatcherTest extends TestCase
{
/**
* @dataProvider testMethodFixtures
* @dataProvider getMethodData
*/
public function testMethod($requestMethod, $matcherMethod, $isMatch)
{
@ -32,7 +32,7 @@ class RequestMatcherTest extends TestCase
$this->assertSame($isMatch, $matcher->matches($request));
}
public function testMethodFixtures()
public function getMethodData()
{
return array(
array('get', 'get', true),
@ -64,7 +64,7 @@ class RequestMatcherTest extends TestCase
}
/**
* @dataProvider testHostFixture
* @dataProvider getHostData
*/
public function testHost($pattern, $isMatch)
{
@ -78,7 +78,7 @@ class RequestMatcherTest extends TestCase
$this->assertSame($isMatch, $matcher->matches($request));
}
public function testHostFixture()
public function getHostData()
{
return array(
array('.*\.example\.com', true),

View File

@ -306,6 +306,10 @@ class RequestTest extends TestCase
$request->setFormat($format, $mimeTypes);
foreach ($mimeTypes as $mime) {
$this->assertEquals($format, $request->getFormat($mime));
if (null !== $format) {
$this->assertEquals($mimeTypes[0], $request->getMimeType($format));
}
}
}
@ -315,17 +319,6 @@ class RequestTest extends TestCase
$this->assertEquals('json', $request->getFormat('application/json; charset=utf-8'));
}
/**
* @dataProvider getFormatToMimeTypeMapProvider
*/
public function testGetMimeTypeFromFormat($format, $mimeTypes)
{
if (null !== $format) {
$request = new Request();
$this->assertEquals($mimeTypes[0], $request->getMimeType($format));
}
}
public function testGetFormatWithCustomMimeType()
{
$request = new Request();
@ -821,7 +814,7 @@ class RequestTest extends TestCase
}
/**
* @dataProvider testGetClientIpsProvider
* @dataProvider getClientIpsProvider
*/
public function testGetClientIp($expected, $remoteAddr, $httpForwardedFor, $trustedProxies)
{
@ -833,7 +826,7 @@ class RequestTest extends TestCase
}
/**
* @dataProvider testGetClientIpsProvider
* @dataProvider getClientIpsProvider
*/
public function testGetClientIps($expected, $remoteAddr, $httpForwardedFor, $trustedProxies)
{
@ -845,7 +838,7 @@ class RequestTest extends TestCase
}
/**
* @dataProvider testGetClientIpsForwardedProvider
* @dataProvider getClientIpsForwardedProvider
*/
public function testGetClientIpsForwarded($expected, $remoteAddr, $httpForwarded, $trustedProxies)
{
@ -856,7 +849,7 @@ class RequestTest extends TestCase
Request::setTrustedProxies(array());
}
public function testGetClientIpsForwardedProvider()
public function getClientIpsForwardedProvider()
{
// $expected $remoteAddr $httpForwarded $trustedProxies
return array(
@ -869,7 +862,7 @@ class RequestTest extends TestCase
);
}
public function testGetClientIpsProvider()
public function getClientIpsProvider()
{
// $expected $remoteAddr $httpForwardedFor $trustedProxies
return array(
@ -926,7 +919,7 @@ class RequestTest extends TestCase
/**
* @expectedException \Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException
* @dataProvider testGetClientIpsWithConflictingHeadersProvider
* @dataProvider getClientIpsWithConflictingHeadersProvider
*/
public function testGetClientIpsWithConflictingHeaders($httpForwarded, $httpXForwardedFor)
{
@ -945,7 +938,7 @@ class RequestTest extends TestCase
$request->getClientIps();
}
public function testGetClientIpsWithConflictingHeadersProvider()
public function getClientIpsWithConflictingHeadersProvider()
{
// $httpForwarded $httpXForwardedFor
return array(
@ -958,9 +951,9 @@ class RequestTest extends TestCase
}
/**
* @dataProvider testGetClientIpsWithAgreeingHeadersProvider
* @dataProvider getClientIpsWithAgreeingHeadersProvider
*/
public function testGetClientIpsWithAgreeingHeaders($httpForwarded, $httpXForwardedFor)
public function testGetClientIpsWithAgreeingHeaders($httpForwarded, $httpXForwardedFor, $expectedIps)
{
$request = new Request();
@ -974,21 +967,23 @@ class RequestTest extends TestCase
$request->initialize(array(), array(), array(), array(), array(), $server);
$request->getClientIps();
$clientIps = $request->getClientIps();
Request::setTrustedProxies(array());
$this->assertSame($expectedIps, $clientIps);
}
public function testGetClientIpsWithAgreeingHeadersProvider()
public function getClientIpsWithAgreeingHeadersProvider()
{
// $httpForwarded $httpXForwardedFor
return array(
array('for="192.0.2.60"', '192.0.2.60'),
array('for=192.0.2.60, for=87.65.43.21', '192.0.2.60,87.65.43.21'),
array('for="[::face]", for=192.0.2.60', '::face,192.0.2.60'),
array('for="192.0.2.60:80"', '192.0.2.60'),
array('for=192.0.2.60;proto=http;by=203.0.113.43', '192.0.2.60'),
array('for="[2001:db8:cafe::17]:4711"', '2001:db8:cafe::17'),
array('for="192.0.2.60"', '192.0.2.60', array('192.0.2.60')),
array('for=192.0.2.60, for=87.65.43.21', '192.0.2.60,87.65.43.21', array('87.65.43.21', '192.0.2.60')),
array('for="[::face]", for=192.0.2.60', '::face,192.0.2.60', array('192.0.2.60', '::face')),
array('for="192.0.2.60:80"', '192.0.2.60', array('192.0.2.60')),
array('for=192.0.2.60;proto=http;by=203.0.113.43', '192.0.2.60', array('192.0.2.60')),
array('for="[2001:db8:cafe::17]:4711"', '2001:db8:cafe::17', array('2001:db8:cafe::17')),
);
}

View File

@ -177,6 +177,8 @@ class SessionTest extends TestCase
{
$this->session->start();
$this->session->save();
$this->assertFalse($this->session->isStarted());
}
public function testGetId()

View File

@ -103,6 +103,9 @@ class MetadataBagTest extends TestCase
public function testClear()
{
$this->bag->clear();
// the clear method has no side effects, we just want to ensure it doesn't trigger any exceptions
$this->addToAssertionCount(1);
}
public function testSkipLastUsedUpdate()

View File

@ -51,10 +51,12 @@ class StreamedResponseTest extends TestCase
public function testPrepareWithHeadRequest()
{
$response = new StreamedResponse(function () { echo 'foo'; });
$response = new StreamedResponse(function () { echo 'foo'; }, 200, array('Content-Length' => '123'));
$request = Request::create('/', 'HEAD');
$response->prepare($request);
$this->assertSame('123', $response->headers->get('Content-Length'));
}
public function testPrepareWithCacheHeaders()

View File

@ -39,11 +39,20 @@ class BCryptPasswordEncoderTest extends TestCase
new BCryptPasswordEncoder(32);
}
public function testCostInRange()
/**
* @dataProvider validRangeData
*/
public function testCostInRange($cost)
{
for ($cost = 4; $cost <= 31; ++$cost) {
new BCryptPasswordEncoder($cost);
}
$this->assertInstanceOf('Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder', new BCryptPasswordEncoder($cost));
}
public function validRangeData()
{
$costs = range(4, 31);
array_walk($costs, function (&$cost) { $cost = array($cost); });
return $costs;
}
public function testResultLength()

View File

@ -88,7 +88,8 @@ class LegacySecurityContextTest extends TestCase
{
$authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
$accessDecisionManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface')->getMock();
new SecurityContext($authenticationManager, $accessDecisionManager);
$this->assertInstanceOf('Symfony\Component\Security\Core\SecurityContext', new SecurityContext($authenticationManager, $accessDecisionManager));
}
/**

View File

@ -100,6 +100,9 @@ class DigestDataTest extends TestCase
$this->assertEquals('"u\\ser"', $digestAuth->getUsername());
}
/**
* @group time-sensitive
*/
public function testValidateAndDecode()
{
$time = microtime(true);
@ -112,11 +115,11 @@ class DigestDataTest extends TestCase
'response="b52938fc9e6d7c01be7702ece9031b42"'
);
try {
$digestAuth->validateAndDecode($key, 'Welcome, robot!');
} catch (\Exception $e) {
$this->fail(sprintf('testValidateAndDecode fail with message: %s', $e->getMessage()));
}
$digestAuth->validateAndDecode($key, 'Welcome, robot!');
sleep(1);
$this->assertTrue($digestAuth->isNonceExpired());
}
public function testCalculateServerDigest()