File tree Expand file tree Collapse file tree 2 files changed +65
-2
lines changed Expand file tree Collapse file tree 2 files changed +65
-2
lines changed Original file line number Diff line number Diff line change @@ -23,10 +23,24 @@ branches:
23
23
matrix :
24
24
fast_finish : true
25
25
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
+
26
40
- name : PHPSpec code coverage
27
41
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"
42
+ # Disable code coverage until https://github.com/leanphp/phpspec-code-coverage/pull/38 is released
43
+ # DEPENDENCIES="leanphp/phpspec-code-coverage:^4.2" TEST_COMMAND="composer test-ci"
30
44
env : COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test" PULI_VERSION=1.0.0-beta9
31
45
- name : PHPUnit tests
32
46
php : 7.3
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ gethash () {
4
+ if hash md5sum 2> /dev/null; then
5
+ echo -n " $@ " | md5sum | awk ' {print $1}'
6
+ else
7
+ echo -n " $@ " | md5 | awk ' {print $1}'
8
+ fi
9
+ }
10
+
11
+ HASH=` gethash $@ `
12
+ BUILD_DIR=build/` echo ${HASH:: 7} `
13
+
14
+ echo " Using directory: ${BUILD_DIR} "
15
+ # Prepare a folder
16
+ # rm -rf $BUILD_DIR
17
+ mkdir -p $BUILD_DIR
18
+
19
+ # Init composer
20
+ composer init --working-dir $BUILD_DIR --no-interaction
21
+ composer req --working-dir $BUILD_DIR php-http/discovery --no-update
22
+
23
+ # Define packages from arguments
24
+ composer req --working-dir $BUILD_DIR $3
25
+
26
+ # Copy the current version of php-http/discovery
27
+ cp -R src $BUILD_DIR /vendor/php-http/discovery
28
+ cd $BUILD_DIR
29
+
30
+ # Run PHP and check exit code
31
+ php -r " require 'vendor/autoload.php'; ${2} " > /dev/null
32
+ PHP_EXIT_CODE=$?
33
+
34
+ # Print result
35
+ echo " "
36
+ if [ $PHP_EXIT_CODE -eq 0 ]; then
37
+ echo " We found a package"
38
+ else
39
+ echo " We did not find anything"
40
+ fi
41
+
42
+ if [ " $1 " = " will-find" ]; then
43
+ exit $PHP_EXIT_CODE ;
44
+ elif [ $PHP_EXIT_CODE -ne 0 ]; then
45
+ exit 0
46
+ fi
47
+
48
+ echo " We did find a class but we were not supposed to"
49
+ exit 1
You can’t perform that action at this time.
0 commit comments