Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2a9be06

Browse files
committed
minor #19917 [travis/appveyor] Wire simple-phpunit (nicolas-grekas)
This PR was merged into the 2.7 branch. Discussion ---------- [travis/appveyor] Wire simple-phpunit | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | Tests pass? | yes | License | MIT Commits ------- 9eb8524 [travis/appveyor] Wire simple-phpunit
2 parents ddf8b27 + 9eb8524 commit 2a9be06

File tree

6 files changed

+97
-277
lines changed

6 files changed

+97
-277
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
@@ -58,22 +58,27 @@ before_install:
5858
- if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = ldap.so >> $INI_FILE; fi
5959
- if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
6060
- if [[ ! $skip ]]; then [ -d ~/.composer ] || mkdir ~/.composer; cp .composer/* ~/.composer/; fi
61-
- if [[ ! $skip ]]; then ./phpunit install; fi
6261
- if [[ ! $skip ]]; then export PHPUNIT=$(readlink -f ./phpunit); fi
6362

6463
install:
64+
- if [[ ! $skip && $deps ]]; then cp composer.json composer.json.orig; fi
65+
- if [[ ! $skip && $deps ]]; then echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json; fi
6566
- if [[ ! $skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi
6667
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
67-
- if [[ ! $skip && $deps ]]; then git fetch origin $TRAVIS_BRANCH && php .github/travis.php FETCH_HEAD $TRAVIS_BRANCH $COMPONENTS; fi
68+
- if [[ ! $skip && $deps ]]; then php .github/build-packages.php HEAD^ $TRAVIS_BRANCH $COMPONENTS; fi
69+
- if [[ ! $skip && $deps ]]; then mv composer.json composer.json.phpunit; mv composer.json.orig composer.json; fi
70+
- if [[ ! $skip && ! $deps ]]; then php .github/build-packages.php HEAD^ $TRAVIS_BRANCH src/Symfony/Bridge/PhpUnit; fi
6871
# For the master branch when deps=high, the version before master is checked out and tested with the locally patched components
6972
- 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
70-
- 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
73+
- 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
7174
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one
7275
- 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
7376
- export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
74-
- if [[ ! $deps ]]; then composer update; else export SYMFONY_DEPRECATIONS_HELPER=weak; fi
75-
- if [[ $TRAVIS_BRANCH = master ]]; then export SYMFONY_PHPUNIT_OVERLOAD=1; fi
76-
- if [[ ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
77+
- if [[ ! $skip && $deps ]]; then export SYMFONY_DEPRECATIONS_HELPER=weak; fi
78+
- if [[ ! $skip && $deps ]]; then mv composer.json.phpunit composer.json; fi
79+
- if [[ ! $skip ]]; then composer update; fi
80+
- if [[ ! $skip ]]; then COMPOSER_ROOT_VERSION= ./phpunit install; fi
81+
- if [[ ! $skip && ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
7782

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

appveyor.yml

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

5860
test_script:
5961
- cd c:\projects\symfony
6062
- SET X=0
6163
- copy /Y c:\php\php.ini-min 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
- copy /Y c:\php\php.ini-max c:\php\php.ini
64-
- php phpunit symfony --exclude-group benchmark,intl-data || SET X=!errorlevel!
66+
- php phpunit src\Symfony --exclude-group benchmark,intl-data || SET X=!errorlevel!
6567
- exit %X%

composer.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
"monolog/monolog": "~1.11",
7979
"ircmaxell/password-compat": "~1.0",
8080
"ocramius/proxy-manager": "~0.4|~1.0|~2.0",
81+
"symfony/phpunit-bridge": "~3.2",
8182
"egulias/email-validator": "~1.2,>=1.2.1"
8283
},
8384
"autoload": {
@@ -99,11 +100,6 @@
99100
"**/Tests/"
100101
]
101102
},
102-
"autoload-dev": {
103-
"psr-4": {
104-
"Symfony\\Bridge\\PhpUnit\\": "src/Symfony/Bridge/PhpUnit/"
105-
}
106-
},
107103
"minimum-stability": "dev",
108104
"extra": {
109105
"branch-alias": {

0 commit comments

Comments
 (0)