8000 Merge branch '2.8' into 3.0 · l-vo/symfony@667ad70 · GitHub
[go: up one dir, main page]

Skip to content

Commit 667ad70

Browse files
Merge branch '2.8' into 3.0
* 2.8: [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/Finder/Tests/Shell/CommandTest.php
2 parents a84ea7a + af47008 commit 667ad70

File tree

37 files changed

+166
-52
lines changed

37 files changed

+166
-52
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
@@ -111,7 +111,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
111111
* @param string[] $managerParameters List of container parameters that could
112112
* hold the manager name.
113113
* @param string $driverPattern Pattern for the metadata driver service name
114-
* @param string $enabledParameter Service container parameter that must be
114+
* @param string|false $enabledParameter Service container parameter that must be
115115
* present to enable the mapping. Set to false
116116
* to not do any check, optional.
117117
* @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
@@ -45,7 +45,7 @@ protected function listBundles($output)
4545
} else {
4646
$output->writeln('Available registered bundles with their extension alias if available:');
4747
$table = new Table($output);
48-
$table->setHeaders($headers)->setRows($rows)->render($output);
48+
$table->setHeaders($headers)->setRows($rows)->render();
4949
}
5050
}
5151

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

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

806806
if (is_dir($dir = $dirname.'/Resources/config/validation')) {
807807
foreach (Finder::create()->files()->in($dir)->name('*.xml') as $file) {
808-
$files[0][] = $file->getRealpath();
808+
$files[0][] = $file->getRealPath();
809809
}
810810
foreach (Finder::create()->files()->in($dir)->name('*.yml') as $file) {
811-
$files[1][] = $file->getRealpath();
811+
$files[1][] = $file->getRealPath();
812812
}
813813

814814
$container->addResource(new DirectoryResource($dir));
@@ -926,13 +926,13 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
926926

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

932932
$serializerLoaders[] = $definition;
933933
}
934934
foreach (Finder::create()->files()->in($dir)->name('*.yml') as $file) {
935-
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader', array($file->getRealpath()));
935+
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader', array($file->getRealPath()));
936936
$definition->setPublic(false);
937937

938938
$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< 8000 code class="diff-text syntax-highlighted-line">
}
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)
0