@@ -25,8 +25,8 @@ matrix:
2525 include :
2626 - name : PHPSpec code coverage
2727 php : 7.1
28- # Disable code coverage until https://github.com/leanphp/phpspec-code-coverage/pull/38 is released
29- # DEPENDENCIES="leanphp/phpspec-code-coverage:^4.2" TEST_COMMAND="composer test-ci"
28+ # Disable code coverage until https://github.com/leanphp/phpspec-code-coverage/pull/38 is released
29+ # DEPENDENCIES="leanphp/phpspec-code-coverage:^4.2" TEST_COMMAND="composer test-ci"
3030 env : COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test" PULI_VERSION=1.0.0-beta9
3131 - name : PHPUnit tests
3232 php : 7.3
@@ -35,6 +35,38 @@ matrix:
3535 php : 7.3
3636 env : TEST_COMMAND="./vendor/bin/phpunit --group=NothingInstalled" DEPENDENCIES="phpunit/phpunit:^7.5"
3737
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="$1 \"$2\" ..."
45+ local fold=$(date +%s%N)
46+ echo -e "travis_fold:start:$fold"
47+ echo -e "\\e[1;34m$title\\e[0m"
48+ echo "./tests/install.sh \"$1\" \"$2\" \"$3\""
49+ ./tests/install.sh "$1" "$2" "$3" 2>&1
50+ local ok=$?
51+ (exit $ok) &&
52+ echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
53+ echo -e "\\e[41mKO\\e[0m $title\\n"
54+ (exit $ok)
55+ }
56+ export -f install_test
57+
58+ script :
59+ # Test that we find Guzzle
60+ - install_test will-find "Http\Discovery\HttpClientDiscovery::find();" "php-http/guzzle6-adapter"
61+ # Test that we find a client with Symfony and Guzzle PSR-7
62+ - 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"
63+ # We should fail if we dont have php-http/message-factory or PSR-17
64+ - install_test cant-find "Http\Discovery\HttpClientDiscovery::find();" "symfony/http-client:5.* php-http/httplug php-http/message-factory guzzlehttp/psr7:1.*"
65+ - install_test cant-find "Http\Discovery\HttpClientDiscovery::find();" "symfony/http-client:5.* php-http/httplug guzzlehttp/psr7:1.* http-interop/http-factory-guzzle"
66+ # We should be able to find a client when Symfony is only partly installed and we have guzzle adapter installed
67+ - 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.*"
68+
69+
3870before_install :
3971 - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
4072 - if ! [ -z "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi;
0 commit comments