Skip to content

Commit 3598105

Browse files
committed
Merge branch '3.0'
2 parents 243e59c + 8529f19 commit 3598105

File tree

12 files changed

+86
-67
lines changed

12 files changed

+86
-67
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,9 +721,8 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
721721
->in($dirs)
722722
;
723723

724-
$locales = array();
725724
foreach ($finder as $file) {
726-
list($domain, $locale, $format) = explode('.', $file->getBasename(), 3);
725+
list(, $locale) = explode('.', $file->getBasename(), 3);
727726
if (!isset($files[$locale])) {
728727
$files[$locale] = array();
729728
}

src/Symfony/Component/Form/DataTransformerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function transform($value);
5858
*
5959
* This method must be able to deal with empty values. Usually this will
6060
* be an empty string, but depending on your implementation other empty
61-
* values are possible as well (such as empty strings). The reasoning behind
61+
* values are possible as well (such as NULL). The reasoning behind
6262
* this is that value transformers must be chainable. If the
6363
* reverseTransform() method of the first value transformer outputs an
6464
* empty string, the second value transformer must be able to process that

src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -356,21 +356,6 @@ public function getBlockPrefix()
356356
return 'choice';
357357
}
358358

359-
private static function flipRecursive($choices, &$output = array())
360-
{
361-
foreach ($choices as $key => $value) {
362-
if (is_array($value)) {
363-
$output[$key] = array();
364-
self::flipRecursive($value, $output[$key]);
365-
continue;
366-
}
367-
368-
$output[$value] = $key;
369-
}
370-
371-
return $output;
372-
}
373-
374359
/**
375360
* Adds the sub fields for an expanded choice field.
376361
*
@@ -446,9 +431,7 @@ private function createChoiceListView(ChoiceListInterface $choiceList, array $op
446431
// If no explicit grouping information is given, use the structural
447432
// information from the "choices" option for creating groups
448433
if (!$options['group_by'] && $options['choices']) {
449-
$options['group_by'] = !$options['choices_as_values']
450-
? self::flipRecursive($options['choices'])
451-
: $options['choices'];
434+
$options['group_by'] = $options['choices'];
452435
}
453436

454437
return $this->choiceListFactory->createView(

src/Symfony/Component/Form/FormBuilderInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuild
2424
* object hierarchy.
2525
*
2626
* @param string|int|FormBuilderInterface $child
27-
* @param string|FormTypeInterface $type
27+
* @param string|null $type
2828
* @param array $options
2929
*
3030
* @return FormBuilderInterface The builder object.
@@ -34,9 +34,9 @@ public function add($child, $type = null, array $options = array());
3434
/**
3535
* Creates a form builder.
3636
*
37-
* @param string $name The name of the form or the name of the property
38-
* @param string|FormTypeInterface $type The type of the form or null if name is a property
39-
* @param array $options The options
37+
* @param string $name The name of the form or the name of the property
38+
* @param string|null $type The type of the form or null if name is a property
39+
* @param array $options The options
4040
*
4141
* @return FormBuilderInterface The created builder.
4242
*/

src/Symfony/Component/Form/Forms.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
* $formFactory = Forms::createFormFactory();
2525
*
2626
* $form = $formFactory->createBuilder()
27-
* ->add('firstName', 'text')
28-
* ->add('lastName', 'text')
29-
* ->add('age', 'integer')
30-
* ->add('gender', 'choice', array(
31-
* 'choices' => array('m' => 'Male', 'f' => 'Female'),
27+
* ->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
28+
* ->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
29+
* ->add('age', 'Symfony\Component\Form\Extension\Core\Type\IntegerType')
30+
* ->add('gender', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array(
31+
* 'choices' => array('Male' => 'm', 'Female' => 'f'),
3232
* ))
3333
* ->getForm();
3434
* </code>

src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,6 @@ public function testNoViolationIfAllowExtraData()
623623

624624
$context->expects($this->never())
625625
->method('addViolation');
626-
$context->expects($this->never())
627-
->method('addViolationAt');
628626

629627
$this->validator->initialize($context);
630628
$this->validator->validate($form, new Form());

src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorExtensionTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ public function test2Dot5ValidationApi()
3838
->method('addPropertyConstraint')
3939
->with('children', $this->isInstanceOf('Symfony\Component\Validator\Constraints\Valid'));
4040

41-
$validator
42-
->expects($this->never())
43-
->method('getMetadataFactory');
44-
4541
$extension = new ValidatorExtension($validator);
4642
$guesser = $extension->loadTypeGuesser();
4743

src/Symfony/Component/HttpKernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ public function testAutoloadMainExtension()
1919
{
2020
$container = $this->getMock(
2121
'Symfony\\Component\\DependencyInjection\\ContainerBuilder',
22-
array('getExtensionConfig', 'loadFromExtension', 'getParameterBag')
22+
array(
23+
'getExtensionConfig',
24+
'loadFromExtension',
25+
'getParameterBag',
26+
'getDefinitions',
27+
'getAliases',
28+
'getExtensions',
29+
)
2330
);
2431
$params = $this->getMock('Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBag');
2532

src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ public function testSubRequestWithDifferentMethod()
111111
->will($this->returnValue(array()));
112112

113113
$context = new RequestContext();
114-
$requestMatcher->expects($this->any())
115-
->method('getContext')
116-
->will($this->returnValue($context));
117114

118115
$listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext());
119116
$listener->onKernelRequest($event);

src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\HttpKernel\HttpCache\HttpCache;
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpFoundation\Response;
17+
use Symfony\Component\HttpKernel\HttpKernelInterface;
1718

1819
/**
1920
* @group time-sensitive
@@ -27,15 +28,11 @@ public function testTerminateDelegatesTerminationOnlyForTerminableInterface()
2728
->getMock();
2829

2930
// does not implement TerminableInterface
30-
$kernelMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\HttpKernelInterface')
31-
->disableOriginalConstructor()
32-
->getMock();
33-
34-
$kernelMock->expects($this->never())
35-
->method('terminate');
31+
$kernel = new TestKernel();
32+
$httpCache = new HttpCache($kernel, $storeMock);
33+
$httpCache->terminate(Request::create('/'), new Response());
3634

37-
$kernel = new HttpCache($kernelMock, $storeMock);
38-
$kernel->terminate(Request::create('/'), new Response());
35+
$this->assertFalse($kernel->terminateCalled, 'terminate() is never called if the kernel class does not implement TerminableInterface');
3936

4037
// implements TerminableInterface
4138
$kernelMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Kernel')
@@ -1225,3 +1222,17 @@ public function testEsiCacheRemoveValidationHeadersIfEmbeddedResponses()
12251222
$this->assertNull($this->response->getLastModified());
12261223
}
12271224
}
1225+
1226+
class TestKernel implements HttpKernelInterface
1227+
{
1228+
public $terminateCalled = false;
1229+
1230+
public function terminate(Request $request, Response $response)
1231+
{
1232+
$this->terminateCalled = true;
1233+
}
1234+
1235+
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
1236+
{
1237+
}
1238+
}

0 commit comments

Comments
 (0)