diff --git a/.travis.yml b/.travis.yml index 7d06b3a..edffa08 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,8 +50,8 @@ matrix: local fold=$(date +%s%N) echo -e "travis_fold:start:$fold" echo -e "\\e[1;34m$title\\e[0m" - echo "./tests/install.sh \"$1\" \"$2\" \"$3\"" - ./tests/install.sh "$1" "$2" "$3" 2>&1 + echo "./tests/install.sh \"$1\" \"$2\" \"$3\" \"$4\"" + ./tests/install.sh "$1" "$2" "$3" "$4" 2>&1 local ok=$? (exit $ok) && echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" || @@ -88,6 +88,8 @@ matrix: - install_test will-find "Http\Discovery\Psr17FactoryDiscovery::findRequestFactory();" "http-interop/http-factory-guzzle:1.*" # Test that we find PSR-17 nyholm - install_test will-find "Http\Discovery\Psr17FactoryDiscovery::findRequestFactory();" "nyholm/psr7:^1.3" + # Test that we find Phalcon with PSR + - install_test will-find "Http\Discovery\Psr17FactoryDiscovery::findRequestFactory();" "" "psr-1.0.0 phalcon-4.0.6" before_install: - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi diff --git a/src/Strategy/CommonPsr17ClassesStrategy.php b/src/Strategy/CommonPsr17ClassesStrategy.php index 7fd4ae0..2b7f845 100644 --- a/src/Strategy/CommonPsr17ClassesStrategy.php +++ b/src/Strategy/CommonPsr17ClassesStrategy.php @@ -21,6 +21,7 @@ final class CommonPsr17ClassesStrategy implements DiscoveryStrategy */ private static $classes = [ RequestFactoryInterface::class => [ + 'Phalcon\Http\Message\RequestFactory', 'Nyholm\Psr7\Factory\Psr17Factory', 'Zend\Diactoros\RequestFactory', 'GuzzleHttp\Psr7\HttpFactory', @@ -30,6 +31,7 @@ final class CommonPsr17ClassesStrategy implements DiscoveryStrategy 'Laminas\Diactoros\RequestFactory', ], ResponseFactoryInterface::class => [ + 'Phalcon\Http\Message\ResponseFactory', 'Nyholm\Psr7\Factory\Psr17Factory', 'Zend\Diactoros\ResponseFactory', 'GuzzleHttp\Psr7\HttpFactory', @@ -39,6 +41,7 @@ final class CommonPsr17ClassesStrategy implements DiscoveryStrategy 'Laminas\Diactoros\ResponseFactory', ], ServerRequestFactoryInterface::class => [ + 'Phalcon\Http\Message\ServerRequestFactory', 'Nyholm\Psr7\Factory\Psr17Factory', 'Zend\Diactoros\ServerRequestFactory', 'GuzzleHttp\Psr7\HttpFactory', @@ -48,6 +51,7 @@ final class CommonPsr17ClassesStrategy implements DiscoveryStrategy 'Laminas\Diactoros\ServerRequestFactory', ], StreamFactoryInterface::class => [ + 'Phalcon\Http\Message\StreamFactory', 'Nyholm\Psr7\Factory\Psr17Factory', 'Zend\Diactoros\StreamFactory', 'GuzzleHttp\Psr7\HttpFactory', @@ -57,6 +61,7 @@ final class CommonPsr17ClassesStrategy implements DiscoveryStrategy 'Laminas\Diactoros\StreamFactory', ], UploadedFileFactoryInterface::class => [ + 'Phalcon\Http\Message\UploadedFileFactory', 'Nyholm\Psr7\Factory\Psr17Factory', 'Zend\Diactoros\UploadedFileFactory', 'GuzzleHttp\Psr7\HttpFactory', @@ -66,6 +71,7 @@ final class CommonPsr17ClassesStrategy implements DiscoveryStrategy 'Laminas\Diactoros\UploadedFileFactory', ], UriFactoryInterface::class => [ + 'Phalcon\Http\Message\UriFactory', 'Nyholm\Psr7\Factory\Psr17Factory', 'Zend\Diactoros\UriFactory', 'GuzzleHttp\Psr7\HttpFactory', diff --git a/tests/install.sh b/tests/install.sh index 1f7480f..b1a6d4c 100755 --- a/tests/install.sh +++ b/tests/install.sh @@ -20,9 +20,14 @@ mkdir -p $BUILD_DIR composer init --working-dir $BUILD_DIR --no-interaction composer req --working-dir $BUILD_DIR php-http/discovery --no-update -# Define packages from arguments +# Argument 3 installs additional composer packages composer req --working-dir $BUILD_DIR $3 +# Arg 4 means some pecl things will be install +if ! [ -z "$4" ]; then + pecl install $4 +fi + # Copy the current version of php-http/discovery cp -R src $BUILD_DIR/vendor/php-http/discovery cd $BUILD_DIR