8000 Merge branch '2.8' into 3.0 · symfony/symfony@f990f1b · GitHub
[go: up one dir, main page]

Skip to content

Commit f990f1b

Browse files
Merge branch '2.8' into 3.0
* 2.8: [travis] Disable hirak/prestissimo for deps=low/high tests Fixed the "hover" state of the profiler sidebar menu [HttpFoundation] fix phpdoc of UploadedFile Lower complexity of Form:isValid() skipped dns-sensitive tests when DnsMock is not found [FrameworkBundle] Return the invokable service if its name is the class name [ci] Skip dns-sensitive tests when DnsMock is not found Exclude Bridge\PhpUnit from composer.json by default fixed CS Optimize ReplaceAliasByActualDefinitionPass [Process] use __METHOD__ where applicable [Routing] Don't needlessly execute strtr's as they are fairly expensive Conflicts: .travis.yml src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php
2 parents c41d377 + e7d7e1e commit f990f1b

File tree

16 files changed

+182
-139
lines changed

16 files changed

+182
-139
lines changed

.composer/composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"require": {
3-
"php": ">=5.3.7",
4-
"hirak/prestissimo": "^0.1.15"
3+
"hirak/prestissimo": "^0.1.18"
54
}
65
}

.composer/composer.lock

Lines changed: 3 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.travis.yml

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -33,46 +33,48 @@ cache:
3333
services: mongodb
3434

3535
before_install:
36+
- PHP=$TRAVIS_PHP_VERSION
3637
# Matrix lines for intermediate PHP versions are skipped for pull requests
37-
- if [[ ! $deps && ! $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} && $TRAVIS_PHP_VERSION != hhvm && $TRAVIS_PULL_REQUEST != false ]]; then deps=skip; fi;
38+
- if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && $PHP != hhvm && $TRAVIS_PULL_REQUEST != false ]]; then deps=skip; skip=1; fi
3839
# A sigchild-enabled-PHP is used to test the Process component on the lowest PHP matrix line
39-
- if [[ ! $deps && $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj; (cd php-$MIN_PHP; ./configure --enable-sigchild --enable-pcntl; make -j2); fi;
40-
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi;
41-
- echo memory_limit = -1 >> $INI_FILE
42-
- echo session.gc_probability = 0 >> $INI_FILE
43-
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi;
44-
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi;
45-
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.10 && echo apc.enable_cli = 1 >> $INI_FILE); fi;
46-
- if [[ $TRAVIS_PHP_VERSION = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.2 && echo apc.enable_cli = 1 >> $INI_FILE); fi;
47-
- if [[ $TRAVIS_PHP_VERSION = 5.* && ! $deps ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> $INI_FILE); fi;
48-
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then pecl install -f memcached-2.1.0; fi;
49-
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then echo extension = ldap.so >> $INI_FILE; fi;
50-
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini; fi;
51-
- if [[ $deps != skip ]]; then composer self-update; fi;
52-
- if [[ $deps != skip && $TRAVIS_REPO_SLUG = symfony/symfony ]]; then cp .composer/* ~/.composer/; composer global install; fi;
53-
- if [[ $deps != skip ]]; then ./phpunit install; fi;
54-
- export PHPUNIT=$(readlink -f ./phpunit)
40+
- if [[ ! $deps && $PHP = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj; (cd php-$MIN_PHP; ./configure --enable-sigchild --enable-pcntl; make -j2); fi
41+
- if [[ $PHP != hhvm ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi
42+
- if [[ ! $skip ]]; then echo memory_limit = -1 >> $INI_FILE; fi
43+
- if [[ ! $skip ]]; then echo session.gc_probability = 0 >> $INI_FILE; fi
44+
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi
45+
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi
46+
- if [[ ! $skip && $PHP = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.10 && echo apc.enable_cli = 1 >> $INI_FILE); fi
47+
- if [[ ! $skip && $PHP = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.2 && echo apc.enable_cli = 1 >> $INI_FILE); fi
48+
- if [[ ! $deps && $PHP = 5.* ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> $INI_FILE); fi
49+
- if [[ ! $skip && $PHP = 5.* ]]; then pecl install -f memcached-2.1.0; fi
50+
- if [[ ! $skip && $PHP != hhvm ]]; then echo extension = ldap.so >> $INI_FILE; fi
51+
- if [[ ! $skip && $PHP != hhvm ]]; then phpenv config-rm xdebug.ini; fi
52+
- if [[ ! $skip ]]; then composer self-update; fi
53+
- if [[ ! $skip ]]; then cp .composer/* ~/.composer/; composer global install; fi
54+
- if [[ ! $skip ]]; then ./phpunit install; fi
55+
- if [[ ! $skip && $deps ]]; then composer global remove hirak/prestissimo; fi
56+
- if [[ ! $skip ]]; then export PHPUNIT=$(readlink -f ./phpunit); fi
5557

5658
install:
57-
- if [[ $deps != skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi;
59+
- if [[ ! $skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi
5860
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
59-
- if [[ $deps != skip && $deps ]]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $COMPONENTS; fi;
61+
- if [[ ! $skip && $deps ]]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $COMPONENTS; fi
6062
# For the master branch when deps=high, the version before master is checked out and tested with the locally patched components
61-
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//); else SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*'); fi;
62-
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); ./phpunit install; fi;
63+
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//); else SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*'); fi
64+
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); ./phpunit install; fi
6365
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one
64-
- if [[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]]; then LEGACY=,legacy; fi;
65-
- export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev;
66-
- if [[ ! $deps ]]; then composer update; else export SYMFONY_DEPRECATIONS_HELPER=weak; fi;
67-
- if [[ $TRAVIS_BRANCH = master ]]; then export SYMFONY_PHPUNIT_OVERLOAD=1; fi;
68-
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi;
66+
- if [[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]]; then LEGACY=,legacy; fi
67+
- export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
68+
- if [[ ! $deps ]]; then composer update; else export SYMFONY_DEPRECATIONS_HELPER=weak; fi
69+
- if [[ $TRAVIS_BRANCH = master ]]; then export SYMFONY_PHPUNIT_OVERLOAD=1; fi
70+
- if [[ $PHP != hhvm ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
6971

7072
script:
71-
- if [[ ! $deps ]]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'; fi;
72-
- if [[ ! $deps ]]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi;
73-
- if [[ ! $deps && $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | xargs -I{} sh -c 'echo "\\nPHP --enable-sigchild enhanced={}" && ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/'; fi;
74-
- if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY; fi;
75-
- if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --prefer-lowest --prefer-stable; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi;
73+
- if [[ $skip ]]; then echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"; fi
74+
- if [[ ! $deps ]]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'; fi
75+
- if [[ ! $deps ]]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi
76+
- if [[ ! $deps && $PHP = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | xargs -I{} sh -c 'echo "\\nPHP --enable-sigchild enhanced={}" && ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/'; fi
77+
- if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --ansi; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY; fi
78+
- if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --ansi --prefer-lowest --prefer-stable; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi
7679
# Test the PhpUnit bridge using the original phpunit script
77-
- if [[ $deps = low ]]; then (cd src/Symfony/Bridge/PhpUnit && phpenv global 5.3 && php --version && composer update && phpunit); fi;
78-
- if [[ $deps = skip ]]; then echo This matrix line is skipped for pull requests.; fi;
80+
- if [[ $deps = low ]]; then (cd src/Symfony/Bridge/PhpUnit && phpenv global 5.3 && php --version && composer update && phpunit); fi

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ install:
5050
- copy /Y php.ini-max php.ini
5151
- cd c:\projects\symfony
5252
- mkdir %APPDATA%\Composer
53-
- IF %APPVEYOR_REPO_NAME%==symfony/symfony copy /Y .composer\* %APPDATA%\Composer\
54-
- IF %APPVEYOR_REPO_NAME%==symfony/symfony composer global install --no-progress --ansi || echo curl.cainfo needs PHP 5.3.7
53+
- copy /Y .composer\* %APPDATA%\Composer\
54+
- composer global install --no-progress --ansi
5555
- php phpunit install
5656
- IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev)
5757
- composer update --no-progress --ansi

composer.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@
8989
},
9090
"autoload": {
9191
"psr-4": {
92-
"Symfony\\Bridge\\": "src/Symfony/Bridge/",
92+
"Symfony\\Bridge\\Doctrine\\": "src/Symfony/Bridge/Doctrine/",
93+
"Symfony\\Bridge\\Monolog\\": "src/Symfony/Bridge/Monolog/",
94+
"Symfony\\Bridge\\ProxyManager\\": "src/Symfony/Bridge/ProxyManager/",
95+
"Symfony\\Bridge\\Swiftmailer\\": "src/Symfony/Bridge/Swiftmailer/",
96+
"Symfony\\Bridge\\Twig\\": "src/Symfony/Bridge/Twig/",
9397
"Symfony\\Bundle\\": "src/Symfony/Bundle/",
9498
"Symfony\\Component\\": "src/Symfony/Component/"
9599
},
@@ -100,6 +104,11 @@
100104
"**/Tests/"
101105
]
102106
},
107+
"autoload-dev": {
108+
"psr-4": {
109+
"Symfony\\Bridge\\PhpUnit\\": "src/Symfony/Bridge/PhpUnit/"
110+
}
111+
},
103112
"minimum-stability": "dev",
104113
"extra": {
105114
"branch-alias": {

src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ protected function createController($controller)
7878
*/
7979
protected function instantiateController($class)
8080
{
81+
if ($this->container->has($class)) {
82+
return $this->container->get($class);
83+
}
84+
8185
$controller = parent::instantiateController($class);
8286

8387
if ($controller instanceof ContainerAwareInterface) {

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerResolverTest.php

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ public function testGetControllerService()
8787

8888
public function testGetControllerInvokableService()
8989
{
90+
$invokableController = new InvokableController('bar');
91+
9092
$container = $this->createMockContainer();
9193
$container->expects($this->once())
9294
->method('has')
@@ -96,7 +98,7 @@ public function testGetControllerInvokableService()
9698
$container->expects($this->once())
9799
->method('get')
98100
->with('foo')
99-
->will($this->returnValue($this))
101+
->will($this->returnValue($invokableController))
100102
;
101103

102104
$resolver = $this->createControllerResolver(null, null, $container);
@@ -105,7 +107,33 @@ public function testGetControllerInvokableService()
105107

106108
$controller = $resolver->getController($request);
107109

108-
$this->assertInstanceOf(get_class($this), $controller);
110+
$this->assertEquals($invokableController, $controller);
111+
}
112+
113+
public function testGetControllerInvokableServiceWithClassNameAsName()
114+
{
115+
$invokableController = new InvokableController('bar');
116+
$className = __NAMESPACE__.'\InvokableController';
117+
118+
$container = $this->createMockContainer();
119+
$container->expects($this->once())
120+
->method('has')
121+
->with($className)
122+
->will($this->returnValue(true))
123+
;
124+
$container->expects($this->once())
125+
->method('get')
126+
->with($className)
127+
->will($this->returnValue($invokableController))
128+
;
129+
130+
$resolver = $this->createControllerResolver(null, null, $container);
131+
$request = Request::create('/');
132+
$request->attributes->set('_controller', $className);
133+
134+
$controller = $resolver->getController($request);
135+
136+
$this->assertEquals($invokableController, $controller);
109137
}
110138

111139
/**
@@ -182,3 +210,14 @@ public function __invoke()
182210
{
183211
}
184212
}
213+
214+
class InvokableController
215+
{
216+
public function __construct($bar) // mandatory argument to prevent automatic instantiation
217+
{
218+
}
219+
220+
public function __invoke()
221+
{
222+
}
223+
}

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,9 @@ tr.status-warning td {
515515
margin-bottom: -99999px; {# needed for 'same-height columns' trick #}
516516
margin-left: -100%;
517517
padding-bottom: 99999px; {# needed for 'same-height columns' trick #}
518+
position: relative;
518519
width: 220px;
520+
z-index: 9999;
519521
}
520522
#sidebar .module {
521523
padding: 10px;

0 commit comments

Comments
 (0)
0