Merge branch '3.2'

* 3.2:
  [Routing] Mention minor BC break about UrlGenerator & query strings
  fixed composer.json
  fixed composer.json
  Skip test when iconv extension is missing
  Fix upgrade notes
  [Config] fix dev dependencies
  Fix bundle commands are not available via find()
This commit is contained in:
Fabien Potencier 2016-12-10 15:25:01 +01:00
commit 51bc35cc84
4 changed files with 49 additions and 21 deletions

View File

@ -70,7 +70,6 @@ FrameworkBundle
in TwigBundle). in TwigBundle).
* The service `serializer.mapping.cache.doctrine.apc` is deprecated. APCu should now * The service `serializer.mapping.cache.doctrine.apc` is deprecated. APCu should now
be automatically used when available. be automatically used when available.
```
HttpFoundation HttpFoundation
--------------- ---------------
@ -111,6 +110,13 @@ HttpKernel
After: After:
``` ```
Surrogate-Capability: symfony="ESI/1.0" Surrogate-Capability: symfony="ESI/1.0"
```
Router
------
* `UrlGenerator` now generates URLs in compliance with [`RFC 3986`](https://www.ietf.org/rfc/rfc3986.txt),
which means spaces will be percent encoded (%20) inside query strings.
Serializer Serializer
---------- ----------

View File

@ -80,6 +80,16 @@ class Application extends BaseApplication
return parent::doRun($input, $output); return parent::doRun($input, $output);
} }
/**
* {@inheritdoc}
*/
public function find($name)
{
$this->registerCommands();
return parent::find($name);
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

View File

@ -32,8 +32,7 @@ class ApplicationTest extends TestCase
public function testBundleCommandsAreRegistered() public function testBundleCommandsAreRegistered()
{ {
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle'); $bundle = $this->createBundleMock(array());
$bundle->expects($this->once())->method('registerCommands');
$kernel = $this->getKernel(array($bundle), true); $kernel = $this->getKernel(array($bundle), true);
@ -46,8 +45,7 @@ class ApplicationTest extends TestCase
public function testBundleCommandsAreRetrievable() public function testBundleCommandsAreRetrievable()
{ {
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle'); $bundle = $this->createBundleMock(array());
$bundle->expects($this->once())->method('registerCommands');
$kernel = $this->getKernel(array($bundle)); $kernel = $this->getKernel(array($bundle));
@ -60,47 +58,41 @@ class ApplicationTest extends TestCase
public function testBundleSingleCommandIsRetrievable() public function testBundleSingleCommandIsRetrievable()
{ {
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle'); $command = new Command('example');
$bundle->expects($this->once())->method('registerCommands');
$bundle = $this->createBundleMock(array($command));
$kernel = $this->getKernel(array($bundle)); $kernel = $this->getKernel(array($bundle));
$application = new Application($kernel); $application = new Application($kernel);
$command = new Command('example');
$application->add($command);
$this->assertSame($command, $application->get('example')); $this->assertSame($command, $application->get('example'));
} }
public function testBundleCommandCanBeFound() public function testBundleCommandCanBeFound()
{ {
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle'); $command = new Command('example');
$bundle->expects($this->once())->method('registerCommands');
$bundle = $this->createBundleMock(array($command));
$kernel = $this->getKernel(array($bundle)); $kernel = $this->getKernel(array($bundle));
$application = new Application($kernel); $application = new Application($kernel);
$command = new Command('example');
$application->add($command);
$this->assertSame($command, $application->find('example')); $this->assertSame($command, $application->find('example'));
} }
public function testBundleCommandCanBeFoundByAlias() public function testBundleCommandCanBeFoundByAlias()
{ {
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle'); $command = new Command('example');
$bundle->expects($this->once())->method('registerCommands'); $command->setAliases(array('alias'));
$bundle = $this->createBundleMock(array($command));
$kernel = $this->getKernel(array($bundle)); $kernel = $this->getKernel(array($bundle));
$application = new Application($kernel); $application = new Application($kernel);
$command = new Command('example');
$command->setAliases(array('alias'));
$application->add($command);
$this->assertSame($command, $application->find('alias')); $this->assertSame($command, $application->find('alias'));
} }
@ -167,4 +159,18 @@ class ApplicationTest extends TestCase
return $kernel; return $kernel;
} }
private function createBundleMock(array $commands)
{
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
$bundle
->expects($this->once())
->method('registerCommands')
->will($this->returnCallback(function (Application $application) use ($commands) {
$application->addCommands($commands);
}))
;
return $bundle;
}
} }

View File

@ -238,7 +238,13 @@ EOF
$crawler = new Crawler(); $crawler = new Crawler();
$crawler->addContent('<html><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><span>中文</span></html>'); $crawler->addContent('<html><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><span>中文</span></html>');
$this->assertEquals('中文', $crawler->filterXPath('//span')->text(), '->addContent() guess wrong charset'); $this->assertEquals('中文', $crawler->filterXPath('//span')->text(), '->addContent() guess wrong charset');
}
/**
* @requires extension iconv
*/
public function testAddContentNonUtf8()
{
$crawler = new Crawler(); $crawler = new Crawler();
$crawler->addContent(iconv('UTF-8', 'SJIS', '<html><head><meta charset="Shift_JIS"></head><body>日本語</body></html>')); $crawler->addContent(iconv('UTF-8', 'SJIS', '<html><head><meta charset="Shift_JIS"></head><body>日本語</body></html>'));
$this->assertEquals('日本語', $crawler->filterXPath('//body')->text(), '->addContent() can recognize "Shift_JIS" in html5 meta charset tag'); $this->assertEquals('日本語', $crawler->filterXPath('//body')->text(), '->addContent() can recognize "Shift_JIS" in html5 meta charset tag');