Merge branch '2.8' into 3.4
* 2.8: Fix CS Allow reuse of Session between requests Provide debug_backtrace with proper args forward false label option to nested types forward the invalid_message option in date types
This commit is contained in:
commit
0218507b06
@ -112,7 +112,7 @@ class DeprecationErrorHandler
|
|||||||
return $ErrorHandler::handleError($type, $msg, $file, $line, $context);
|
return $ErrorHandler::handleError($type, $msg, $file, $line, $context);
|
||||||
}
|
}
|
||||||
|
|
||||||
$trace = debug_backtrace(true);
|
$trace = debug_backtrace();
|
||||||
$group = 'other';
|
$group = 'other';
|
||||||
$isVendor = DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && $inVendors($file);
|
$isVendor = DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && $inVendors($file);
|
||||||
|
|
||||||
|
@ -173,8 +173,8 @@ abstract class CompleteConfigurationTest extends TestCase
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
array(
|
array(
|
||||||
'simple_form',
|
'simple_form',
|
||||||
'anonymous',
|
'anonymous',
|
||||||
),
|
),
|
||||||
null,
|
null,
|
||||||
),
|
),
|
||||||
|
@ -64,10 +64,10 @@ class UndefinedMethodFatalErrorHandlerTest extends TestCase
|
|||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
'message' => 'Call to undefined method class@anonymous::test()',
|
'message' => 'Call to undefined method class@anonymous::test()',
|
||||||
'file' => '/home/possum/work/symfony/test.php',
|
'file' => '/home/possum/work/symfony/test.php',
|
||||||
'line' => 11,
|
'line' => 11,
|
||||||
),
|
),
|
||||||
'Attempted to call an undefined method named "test" of class "class@anonymous".',
|
'Attempted to call an undefined method named "test" of class "class@anonymous".',
|
||||||
),
|
),
|
||||||
|
@ -390,8 +390,8 @@ class PhpDumperTest extends TestCase
|
|||||||
$container->compile(true);
|
$container->compile(true);
|
||||||
|
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'env(foo)' => 'd29ybGQ=',
|
'env(foo)' => 'd29ybGQ=',
|
||||||
'hello' => 'world',
|
'hello' => 'world',
|
||||||
);
|
);
|
||||||
$this->assertSame($expected, $container->getParameterBag()->all());
|
$this->assertSame($expected, $container->getParameterBag()->all());
|
||||||
}
|
}
|
||||||
|
@ -948,12 +948,12 @@ class FormTest extends TestCase
|
|||||||
{
|
{
|
||||||
$dom = new \DOMDocument();
|
$dom = new \DOMDocument();
|
||||||
$dom->loadHTML('
|
$dom->loadHTML('
|
||||||
<html>
|
<html>
|
||||||
<form>
|
<form>
|
||||||
<textarea name="example"></textarea>
|
<textarea name="example"></textarea>
|
||||||
</form>
|
</form>
|
||||||
</html>
|
</html>'
|
||||||
');
|
);
|
||||||
|
|
||||||
$nodes = $dom->getElementsByTagName('form');
|
$nodes = $dom->getElementsByTagName('form');
|
||||||
$form = new Form($nodes->item(0), 'http://example.com');
|
$form = new Form($nodes->item(0), 'http://example.com');
|
||||||
|
@ -29,12 +29,12 @@ class MockSplFileInfo extends \SplFileInfo
|
|||||||
parent::__construct($param);
|
parent::__construct($param);
|
||||||
} elseif (\is_array($param)) {
|
} elseif (\is_array($param)) {
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'name' => 'file.txt',
|
'name' => 'file.txt',
|
||||||
'contents' => null,
|
'contents' => null,
|
||||||
'mode' => null,
|
'mode' => null,
|
||||||
'type' => null,
|
'type' => null,
|
||||||
'relativePath' => null,
|
'relativePath' => null,
|
||||||
'relativePathname' => null,
|
'relativePathname' => null,
|
||||||
);
|
);
|
||||||
$defaults = array_merge($defaults, $param);
|
$defaults = array_merge($defaults, $param);
|
||||||
parent::__construct($defaults['name']);
|
parent::__construct($defaults['name']);
|
||||||
|
@ -119,6 +119,11 @@ class DateTimeType extends AbstractType
|
|||||||
'invalid_message_parameters',
|
'invalid_message_parameters',
|
||||||
)));
|
)));
|
||||||
|
|
||||||
|
if (false === $options['label']) {
|
||||||
|
$dateOptions['label'] = false;
|
||||||
|
$timeOptions['label'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (null !== $options['date_widget']) {
|
if (null !== $options['date_widget']) {
|
||||||
$dateOptions['widget'] = $options['date_widget'];
|
$dateOptions['widget'] = $options['date_widget'];
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,18 @@ class DateType extends AbstractType
|
|||||||
'error_bubbling' => true,
|
'error_bubbling' => true,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (isset($options['invalid_message'])) {
|
||||||
|
$dayOptions['invalid_message'] = $options['invalid_message'];
|
||||||
|
$monthOptions['invalid_message'] = $options['invalid_message'];
|
||||||
|
$yearOptions['invalid_message'] = $options['invalid_message'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($options['invalid_message_parameters'])) {
|
||||||
|
$dayOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
|
||||||
|
$monthOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
|
||||||
|
$yearOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
|
||||||
|
}
|
||||||
|
|
||||||
$formatter = new \IntlDateFormatter(
|
$formatter = new \IntlDateFormatter(
|
||||||
\Locale::getDefault(),
|
\Locale::getDefault(),
|
||||||
$dateFormat,
|
$dateFormat,
|
||||||
|
@ -72,6 +72,18 @@ class TimeType extends AbstractType
|
|||||||
'error_bubbling' => true,
|
'error_bubbling' => true,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (isset($options['invalid_message'])) {
|
||||||
|
$hourOptions['invalid_message'] = $options['invalid_message'];
|
||||||
|
$minuteOptions['invalid_message'] = $options['invalid_message'];
|
||||||
|
$secondOptions['invalid_message'] = $options['invalid_message'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($options['invalid_message_parameters'])) {
|
||||||
|
$hourOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
|
||||||
|
$minuteOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
|
||||||
|
$secondOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
|
||||||
|
}
|
||||||
|
|
||||||
if ('choice' === $options['widget']) {
|
if ('choice' === $options['widget']) {
|
||||||
$hours = $minutes = array();
|
$hours = $minutes = array();
|
||||||
|
|
||||||
|
@ -209,7 +209,9 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
|
|||||||
*/
|
*/
|
||||||
public function setId($id)
|
public function setId($id)
|
||||||
{
|
{
|
||||||
$this->storage->setId($id);
|
if ($this->storage->getId() !== $id) {
|
||||||
|
$this->storage->setId($id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,6 +70,27 @@ class SessionTest extends TestCase
|
|||||||
$this->assertEquals('0123456789abcdef', $this->session->getId());
|
$this->assertEquals('0123456789abcdef', $this->session->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSetIdAfterStart()
|
||||||
|
{
|
||||||
|
$this->session->start();
|
||||||
|
$id = $this->session->getId();
|
||||||
|
|
||||||
|
$e = null;
|
||||||
|
try {
|
||||||
|
$this->session->setId($id);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertNull($e);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->session->setId('different');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertInstanceOf('\LogicException', $e);
|
||||||
|
}
|
||||||
|
|
||||||
public function testSetName()
|
public function testSetName()
|
||||||
{
|
{
|
||||||
$this->assertEquals('MOCKSESSID', $this->session->getName());
|
$this->assertEquals('MOCKSESSID', $this->session->getName());
|
||||||
|
@ -48,7 +48,7 @@ class MockArraySessionStorageTest extends TestCase
|
|||||||
$this->data = array(
|
$this->data = array(
|
||||||
$this->attributes->getStorageKey() => array('foo' => 'bar'),
|
$this->attributes->getStorageKey() => array('foo' => 'bar'),
|
||||||
$this->flashes->getStorageKey() => array('notice' => 'hello'),
|
$this->flashes->getStorageKey() => array('notice' => 'hello'),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->storage = new MockArraySessionStorage();
|
$this->storage = new MockArraySessionStorage();
|
||||||
$this->storage->registerBag($this->flashes);
|
$this->storage->registerBag($this->flashes);
|
||||||
|
@ -189,8 +189,8 @@ XML;
|
|||||||
public function testEncodeScalarRootAttributes()
|
public function testEncodeScalarRootAttributes()
|
||||||
{
|
{
|
||||||
$array = array(
|
$array = array(
|
||||||
'#' => 'Paul',
|
'#' => 'Paul',
|
||||||
'@gender' => 'm',
|
'@gender' => 'm',
|
||||||
);
|
);
|
||||||
|
|
||||||
$expected = '<?xml version="1.0"?>'."\n".
|
$expected = '<?xml version="1.0"?>'."\n".
|
||||||
@ -202,8 +202,8 @@ XML;
|
|||||||
public function testEncodeRootAttributes()
|
public function testEncodeRootAttributes()
|
||||||
{
|
{
|
||||||
$array = array(
|
$array = array(
|
||||||
'firstname' => 'Paul',
|
'firstname' => 'Paul',
|
||||||
'@gender' => 'm',
|
'@gender' => 'm',
|
||||||
);
|
);
|
||||||
|
|
||||||
$expected = '<?xml version="1.0"?>'."\n".
|
$expected = '<?xml version="1.0"?>'."\n".
|
||||||
@ -215,7 +215,7 @@ XML;
|
|||||||
public function testEncodeCdataWrapping()
|
public function testEncodeCdataWrapping()
|
||||||
{
|
{
|
||||||
$array = array(
|
$array = array(
|
||||||
'firstname' => 'Paul <or Me>',
|
'firstname' => 'Paul <or Me>',
|
||||||
);
|
);
|
||||||
|
|
||||||
$expected = '<?xml version="1.0"?>'."\n".
|
$expected = '<?xml version="1.0"?>'."\n".
|
||||||
|
@ -75,8 +75,7 @@ class PropertyNormalizerTest extends TestCase
|
|||||||
$group->setKevin('Kevin');
|
$group->setKevin('Kevin');
|
||||||
$group->setCoopTilleuls('coop');
|
$group->setCoopTilleuls('coop');
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array('foo' => 'foo', 'bar' => 'bar', 'kevin' => 'Kevin',
|
array('foo' => 'foo', 'bar' => 'bar', 'kevin' => 'Kevin', 'coopTilleuls' => 'coop', 'fooBar' => null, 'symfony' => null, 'baz' => 'baz'),
|
||||||
'coopTilleuls' => 'coop', 'fooBar' => null, 'symfony' => null, 'baz' => 'baz', ),
|
|
||||||
$this->normalizer->normalize($group, 'any')
|
$this->normalizer->normalize($group, 'any')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -42,85 +42,85 @@ class TranslationDataCollectorTest extends TestCase
|
|||||||
{
|
{
|
||||||
$collectedMessages = array(
|
$collectedMessages = array(
|
||||||
array(
|
array(
|
||||||
'id' => 'foo',
|
'id' => 'foo',
|
||||||
'translation' => 'foo (en)',
|
'translation' => 'foo (en)',
|
||||||
'locale' => 'en',
|
'locale' => 'en',
|
||||||
'domain' => 'messages',
|
'domain' => 'messages',
|
||||||
'state' => DataCollectorTranslator::MESSAGE_DEFINED,
|
'state' => DataCollectorTranslator::MESSAGE_DEFINED,
|
||||||
'parameters' => array(),
|
'parameters' => array(),
|
||||||
'transChoiceNumber' => null,
|
'transChoiceNumber' => null,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'bar',
|
'id' => 'bar',
|
||||||
'translation' => 'bar (fr)',
|
'translation' => 'bar (fr)',
|
||||||
'locale' => 'fr',
|
'locale' => 'fr',
|
||||||
'domain' => 'messages',
|
'domain' => 'messages',
|
||||||
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
|
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
|
||||||
'parameters' => array(),
|
'parameters' => array(),
|
||||||
'transChoiceNumber' => null,
|
'transChoiceNumber' => null,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'choice',
|
'id' => 'choice',
|
||||||
'translation' => 'choice',
|
'translation' => 'choice',
|
||||||
'locale' => 'en',
|
'locale' => 'en',
|
||||||
'domain' => 'messages',
|
'domain' => 'messages',
|
||||||
'state' => DataCollectorTranslator::MESSAGE_MISSING,
|
'state' => DataCollectorTranslator::MESSAGE_MISSING,
|
||||||
'parameters' => array('%count%' => 3),
|
'parameters' => array('%count%' => 3),
|
||||||
'transChoiceNumber' => 3,
|
'transChoiceNumber' => 3,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'choice',
|
'id' => 'choice',
|
||||||
'translation' => 'choice',
|
'translation' => 'choice',
|
||||||
'locale' => 'en',
|
'locale' => 'en',
|
||||||
'domain' => 'messages',
|
'domain' => 'messages',
|
||||||
'state' => DataCollectorTranslator::MESSAGE_MISSING,
|
'state' => DataCollectorTranslator::MESSAGE_MISSING,
|
||||||
'parameters' => array('%count%' => 3),
|
'parameters' => array('%count%' => 3),
|
||||||
'transChoiceNumber' => 3,
|
'transChoiceNumber' => 3,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'choice',
|
'id' => 'choice',
|
||||||
'translation' => 'choice',
|
'translation' => 'choice',
|
||||||
'locale' => 'en',
|
'locale' => 'en',
|
||||||
'domain' => 'messages',
|
'domain' => 'messages',
|
||||||
'state' => DataCollectorTranslator::MESSAGE_MISSING,
|
'state' => DataCollectorTranslator::MESSAGE_MISSING,
|
||||||
'parameters' => array('%count%' => 4, '%foo%' => 'bar'),
|
'parameters' => array('%count%' => 4, '%foo%' => 'bar'),
|
||||||
'transChoiceNumber' => 4,
|
'transChoiceNumber' => 4,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
$expectedMessages = array(
|
$expectedMessages = array(
|
||||||
array(
|
array(
|
||||||
'id' => 'foo',
|
'id' => 'foo',
|
||||||
'translation' => 'foo (en)',
|
'translation' => 'foo (en)',
|
||||||
'locale' => 'en',
|
'locale' => 'en',
|
||||||
'domain' => 'messages',
|
'domain' => 'messages',
|
||||||
'state' => DataCollectorTranslator::MESSAGE_DEFINED,
|
'state' => DataCollectorTranslator::MESSAGE_DEFINED,
|
||||||
'count' => 1,
|
'count' => 1,
|
||||||
'parameters' => array(),
|
'parameters' => array(),
|
||||||
'transChoiceNumber' => null,
|
'transChoiceNumber' => null,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'bar',
|
'id' => 'bar',
|
||||||
'translation' => 'bar (fr)',
|
'translation' => 'bar (fr)',
|
||||||
'locale' => 'fr',
|
'locale' => 'fr',
|
||||||
'domain' => 'messages',
|
'domain' => 'messages',
|
||||||
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
|
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
|
||||||
'count' => 1,
|
'count' => 1,
|
||||||
'parameters' => array(),
|
'parameters' => array(),
|
||||||
'transChoiceNumber' => null,
|
'transChoiceNumber' => null,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'choice',
|
'id' => 'choice',
|
||||||
'translation' => 'choice',
|
'translation' => 'choice',
|
||||||
'locale' => 'en',
|
'locale' => 'en',
|
||||||
'domain' => 'messages',
|
'domain' => 'messages',
|
||||||
'state' => DataCollectorTranslator::MESSAGE_MISSING,
|
'state' => DataCollectorTranslator::MESSAGE_MISSING,
|
||||||
'count' => 3,
|
'count' => 3,
|
||||||
'parameters' => array(
|
'parameters' => array(
|
||||||
array('%count%' => 3),
|
array('%count%' => 3),
|
||||||
array('%count%' => 3),
|
array('%count%' => 3),
|
||||||
array('%count%' => 4, '%foo%' => 'bar'),
|
array('%count%' => 4, '%foo%' => 'bar'),
|
||||||
),
|
),
|
||||||
'transChoiceNumber' => 3,
|
'transChoiceNumber' => 3,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -31,49 +31,49 @@ class DataCollectorTranslatorTest extends TestCase
|
|||||||
|
|
||||||
$expectedMessages = array();
|
$expectedMessages = array();
|
||||||
$expectedMessages[] = array(
|
$expectedMessages[] = array(
|
||||||
'id' => 'foo',
|
'id' => 'foo',
|
||||||
'translation' => 'foo (en)',
|
'translation' => 'foo (en)',
|
||||||
'locale' => 'en',
|
'locale' => 'en',
|
||||||
'domain' => 'messages',
|
'domain' => 'messages',
|
||||||
'state' => DataCollectorTranslator::MESSAGE_DEFINED,
|
'state' => DataCollectorTranslator::MESSAGE_DEFINED,
|
||||||
'parameters' => array(),
|
'parameters' => array(),
|
||||||
'transChoiceNumber' => null,
|
'transChoiceNumber' => null,
|
||||||
);
|
);
|
||||||
$expectedMessages[] = array(
|
$expectedMessages[] = array(
|
||||||
'id' => 'bar',
|
'id' => 'bar',
|
||||||
'translation' => 'bar (fr)',
|
'translation' => 'bar (fr)',
|
||||||
'locale' => 'fr',
|
'locale' => 'fr',
|
||||||
'domain' => 'messages',
|
'domain' => 'messages',
|
||||||
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
|
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
|
||||||
'parameters' => array(),
|
'parameters' => array(),
|
||||||
'transChoiceNumber' => null,
|
'transChoiceNumber' => null,
|
||||||
);
|
);
|
||||||
$expectedMessages[] = array(
|
$expectedMessages[] = array(
|
||||||
'id' => 'choice',
|
'id' => 'choice',
|
||||||
'translation' => 'choice',
|
'translation' => 'choice',
|
||||||
'locale' => 'en',
|
'locale' => 'en',
|
||||||
'domain' => 'messages',
|
'domain' => 'messages',
|
||||||
'state' => DataCollectorTranslator::MESSAGE_MISSING,
|
'state' => DataCollectorTranslator::MESSAGE_MISSING,
|
||||||
'parameters' => array(),
|
'parameters' => array(),
|
||||||
'transChoiceNumber' => 0,
|
'transChoiceNumber' => 0,
|
||||||
);
|
);
|
||||||
$expectedMessages[] = array(
|
$expectedMessages[] = array(
|
||||||
'id' => 'bar_ru',
|
'id' => 'bar_ru',
|
||||||
'translation' => 'bar (ru)',
|
'translation' => 'bar (ru)',
|
||||||
'locale' => 'ru',
|
'locale' => 'ru',
|
||||||
'domain' => 'messages',
|
'domain' => 'messages',
|
||||||
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
|
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
|
||||||
'parameters' => array(),
|
'parameters' => array(),
|
||||||
'transChoiceNumber' => null,
|
'transChoiceNumber' => null,
|
||||||
);
|
);
|
||||||
$expectedMessages[] = array(
|
$expectedMessages[] = array(
|
||||||
'id' => 'bar_ru',
|
'id' => 'bar_ru',
|
||||||
'translation' => 'bar (ru)',
|
'translation' => 'bar (ru)',
|
||||||
'locale' => 'ru',
|
'locale' => 'ru',
|
||||||
'domain' => 'messages',
|
'domain' => 'messages',
|
||||||
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
|
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
|
||||||
'parameters' => array('foo' => 'bar'),
|
'parameters' => array('foo' => 'bar'),
|
||||||
'transChoiceNumber' => null,
|
'transChoiceNumber' => null,
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals($expectedMessages, $collector->getCollectedMessages());
|
$this->assertEquals($expectedMessages, $collector->getCollectedMessages());
|
||||||
|
Reference in New Issue
Block a user