Skip to content

Commit 194dcf3

Browse files
Merge branch '3.1'
* 3.1: [Console] Application update PHPDoc of add and register methods [Config] Extra tests for Config component Fixed bugs in names of classes and methods. [DoctrineBridge] Fixed php doc [FrameworkBundle] Fixed parameters number mismatch declaration [BrowserKit] Added test for followRedirect method (POST method) Fix the money form type render with Bootstrap3 [BrowserKit] Uppercase the "GET" method in redirects [DomCrawler] Inherit the namespace cache in subcrawlers [WebProfilerBundle] Fixed JSDoc parameter definition [HttpFoundation] HttpCache refresh stale responses containing an ETag Conflicts: src/Symfony/Component/Console/Application.php
2 parents 695549f + 54043a0 commit 194dcf3

File tree

38 files changed

+167
-53
lines changed

38 files changed

+167
-53
lines changed

src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,10 @@ protected function loadObjectManagerCacheDriver(array $objectManager, ContainerB
314314
/**
315315
* Loads a cache driver.
316316
*
317-
* @param string $cacheDriverServiceId The cache driver name
318-
* @param string $objectManagerName The object manager name
319-
* @param array $cacheDriver The cache driver mapping
320-
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container The ContainerBuilder instance
317+
* @param string $cacheName The cache driver name
318+
* @param string $objectManagerName The object manager name
319+
* @param array $cacheDriver The cache driver mapping
320+
* @param ContainerBuilder $container The ContainerBuilder instance
321321
*
322322
* @return string
323323
*

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
110110
* @param string[] $managerParameters List of container parameters that could
111111
* hold the manager name.
112112
* @param string $driverPattern Pattern for the metadata driver service name
113-
* @param string $enabledParameter Service container parameter that must be
113+
* @param string|false $enabledParameter Service container parameter that must be
114114
* present to enable the mapping. Set to false
115115
* to not do any check, optional.
116116
* @param string $configurationPattern Pattern for the Configuration service name

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121

2222
{% block money_widget -%}
2323
<div class="input-group">
24-
{% set prepend = '{{' == money_pattern[0:2] %}
25-
{% if not prepend %}
24+
{% set append = money_pattern starts with '{{' %}
25+
{% if not append %}
2626
<span class="input-group-addon">{{ money_pattern|replace({ '{{ widget }}':''}) }}</span>
2727
{% endif %}
2828
{{- block('form_widget_simple') -}}
29-
{% if prepend %}
29+
{% if append %}
3030
<span class="input-group-addon">{{ money_pattern|replace({ '{{ widget }}':''}) }}</span>
3131
{% endif %}
3232
</div>

src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected function listBundles($output)
4747
} else {
4848
$output->writeln($title);
4949
$table = new Table($output);
50-
$table->setHeaders($headers)->setRows($rows)->render($output);
50+
$table->setHeaders($headers)->setRows($rows)->render();
5151
}
5252
}
5353

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -888,10 +888,10 @@ private function getValidatorMappingFiles(ContainerBuilder $container)
888888

889889
if (is_dir($dir = $dirname.'/Resources/config/validation')) {
890890
foreach (Finder::create()->files()->in($dir)->name('*.xml') as $file) {
891-
$files[0][] = $file->getRealpath();
891+
$files[0][] = $file->getRealPath();
892892
}
893893
foreach (Finder::create()->files()->in($dir)->name('*.yml') as $file) {
894-
$files[1][] = $file->getRealpath();
894+
$files[1][] = $file->getRealPath();
895895
}
896896

897897
$container->addResource(new DirectoryResource($dir));
@@ -1027,13 +1027,13 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
10271027

10281028
if (is_dir($dir = $dirname.'/Resources/config/serialization')) {
10291029
foreach (Finder::create()->files()->in($dir)->name('*.xml') as $file) {
1030-
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader', array($file->getRealpath()));
1030+
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader', array($file->getRealPath()));
10311031
$definition->setPublic(false);
10321032

10331033
$serializerLoaders[] = $definition;
10341034
}
10351035
foreach (Finder::create()->files()->in($dir)->name('*.yml') as $file) {
1036-
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader', array($file->getRealpath()));
1036+
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader', array($file->getRealPath()));
10371037
$definition->setPublic(false);
10381038

10391039
$serializerLoaders[] = $definition;

src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function testGetExistingEngine()
3838

3939
$delegatingEngine = new DelegatingEngine($container, array('engine.first', 'engine.second'));
4040

41-
$this->assertSame($secondEngine, $delegatingEngine->getEngine('template.php', array('foo' => 'bar')));
41+
$this->assertSame($secondEngine, $delegatingEngine->getEngine('template.php'));
4242
}
4343

4444
/**
@@ -55,7 +55,7 @@ public function testGetInvalidEngine()
5555
));
5656

5757
$delegatingEngine = new DelegatingEngine($container, array('engine.first', 'engine.second'));
58-
$delegatingEngine->getEngine('template.php', array('foo' => 'bar'));
58+
$delegatingEngine->getEngine('template.php');
5959
}
6060

6161
public function testRenderResponseWithFrameworkEngine()

src/Symfony/Bundle/FrameworkBundle/Translation/TranslationLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function loadMessages($directory, MessageCatalogue $catalogue)
5858
$extension = $catalogue->getLocale().'.'.$format;
5959
$files = $finder->files()->name('*.'.$extension)->in($directory);
6060
foreach ($files as $file) {
61-
$domain = substr($file->getFileName(), 0, -1 * strlen($extension) - 1);
61+
$domain = substr($file->getFilename(), 0, -1 * strlen($extension) - 1);
6262
$catalogue->addCatalogue($loader->load($file->getPathname(), $catalogue->getLocale(), $domain));
6363
}
6464
}

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
/**
161161
* Query an element with a CSS selector.
162162
*
163-
* @param string selector a CSS-selector-compatible query string
163+
* @param {string} selector - a CSS-selector-compatible query string
164164
*
165165
* @return DOMElement|null
166166
*/

src/Symfony/Component/BrowserKit/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ public function followRedirect()
475475
$request = $this->internalRequest;
476476

477477
if (in_array($this->internalResponse->getStatus(), array(302, 303))) {
478-
$method = 'get';
478+
$method = 'GET';
479479
$files = array();
480480
$content = null;
481481
} else {
@@ -484,7 +484,7 @@ public function followRedirect()
484484
$content = $request->getContent();
485485
}
486486

487-
if ('get' === strtolower($method)) {
487+
if ('GET' === strtoupper($method)) {
488488
// Don't forward parameters for GET request as it should reach the redirection URI
489489
$parameters = array();
490490
} else {

src/Symfony/Component/BrowserKit/Tests/ClientTest.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ public function testFollowRedirectWithMaxRedirects()
410410
$client->setNextResponse(new Response('', 302, array('Location' => 'http://www.example.com/redirected')));
411411
$client->request('POST', 'http://www.example.com/foo/foobar', array('name' => 'bar'));
412412

413-
$this->assertEquals('get', $client->getRequest()->getMethod(), '->followRedirect() uses a get for 302');
413+
$this->assertEquals('GET', $client->getRequest()->getMethod(), '->followRedirect() uses a GET for 302');
414414
$this->assertEquals(array(), $client->getRequest()->getParameters(), '->followRedirect() does not submit parameters when changing the method');
415415
}
416416

@@ -489,6 +489,26 @@ public function testGetMaxRedirects()
489489
$this->assertEquals(3, $client->getMaxRedirects(), '->getMaxRedirects() returns assigned value');
490490
}
491491

492+
public function testFollowRedirectWithPostMethod()
493+
{
494+
$parameters = array('foo' => 'bar');
495+
$files = array('myfile.foo' => 'baz');
496+
$server = array('X_TEST_FOO' => 'bazbar');
497+
$content = 'foobarbaz';
498+
499+
$client = new TestClient();
500+
501+
$client->setNextResponse(new Response('', 307, array('Location' => 'http://www.example.com/redirected')));
502+
$client->request('POST', 'http://www.example.com/foo/foobar', $parameters, $files, $server, $content);
503+
504+
$this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect with POST method');
505+
$this->assertArrayHasKey('foo', $client->getRequest()->getParameters(), '->followRedirect() keeps parameters with POST method');
506+
$this->assertArrayHasKey('myfile.foo', $client->getRequest()->getFiles(), '->followRedirect() keeps files with POST method');
507+
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->followRedirect() keeps $_SERVER with POST method');
508+
$this->assertEquals($content, $client->getRequest()->getContent(), '->followRedirect() keeps content with POST method');
509+
$this->assertEquals('POST', $client->getRequest()->getMethod(), '->followRedirect() keeps request method');
510+
}
511+
492512
public function testBack()
493513
{
494514
$client = new TestClient();

0 commit comments

Comments
 (0)