Skip to content

Commit 83c183a

Browse files
committed
Added folded reports
1 parent a58578f commit 83c183a

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed

.travis.yml

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,6 @@ branches:
2323
matrix:
2424
fast_finish: true
2525
include:
26-
- name: Test Install
27-
php: 7.3
28-
install:
29-
script:
30-
# Test that we find Guzzle
31-
- ./tests/install.sh "will-find" "Http\Discovery\HttpClientDiscovery::find();" "php-http/guzzle6-adapter"
32-
# Test that we find a client with Symfony and Guzzle PSR-7
33-
- ./tests/install.sh will-find "Http\Discovery\HttpClientDiscovery::find();" "symfony/http-client:5.* php-http/httplug php-http/message-factory guzzlehttp/psr7:1.* http-interop/http-factory-guzzle"
34-
# We should fail if we dont have php-http/message-factory or PSR-17
35-
- ./tests/install.sh cant-find "Http\Discovery\HttpClientDiscovery::find();" "symfony/http-client:5.* php-http/httplug php-http/message-factory guzzlehttp/psr7:1.*"
36-
- ./tests/install.sh cant-find "Http\Discovery\HttpClientDiscovery::find();" "symfony/http-client:5.* php-http/httplug guzzlehttp/psr7:1.* http-interop/http-factory-guzzle"
37-
# We should be able to find a client when Symfony is only partly installed and we have guzzle adapter installed
38-
- ./tests/install.sh will-find "Http\Discovery\HttpClientDiscovery::find();" "symfony/http-client:5.* php-http/guzzle6-adapter php-http/httplug php-http/message-factory guzzlehttp/psr7:1.*"
39-
4026
- name: PHPSpec code coverage
4127
php: 7.1
4228
# Disable code coverage until https://github.com/leanphp/phpspec-code-coverage/pull/38 is released
@@ -49,6 +35,37 @@ matrix:
4935
php: 7.3
5036
env: TEST_COMMAND="./vendor/bin/phpunit --group=NothingInstalled" DEPENDENCIES="phpunit/phpunit:^7.5"
5137

38+
- name: Test Install
39+
php: 7.3
40+
install:
41+
- |
42+
# install_test is a helper to create folded reports (From Symfony)
43+
install_test () {
44+
local title="./tests/install.sh \"$1\" \"$2\" \"$3\""
45+
local fold=$(date +%s%N)
46+
echo -e "travis_fold:start:$fold"
47+
echo -e "\\e[1;34m$title\\e[0m"
48+
./tests/install.sh "$1" "$2" "$3" 2>&1
49+
local ok=$?
50+
(exit $ok) &&
51+
echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
52+
echo -e "\\e[41mKO\\e[0m $title\\n"
53+
(exit $ok)
54+
}
55+
export -f install_test
56+
57+
script:
58+
# Test that we find Guzzle
59+
- install_test "will-find" "Http\Discovery\HttpClientDiscovery::find();" "php-http/guzzle6-adapter"
60+
# Test that we find a client with Symfony and Guzzle PSR-7
61+
- install_test will-find "Http\Discovery\HttpClientDiscovery::find();" "symfony/http-client:5.* php-http/httplug php-http/message-factory guzzlehttp/psr7:1.* http-interop/http-factory-guzzle"
62+
# We should fail if we dont have php-http/message-factory or PSR-17
63+
- install_test cant-find "Http\Discovery\HttpClientDiscovery::find();" "symfony/http-client:5.* php-http/httplug php-http/message-factory guzzlehttp/psr7:1.*"
64+
- install_test cant-find "Http\Discovery\HttpClientDiscovery::find();" "symfony/http-client:5.* php-http/httplug guzzlehttp/psr7:1.* http-interop/http-factory-guzzle"
65+
# We should be able to find a client when Symfony is only partly installed and we have guzzle adapter installed
66+
- install_test will-find "Http\Discovery\HttpClientDiscovery::find();" "symfony/http-client:5.* php-http/guzzle6-adapter php-http/httplug php-http/message-factory guzzlehttp/psr7:1.*"
67+
68+
5269
before_install:
5370
- if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
5471
- if ! [ -z "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi;

tests/install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,20 @@ PHP_EXIT_CODE=$?
3333

3434
# Print result
3535
echo ""
36+
echo ""
3637
if [ $PHP_EXIT_CODE -eq 0 ]; then
3738
echo "We found a package"
3839
else
3940
echo "We did not find anything"
4041
fi
4142

43+
echo ""
4244
if [ "$1" = "will-find" ]; then
4345
exit $PHP_EXIT_CODE;
4446
elif [ $PHP_EXIT_CODE -ne 0 ]; then
4547
exit 0
4648
fi
4749

4850
echo "We did find a class but we were not supposed to"
51+
echo ""
4952
exit 1

0 commit comments

Comments
 (0)