Skip to content

Commit 6704f62

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: Increase the inlining YAML level for config:debug [Serializer] Minor: fix CS and PHPDoc [Form] fix tests [Serializer] Ensure that groups are strings [Debug] Tell that the extension is for PHP 5 only Static code analysis Update AnnotationDirectoryLoader.php added a test Escape the delimiter in Glob::toRegex [FrameworkBundle] Fix template location for PHP templates [FrameworkBundle] Add path verification to the template parsing test cases
2 parents 0e7af5f + 1876b4f commit 6704f62

File tree

37 files changed

+102
-61
lines changed

37 files changed

+102
-61
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ protected function setMappingDriverConfig(array $mappingConfig, $mappingName)
153153
*/
154154
protected function getMappingDriverBundleConfigDefaults(array $bundleConfig, \ReflectionClass $bundle, ContainerBuilder $container)
155155
{
156-
$bundleDir = dirname($bundle->getFilename());
156+
$bundleDir = dirname($bundle->getFileName());
157157

158158
if (!$bundleConfig['type']) {
159159
$bundleConfig['type'] = $this->detectMetadataDriver($bundleDir, $container);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private function updateValidatorMappingFiles(ContainerBuilder $container, $mappi
6060

6161
foreach ($container->getParameter('kernel.bundles') as $bundle) {
6262
$reflection = new \ReflectionClass($bundle);
63-
if (is_file($file = dirname($reflection->getFilename()).'/'.$validationPath)) {
63+
if (is_file($file = dirname($reflection->getFileName()).'/'.$validationPath)) {
6464
$files[] = realpath($file);
6565
$container->addResource(new FileResource($file));
6666
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9292
$io->title(sprintf('Current configuration for "%s"', $name));
9393
}
9494

95-
$io->writeln(Yaml::dump(array($extension->getAlias() => $config), 3));
95+
$io->writeln(Yaml::dump(array($extension->getAlias() => $config), 10));
9696
}
9797

9898
private function compileContainer()

src/Symfony/Bundle/FrameworkBundle/Resources/public/css/body.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ build: 56
117117
background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAcCAYAAACtQ6WLAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAR1JREFUeNpiPHnyZCMDA8MNID5gZmb2nAEJMH7//v3N169fX969e/cYkL8WqGAHXPLv37//QYzfv39/fvPmzbUnT56sAXInmJub/2H5/x8sx8DCwsIrISFhDmQyPX78+CmQXs70798/BmQsKipqBNTgdvz4cWkmkE5kDATMioqKZkCFdiwg1eiAi4tLGqhQF24nMmBmZuYEigth1QkEbEBxTlySYPvJkwSJ00AnjYylgU6gxB8g/oFVEphkvgLF32KNMmCCewYUv4qhEyj47+HDhyeBzIMYOoEp8CxQw56wsLAncJ1//vz5/P79+2svX74EJc2V4BT58+fPd8CE/QKYHMGJOiIiAp6oWW7evDkNSF8DZYfIyEiU7AAQYACJ2vxVdJW4eQAAAABJRU5ErkJggg==) right top no-repeat;
118118
}
119119
.sf-button .btn-bg {
120-
padding: 0px 14px;
120+
padding: 0 14px;
121121
color: #636363;
122122
line-height: 28px;
123123
background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAcCAYAAACgXdXMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAClJREFUeNpiPnny5EKGf//+/Wf6//8/A4QAcrGzKCZwGc9sa2urBBBgAIbDUoYVp9lmAAAAAElFTkSuQmCC) repeat-x top left;

src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function parse($name)
5555
throw new \RuntimeException(sprintf('Template name "%s" contains invalid characters.', $name));
5656
}
5757

58-
if (!preg_match('/^([^:]*):([^:]*):(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches)) {
58+
if (!preg_match('/^(?:([^:]*):)?(?:([^:]*):)?(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches)) {
5959
return parent::parse($name);
6060
}
6161

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

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,30 +43,33 @@ protected function tearDown()
4343
}
4444

4545
/**
46-
* @dataProvider getLogicalNameToTemplateProvider
46+
* @dataProvider parseProvider
4747
*/
48-
public function testParse($name, $ref)
48+
public function testParse($name, $logicalName, $path, $ref)
4949
{
5050
$template = $this->parser->parse($name);
5151

52-
$this->assertEquals($template->getLogicalName(), $ref->getLogicalName());
53-
$this->assertEquals($template->getLogicalName(), $name);
52+
$this->assertSame($ref->getLogicalName(), $template->getLogicalName());
53+
$this->assertSame($logicalName, $template->getLogicalName());
54+
$this->assertSame($path, $template->getPath());
5455
}
5556

56-
public function getLogicalNameToTemplateProvider()
57+
public function parseProvider()
5758
{
5859
return array(
59-
array('FooBundle:Post:index.html.php', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'php')),
60-
array('FooBundle:Post:index.html.twig', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'twig')),
61-
array('FooBundle:Post:index.xml.php', new TemplateReference('FooBundle', 'Post', 'index', 'xml', 'php')),
62-
array('SensioFooBundle:Post:index.html.php', new TemplateReference('SensioFooBundle', 'Post', 'index', 'html', 'php')),
63-
array('SensioCmsFooBundle:Post:index.html.php', new TemplateReference('SensioCmsFooBundle', 'Post', 'index', 'html', 'php')),
64-
array(':Post:index.html.php', new TemplateReference('', 'Post', 'index', 'html', 'php')),
65-
array('::index.html.php', new TemplateReference('', '', 'index', 'html', 'php')),
66-
array('FooBundle:Post:foo.bar.index.html.php', new TemplateReference('FooBundle', 'Post', 'foo.bar.index', 'html', 'php')),
67-
array('/path/to/section/name.php', new BaseTemplateReference('/path/to/section/name.php', 'php')),
68-
array('name.twig', new BaseTemplateReference('name.twig', 'twig')),
69-
array('name', new BaseTemplateReference('name')),
60+
array('FooBundle:Post:index.html.php', 'FooBundle:Post:index.html.php', '@FooBundle/Resources/views/Post/index.html.php', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'php')),
61+
array('FooBundle:Post:index.html.twig', 'FooBundle:Post:index.html.twig', '@FooBundle/Resources/views/Post/index.html.twig', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'twig')),
62+
array('FooBundle:Post:index.xml.php', 'FooBundle:Post:index.xml.php', '@FooBundle/Resources/views/Post/index.xml.php', new TemplateReference('FooBundle', 'Post', 'index', 'xml', 'php')),
63+
array('SensioFooBundle:Post:index.html.php', 'SensioFooBundle:Post:index.html.php', '@SensioFooBundle/Resources/views/Post/index.html.php', new TemplateReference('SensioFooBundle', 'Post', 'index', 'html', 'php')),
64+
array('SensioCmsFooBundle:Post:index.html.php', 'SensioCmsFooBundle:Post:index.html.php', '@SensioCmsFooBundle/Resources/views/Post/index.html.php', new TemplateReference('SensioCmsFooBundle', 'Post', 'index', 'html', 'php')),
65+
array(':Post:index.html.php', ':Post:index.html.php', 'views/Post/index.html.php', new TemplateReference('', 'Post', 'index', 'html', 'php')),
66+
array('::index.html.php', '::index.html.php', 'views/index.html.php', new TemplateReference('', '', 'index', 'html', 'php')),
67+
array('index.html.php', '::index.html.php', 'views/index.html.php', new TemplateReference('', '', 'index', 'html', 'php')),
68+
array('FooBundle:Post:foo.bar.index.html.php', 'FooBundle:Post:foo.bar.index.html.php', '@FooBundle/Resources/views/Post/foo.bar.index.html.php', new TemplateReference('FooBundle', 'Post', 'foo.bar.index', 'html', 'php')),
69+
array('/path/to/section/name.php', '/path/to/section/name.php', '/path/to/section/name.php', new BaseTemplateReference('/path/to/section/name.php', 'php')),
70+
array('name.twig', 'name.twig', 'name.twig', new BaseTemplateReference('name.twig', 'twig')),
71+
array('name', 'name', 'name', new BaseTemplateReference('name')),
72+
array('default/index.html.php', '::default/index.html.php', 'views/default/index.html.php', new TemplateReference(null, null, 'default/index', 'html', 'php')),
7073
);
7174
}
7275

src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ public function testReturns404onTokenNotFound()
6262
if ('found' == $token) {
6363
return new Profile($token);
6464
}
65-
66-
return;
6765
}))
6866
;
6967

src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function testHtmlShakespear($css, $count)
7474
$document = simplexml_import_dom($document);
7575
$bodies = $document->xpath('//body');
7676
$elements = $bodies[0]->xpath($translator->cssToXPath($css));
77-
$this->assertEquals($count, count($elements));
77+
$this->assertCount($count, $elements);
7878
}
7979

8080
public function getXpathLiteralTestData()

src/Symfony/Component/Debug/Resources/ext/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
Symfony Debug Extension
2-
=======================
1+
Symfony Debug Extension for PHP 5
2+
=================================
33

44
This extension publishes several functions to help building powerful debugging tools.
5+
It is compatible with PHP 5.3, 5.4, 5.5 and 5.6; with ZTS and non-ZTS modes.
6+
It is not required thus not provided for PHP 7.
57

68
symfony_zval_info()
79
-------------------
@@ -122,7 +124,6 @@ array(3) {
122124
Usage
123125
-----
124126

125-
The extension is compatible with ZTS mode, and should be supported by PHP5.3, 5.4, 5.5 and 5.6.
126127
To enable the extension from source, run:
127128

128129
```

src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,27 @@ public function testAddASubscriberService()
5959
->with($event)
6060
;
6161

62+
$service
63+
->expects($this->once())
64+
->method('onEventWithPriority')
65+
->with($event)
66+
;
67+
68+
$service
69+
->expects($this->once())
70+
->method('onEventNested')
71+
->with($event)
72+
;
73+
6274
$container = new Container();
6375
$container->set('service.subscriber', $service);
6476

6577
$dispatcher = new ContainerAwareEventDispatcher($container);
6678
$dispatcher->addSubscriberService('service.subscriber', 'Symfony\Component\EventDispatcher\Tests\SubscriberService');
6779

6880
$dispatcher->dispatch('onEvent', $event);
81+
$dispatcher->dispatch('onEventWithPriority', $event);
82+
$dispatcher->dispatch('onEventNested', $event);
6983
}
7084

7185
public function testPreventDuplicateListenerService()
@@ -243,11 +257,21 @@ class SubscriberService implements EventSubscriberInterface
243257
public static function getSubscribedEvents()
244258
{
245259
return array(
246-
'onEvent' => array('onEvent'),
260+
'onEvent' => 'onEvent',
261+
'onEventWithPriority' => array('onEventWithPriority', 10),
262+
'onEventNested' => array(array('onEventNested')),
247263
);
248264
}
249265

250266
public function onEvent(Event $e)
251267
{
252268
}
269+
270+
public function onEventWithPriority(Event $e)
271+
{
272+
}
273+
274+
public function onEventNested(Event $e)
275+
{
276+
}
253277
}

0 commit comments

Comments
 (0)