8000 Merge branch '3.1' · symfony/symfony@f5c1b1c · GitHub
[go: up one dir, main page]

Skip to content

Commit f5c1b1c

Browse files
Merge branch '3.1'
* 3.1: [travis/appveyor] Wire simple-phpunit [Console] fixed PHP7 Errors are now handled and converted to Exceptions Fix #19721 Fix translation:update command count bumped Symfony version to 2.8.12 updated VERSION for 2.8.11 updated CHANGELOG for 2.8.11 bumped Symfony version to 2.7.19 updated VERSION for 2.7.18 update CONTRIBUTORS for 2.7.18 updated CHANGELOG for 2.7.18 [Security] Optimize RoleHierarchy's buildRoleMap method [FrameworkBundle] Fix Incorrect line break in exception message (500 debug page) [Security] Added note inside phpdoc. Minor cleanups and improvements [form] lazy trans `post_max_size_message`. [DI] Fix setting synthetic services on ContainerBuilder [ClassLoader] Fix ClassCollectionLoader inlining with declare(strict_types=1)
2 parents 99c8988 + fad4028 commit f5c1b1c

36 files changed

+343
-144
lines changed

.github/build-packages.php

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?php
2+
3+
if (4 > $_SERVER['argc']) {
4+
echo "Usage: branch version dir1 dir2 ... dirN\n";
5+
exit(1);
6+
}
7+
chdir(dirname(__DIR__));
8+
9+
$dirs = $_SERVER['argv'];
10+
array_shift($dirs);
11+
$mergeBase = trim(shell_exec(sprintf('git merge-base %s HEAD', array_shift($dirs))));
12+
$version = array_shift($dirs);
13+
14+
$packages = array();
15+
$flags = PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0;
16+
17+
foreach ($dirs as $k => $dir) {
18+
if (!system("git diff --name-only $mergeBase -- $dir", $exitStatus)) {
19+
if ($exitStatus) {
20+
exit($exitStatus);
21+
}
22+
unset($dirs[$k]);
23+
continue;
24+
}
25+
echo "$dir\n";
26+
27+
$json = ltrim(file_get_contents($dir.'/composer.json'));
28+
if (null === $package = json_decode($json)) {
29+
passthru("composer validate $dir/composer.json");
30+
exit(1);
31+
}
32+
33+
$package->repositories = array(array(
34+
'type' => 'composer',
35+
'url' => 'file://'.str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__)).'/',
36+
));
37+
if (false === strpos($json, "\n \"repositories\": [\n")) {
38+
$json = rtrim(json_encode(array('repositories' => $package->repositories), $flags), "\n}").','.substr($json, 1);
39+
file_put_contents($dir.'/composer.json', $json);
40+
}
41+
passthru("cd $dir && tar -cf package.tar --exclude='package.tar' *");
42+
43+
$package->version = $version.'.999';
44+
$package->dist['type'] = 'tar';
45+
$package->dist['url'] = 'file://'.str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__))."/$dir/package.tar";
46+
47+
$packages[$package->name][$package->version] = $package;
48+
49+
$versions = file_get_contents('https://packagist.org/packages/'.$package->name.'.json');
50+
$versions = json_decode($versions);
51+
52+
foreach ($versions->package->versions as $v => $package) {
53+
$packages[$package->name] += array($v => $package);
54+
}
55+
}
56+
57+
file_put_contents('packages.json', json_encode(compact('packages'), $flags));
58+
59+
if ($dirs) {
60+
$json = ltrim(file_get_contents('composer.json'));
61+
if (null === $package = json_decode($json)) {
62+
passthru("composer validate $dir/composer.json");
63+
exit(1);
64+
}
65+
66+
$package->repositories = array(array(
67+
'type' => 'composer',
68+
'url' => 'file://'.str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__)).'/',
69+
));
70+
if (false === strpos($json, "\n \"repositories\": [\n")) {
71+
$json = rtrim(json_encode(array('repositories' => $package->repositories), $flags), "\n}").','.substr($json, 1);
72+
file_put_contents('composer.json', $json);
73+
}
74+
}

.github/travis.php

Lines changed: 0 additions & 54 deletions
This file was deleted.

.travis.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,29 @@ before_install:
6464
- if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = redis.so >> $INI_FILE; fi;
6565
- if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
6666
- if [[ ! $skip ]]; then [ -d ~/.composer ] || mkdir ~/.composer; cp .composer/* ~/.composer/; fi
67-
- if [[ ! $skip ]]; then ./phpunit install; fi
6867
- if [[ ! $skip ]]; then export PHPUNIT=$(readlink -f ./phpunit); fi
6968
- if [[ ! $skip ]]; then ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/base.ldif; fi
7069
- if [[ ! $skip ]]; then ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif; fi
7170

7271
install:
72+
- if [[ ! $skip && $deps ]]; then cp composer.json composer.json.orig; fi
73+
- if [[ ! $skip && $deps ]]; then echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json; fi
7374
- if [[ ! $skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi
7475
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
75-
- if [[ ! $skip && $deps ]]; then git fetch origin $TRAVIS_BRANCH && php .github/travis.php FETCH_HEAD $TRAVIS_BRANCH $COMPONENTS; fi
76+
- if [[ ! $skip && $deps ]]; then php .github/build-packages.php HEAD^ $TRAVIS_BRANCH $COMPONENTS; fi
77+
- if [[ ! $skip && $deps ]]; then mv composer.json composer.json.phpunit; mv composer.json.orig composer.json; fi
78+
- if [[ ! $skip && ! $deps ]]; then php .github/build-packages.php HEAD^ $TRAVIS_BRANCH src/Symfony/Bridge/PhpUnit; fi
7679
# For the master branch when deps=high, the version before master is checked out and tested with the locally patched components
7780
- 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
78-
- 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
81+
- 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'); fi
7982
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one
8083
- 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
8184
- export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
82-
- if [[ ! $deps ]]; then composer update; else export SYMFONY_DEPRECATIONS_HELPER=weak; fi
83-
- if [[ $TRAVIS_BRANCH = master ]]; then export SYMFONY_PHPUNIT_OVERLOAD=1; fi
84-
- if [[ ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
85+
- if [[ ! $skip && $deps ]]; then export SYMFONY_DEPRECATIONS_HELPER=weak; fi
86+
- if [[ ! $skip && $deps ]]; then mv composer.json.phpunit composer.json; fi
87+
- if [[ ! $skip ]]; then composer update; fi
88+
- if [[ ! $skip ]]; then COMPOSER_ROOT_VERSION= ./phpunit install; fi
89+
- if [[ ! $skip && ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
8590

8691
script:
8792
- if [[ $skip ]]; then echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"; fi

CONTRIBUTORS.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Symfony is the result of the work of many people who made the code better
1616
- Kris Wallsmith (kriswallsmith)
1717
- Jakub Zalas (jakubzalas)
1818
- Ryan Weaver (weaverryan)
19-
- Kévin Dunglas (dunglas)
2019
- Javier Eguiluz (javier.eguiluz)
20+
- Kévin Dunglas (dunglas)
2121
- Hugo Hamon (hhamon)
2222
- Abdellatif Ait boudad (aitboudad)
2323
- Pascal Borreli (pborreli)
@@ -52,8 +52,8 @@ Symfony is the result of the work of many people who made the code better
5252
- Konstantin Kudryashov (everzet)
5353
- Bilal Amarni (bamarni)
5454
- Florin Patan (florinpatan)
55-
- Peter Rehm (rpet)
5655
- Ener-Getick (energetick)
56+
- Peter Rehm (rpet)
5757
- Iltar van der Berg (kjarli)
5858
- Kevin Bond (kbond)
5959
- Andrej Hudec (pulzarraider)
@@ -315,6 +315,7 @@ Symfony is the result of the work of many people who made the code better
315315
- JhonnyL
316316
- hossein zolfi (ocean)
317317
- Clément Gautier (clementgautier)
318+
- James Halsall (jaitsu)
318319
- Eduardo Gulias (egulias)
319320
- giulio de donato (liuggio)
320321
- Stéphane PY (steph_py)
@@ -396,7 +397,6 @@ Symfony is the result of the work of many people who made the code better
396397
- Christian Wahler
397398
- Mathieu Lemoine
398399
- Gintautas Miselis
399-
- James Halsall (jaitsu)
400400
- David Badura (davidbadura)
401401
- Zander Baldwin
402402
- Adam Harvey
@@ -1302,6 +1302,7 @@ Symfony is the result of the work of many people who made the code better
13021302
- Muriel (metalmumu)
13031303
- Michael Pohlers (mick_the_big)
13041304
- Cayetano Soriano Gallego (neoshadybeat)
1305+
- Ondrej Machulda (ondram)
13051306
- Patrick McDougle (patrick-mcdougle)
13061307
- Pablo Monterde Perez (plebs)
13071308
- Jimmy Leger (redpanda)

appveyor.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,20 @@ install:
4646
- echo curl.cainfo=c:\php\cacert.pem >> php.ini-max
4747
- copy /Y php.ini-max php.ini
4848
- cd c:\projects\symfony
49-
- IF NOT EXIST composer.phar (appveyor DownloadFile https://getcomposer.org/download/1.2.0/composer.phar)
49+
- IF NOT EXIST composer.phar (appveyor DownloadFile https://getcomposer.org/download/1.2.1/composer.phar)
5050
- php composer.phar self-update
5151
- copy /Y .composer\* %APPDATA%\Composer\
52-
- php phpunit install
52+
- php .github/build-packages.php "HEAD^" %APPVEYOR_REPO_BRANCH% src\Symfony\Bridge\PhpUnit
5353
- IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev)
5454
- php composer.phar update --no-progress --ansi
55+
- SET COMPOSER_ROOT_VERSION=
56+
- php phpunit install
5557

5658
test_script:
5759
- cd c:\projects\symfony
5860
- SET X=0
5961
- copy /Y c:\php\php.ini-min c:\php\php.ini
60-
- php phpunit symfony --exclude-group benchmark,intl-data || SET X=!errorlevel!
62+
- php phpunit src\Symfony --exclude-group benchmark,intl-data || SET X=!errorlevel!
6163
- copy /Y c:\php\php.ini-max c:\php\php.ini
62-
- php phpunit symfony --exclude-group benchmark,intl-data || SET X=!errorlevel!
64+
- php phpunit src\Symfony --exclude-group benchmark,intl-data || SET X=!errorlevel!
6365
- exit %X%

composer.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
"ocramius/proxy-manager": "~0.4|~1.0|~2.0",
8888
"predis/predis": "~1.0",
8989
"egulias/email-validator": "~1.2,>=1.2.8|~2.0",
90+
"symfony/phpunit-bridge": "~3.2",
9091
"symfony/polyfill-apcu": "~1.1",
9192
"symfony/security-acl": "~2.8|~3.0",
9293
"phpdocumentor/reflection-docblock": "^3.0"
@@ -115,11 +116,6 @@
115116
"**/Tests/"
116117
]
117118
},
118-
"autoload-dev": {
119-
"psr-4": {
120-
"Symfony\\Bridge\\PhpUnit\\": "src/Symfony/Bridge/PhpUnit/"
121-
}
122-
},
123119
"minimum-stability": "dev",
124120
"extra": {
125121
"branch-alias": {

phpunit

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
5+
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\nPlease run `composer update` before running this command.\n";
6+
exit(1);
7+
}
8+
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
9+
require __DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ if (isset($argv[1]) && is_dir($argv[1]) && !file_exists($argv[1].'/phpunit.xml.d
190190
}
191191

192192
if (!file_exists($component = array_pop($argv))) {
193-
$component = basename($oldcwd);
193+
$component = basename($oldPwd);
194194
}
195195

196196
if ($exit) {

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,19 +166,21 @@ protected function execute(InputInterface $input, OutputInterface $output)
166166
foreach ($operation->getDomains() as $domain) {
167167
$newKeys = array_keys($operation->getNewMessages($domain));
168168
$allKeys = array_keys($operation->getMessages($domain));
169-
$domainMessagesCount = count($newKeys) + count($allKeys);
170169

171-
$io->section(sprintf('Messages extracted for domain "<info>%s</info>" (%d messages)', $domain, $domainMessagesCount));
172-
173-
$io->listing(array_merge(
170+
$list = array_merge(
174171
array_diff($allKeys, $newKeys),
175172
array_map(function ($id) {
176173
return sprintf('<fg=green>%s</>', $id);
177174
}, $newKeys),
178175
array_map(function ($id) {
179176
return sprintf('<fg=red>%s</>', $id);
180177
}, array_keys($operation->getObsoleteMessages($domain)))
181-
));
178+
);
179+
180+
$domainMessagesCount = count($list);
181+
182+
$io->section(sprintf('Messages extracted for domain "<info>%s</info>" (%d message%s)', $domain, $domainMessagesCount, $domainMessagesCount > 1 ? 's' : ''));
183+
$io->listing($list);
182184

183185
$extractedMessagesCount += $domainMessagesCount;
184186
}
@@ -187,7 +189,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
187189
$io->comment('Xliff output version is <info>1.2</info>');
188190
}
189191

190-
$resultMessage = sprintf('%d messages were successfully extracted', $extractedMessagesCount);
192+
$resultMessage = sprintf('%d message%s successfully extracted', $extractedMessagesCount, $extractedMessagesCount > 1 ? 's were' : ' was');
191193
}
192194

193195
if ($input->getOption('no-backup') === true) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ build: 56
3939
font-family: Georgia, "Times New Roman", Times, serif;
4040
font-size: 20px;
4141
color: #313131;
42-
word-break: break-all;
42+
word-wrap: break-word;
4343
}
4444
.sf-reset li {
4545
padding-bottom: 10px;

src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ public function testDumpMessagesAndClean()
2828
$tester = $this->createCommandTester($this->getContainer(array('messages' => array('foo' => 'foo'))));
2929
$tester->execute(array('command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true));
3030
$this->assertRegExp('/foo/', $tester->getDisplay());
31+
$this->assertRegExp('/1 message was successfully extracted/', $tester->getDisplay());
32+
}
33+
34+
public function testDumpTwoMessagesAndClean()
35+
{
36+
$tester = $this->createCommandTester($this->getContainer(array('foo' => 'foo', 'bar' => 'bar')));
37+
$tester->execute(array('command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true));
38+
$this->assertRegExp('/foo/', $tester->getDisplay());
39+
$this->assertRegExp('/bar/', $tester->getDisplay());
3140
$this->assertRegExp('/2 messages were successfully extracted/', $tester->getDisplay());
3241
}
3342

0 commit comments

Comments
 (0)
0