8000 Merge branch '3.2' · symfony/symfony@51bc35c · GitHub
[go: up one dir, main page]

Skip to content

Commit 51bc35c

Browse files
committed
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()
2 parents 6751dc1 + fef1546 commit 51bc35c

File tree

4 files changed

+49
-21
lines changed

4 files changed

+49
-21
lines changed

UPGRADE-3.2.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ FrameworkBundle
7070
in TwigBundle).
7171
* The service `serializer.mapping.cache.doctrine.apc` is deprecated. APCu should now
7272
be automatically used when available.
73-
```
7473

7574
HttpFoundation
7675
---------------
@@ -111,6 +110,13 @@ HttpKernel
111110
After:
112111
```
113112
Surrogate-Capability: symfony="ESI/1.0"
113+
```
114+
115+
Router
116+
------
117+
118+
* `UrlGenerator` now generates URLs in compliance with [`RFC 3986`](https://www.ietf.org/rfc/rfc3986.txt),
119+
which means spaces will be percent encoded (%20) inside query strings.
114120

115121
Serializer
116122
----------

src/Symfony/Bundle/FrameworkBundle/Console/Application.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ public function doRun(InputInterface $input, OutputInterface $output)
8080
return parent::doRun($input, $output);
8181
}
8282

83+
/**
84+
* {@inheritdoc}
85+
*/
86+
public function find($name)
87+
{
88+
$this->registerCommands();
89+
90+
return parent::find($name);
91+
}
92+
8393
/**
8494
* {@inheritdoc}
8595
*/

src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ public function testBundleInterfaceImplementation()
3232

3333
public function testBundleCommandsAreRegistered()
3434
{
35-
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
36-
$bundle->expects($this->once())->method('registerCommands');
35+
$bundle = $this->createBundleMock(array());
3736

3837
$kernel = $this->getKernel(array($bundle), true);
3938

@@ -46,8 +45,7 @@ public function testBundleCommandsAreRegistered()
4645

4746
public function testBundleCommandsAreRetrievable()
4847
{
49-
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
50-
$bundle->expects($this->once())->method('registerCommands');
48+
$bundle = $this->createBundleMock(array());
5149

5250
$kernel = $this->getKernel(array($bundle));
5351

@@ -60,47 +58,41 @@ public function testBundleCommandsAreRetrievable()
6058

6159
public function testBundleSingleCommandIsRetrievable()
6260
{
63-
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
64-
$bundle->expects($this->once())->method('registerCommands');
61+
$command = new Command('example');
62+
63+
$bundle = $this->createBundleMock(array($command));
6564

6665
$kernel = $this->getKernel(array($bundle));
6766

6867
$application = new Application($kernel);
6968

70-
$command = new Command('example');
71-
$application->add($command);
72-
7369
$this->assertSame($command, $application->get('example'));
7470
}
7571

7672
public function testBundleCommandCanBeFound()
7773
{
78-
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
79-
$bundle->expects($this->once())->method('registerCommands');
74+
$command = new Command('example');
75+
76+
$bundle = $this->createBundleMock(array($command));
8077

8178
$kernel = $this->getKernel(array($bundle));
8279

8380
$application = new Application($kernel);
8481

85-
$command = new Command('example');
86-
$application->add($command);
87-
8882
$this->assertSame($command, $application->find('example'));
8983
}
9084

9185
public function testBundleCommandCanBeFoundByAlias()
9286
{
93-
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
94-
$bundle->expects($this->once())->method('registerCommands');
87+
$command = new Command('example');
88+
$command->setAliases(array('alias'));
89+
90+
$bundle = $this->createBundleMock(array($command));
9591

9692
$kernel = $this->getKernel(array($bundle));
9793

9894
$application = new Application($kernel);
9995

100-
$command = new Command('example');
101-
$command->setAliases(array('alias'));
102-
$application->add($command);
103-
10496
$this->assertSame($command, $application->find('alias'));
10597
}
10698

@@ -167,4 +159,18 @@ private function getKernel(array $bundles, $useDispatcher = false)
167159

168160
return $kernel;
169161
}
162+
163+
private function createBundleMock(array $commands)
164+
{
165+
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
166+
$bundle
167+
->expects($this->once())
168+
->method('registerCommands')
169+
->will($this->returnCallback(function (Application $application) use ($commands) {
170+
$application->addCommands($commands);
171+
}))
172+
;
173+
174+
return $bundle;
175+
}
170176
}

src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,13 @@ public function testAddContent()
238238
$crawler = new Crawler();
239239
$crawler->addContent('<html><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><span>中文</span></html>');
240240
$this->assertEquals('中文', $crawler->filterXPath('//span')->text(), '->addContent() guess wrong charset');
241+
}
241242

243+
/**
244+
* @requires extension iconv
245+
*/
246+
public function testAddContentNonUtf8()
247+
{
242248
$crawler = new Crawler();
243249
$crawler->addContent(iconv('UTF-8', 'SJIS', '<html><head><meta charset="Shift_JIS"></head><body>日本語</body></html>'));
244250
$this->assertEquals('日本語', $crawler->filterXPath('//body')->text(), '->addContent() can recognize "Shift_JIS" in html5 meta charset tag');

0 commit comments

Comments
 (0)
0