diff options
-rw-r--r-- | composer-factory.json | 27 | ||||
-rw-r--r-- | composer-psr7.json | 31 | ||||
-rw-r--r-- | composer.json | 21 | ||||
-rwxr-xr-x | php-http-interop-http-factory-tests-get-source.sh | 70 | ||||
-rwxr-xr-x | php-http-psr7-integration-tests-get-source.sh | 70 | ||||
-rw-r--r-- | php-laminas-diactoros2.spec | 118 |
6 files changed, 268 insertions, 69 deletions
diff --git a/composer-factory.json b/composer-factory.json new file mode 100644 index 0000000..7a15318 --- /dev/null +++ b/composer-factory.json @@ -0,0 +1,27 @@ +{ + "name": "http-interop/http-factory-tests", + "description": "Unit tests for HTTP factories", + "keywords": [ + "psr-7", + "psr-17", + "http", + "factory", + "test" + ], + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "require": { + "psr/http-factory": "^1.0", + "phpunit/phpunit": "^6.5 || ^7.0" + }, + "autoload": { + "psr-4": { + "Interop\\Http\\Factory\\": "test/" + } + } +} diff --git a/composer-psr7.json b/composer-psr7.json index 83b1a99..8aa07dc 100644 --- a/composer-psr7.json +++ b/composer-psr7.json @@ -1,9 +1,12 @@ { "name": "php-http/psr7-integration-tests", "description": "Test suite for PSR7", - "license": "MIT", - "keywords": ["test", "psr-7"], + "keywords": [ + "test", + "psr-7" + ], "homepage": "http://php-http.org", + "license": "MIT", "authors": [ { "name": "Tobias Nyholm", @@ -11,16 +14,21 @@ } ], "require": { - "php": "^5.4 || ^7.0", - "psr/http-message": "^1.0", - "phpunit/phpunit": "^5.4 || ^6.0 || ^7.0" + "php": "^5.5 || ^7.0", + "phpunit/phpunit": "^5.4 || ^6.0 || ^7.0", + "psr/http-message": "^1.0" }, "require-dev": { - "zendframework/zend-diactoros": "^1.8", "guzzlehttp/psr7": "^1.4", - "slim/http": "^0.3", + "nyholm/psr7": "^1.0", "ringcentral/psr7": "^1.2", - "nyholm/psr7": "dev-master" + "slim/psr7": "dev-master", + "zendframework/zend-diactoros": "^2.1" + }, + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } }, "autoload": { "psr-4": { @@ -33,11 +41,6 @@ } }, "scripts": { - "test": "vendor/bin/phpunit" - }, - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } + "test": "phpunit" } } diff --git a/composer.json b/composer.json index abbcd34..a1b5660 100644 --- a/composer.json +++ b/composer.json @@ -22,24 +22,33 @@ }, "extra": { "branch-alias": { + "dev-master": "2.1.x-dev", + "dev-develop": "2.2.x-dev", "dev-release-1.8": "1.8.x-dev" } }, "require": { - "php": "^5.6 || ^7.0", + "php": "^7.1", "laminas/laminas-zendframework-bridge": "^1.0", + "psr/http-factory": "^1.0", "psr/http-message": "^1.0" }, "require-dev": { + "ext-curl": "*", "ext-dom": "*", "ext-libxml": "*", - "laminas/laminas-coding-standard": "~1.0", + "http-interop/http-factory-tests": "^0.5.0", + "laminas/laminas-coding-standard": "~1.0.0", "php-http/psr7-integration-tests": "dev-master", - "phpunit/phpunit": "^5.7.16 || ^6.0.8 || ^7.2.7" + "phpunit/phpunit": "^7.5.18" }, "provide": { + "psr/http-factory-implementation": "1.0", "psr/http-message-implementation": "1.0" }, + "conflict": { + "phpspec/prophecy": "<1.9.0" + }, "autoload": { "files": [ "src/functions/create_uploaded_file.php", @@ -66,11 +75,7 @@ "autoload-dev": { "psr-4": { "LaminasTest\\Diactoros\\": "test/" - }, - "files": [ - "test/TestAsset/Functions.php", - "test/TestAsset/SapiResponse.php" - ] + } }, "scripts": { "check": [ diff --git a/php-http-interop-http-factory-tests-get-source.sh b/php-http-interop-http-factory-tests-get-source.sh new file mode 100755 index 0000000..9bccafb --- /dev/null +++ b/php-http-interop-http-factory-tests-get-source.sh @@ -0,0 +1,70 @@ +#/bin/sh + +GIT=`which git` +RPM=`which rpm` + +if [ -z "$GIT" ] +then + echo "ERROR: 'git' command not found" 1>&2 + exit 1 +elif [ -z "$RPM" ] +then + echo "ERROR: 'rpm' command not found" 1>&2 + exit 1 +fi + +function print { + echo -e "\e[0;33m>>>>> ${1}\e[0m" +} + +if [ -x "$1" ] +then + SPEC=$1 +else + SPEC=`ls *.spec | head -1` +fi + +VERSION=`egrep '%global\s*gh_factory_version' $SPEC | awk '{print $3}'` + +GIT_OWNER=`egrep '%global\s*gh_factory_owner' $SPEC | awk '{print $3}'` +GIT_NAME=`egrep '%global\s*gh_factory_name' $SPEC | awk '{print $3}'` +GIT_COMMIT=`egrep '%global\s*gh_factory_commit' $SPEC | awk '{print $3}'` +GIT_REPO=https://github.com/${GIT_OWNER}/${GIT_NAME} +GIT_DIR=`echo $GIT_REPO | sed 's#.*/##'` +NAME="php-$GIT_OWNER-$GIT_NAME" + +print "SPEC = $SPEC" +print "NAME = $NAME" +print "GIT_OWNER = $GIT_OWNER" +print "GIT_NAME = $GIT_NAME" +print "GIT_COMMIT = $GIT_COMMIT" +print "GIT_REPO = $GIT_REPO" +print "GIT_DIR = $GIT_DIR" + +TEMP_DIR=$(mktemp --dir) +TAR_FILE=$PWD/${NAME}-${VERSION}-${GIT_COMMIT:0:7}.tgz +CMP_FILE=$PWD/composer-factory.json + +pushd $TEMP_DIR + print "Cloning git repo..." + $GIT clone $GIT_REPO + + pushd $GIT_DIR + print "Checking out commit..." + $GIT checkout $GIT_COMMIT + cp composer.json $CMP_FILE + popd + + TAR_DIR=${GIT_NAME}-${GIT_COMMIT} + print "TAR_DIR = $TAR_DIR" + + mv $GIT_DIR $TAR_DIR + + print "TAR_FILE = $TAR_FILE" + + [ -e $TAR_FILE ] && rm -f $TAR_FILE + tar --exclude-vcs -czf $TAR_FILE $TAR_DIR + chmod 0644 $TAR_FILE +popd + +rm -rf $TEMP_DIR diff --git a/php-http-psr7-integration-tests-get-source.sh b/php-http-psr7-integration-tests-get-source.sh new file mode 100755 index 0000000..dd96c2a --- /dev/null +++ b/php-http-psr7-integration-tests-get-source.sh @@ -0,0 +1,70 @@ +#/bin/sh + +GIT=`which git` +RPM=`which rpm` + +if [ -z "$GIT" ] +then + echo "ERROR: 'git' command not found" 1>&2 + exit 1 +elif [ -z "$RPM" ] +then + echo "ERROR: 'rpm' command not found" 1>&2 + exit 1 +fi + +function print { + echo -e "\e[0;33m>>>>> ${1}\e[0m" +} + +if [ -x "$1" ] +then + SPEC=$1 +else + SPEC=`ls *.spec | head -1` +fi + +VERSION=`egrep '%global\s*gh_psr7_version' $SPEC | awk '{print $3}'` + +GIT_OWNER=`egrep '%global\s*gh_psr7_owner' $SPEC | awk '{print $3}'` +GIT_NAME=`egrep '%global\s*gh_psr7_name' $SPEC | awk '{print $3}'` +GIT_COMMIT=`egrep '%global\s*gh_psr7_commit' $SPEC | awk '{print $3}'` +GIT_REPO=https://github.com/${GIT_OWNER}/${GIT_NAME} +GIT_DIR=`echo $GIT_REPO | sed 's#.*/##'` +NAME="$GIT_OWNER-$GIT_NAME" + +print "SPEC = $SPEC" +print "NAME = $NAME" +print "GIT_OWNER = $GIT_OWNER" +print "GIT_NAME = $GIT_NAME" +print "GIT_COMMIT = $GIT_COMMIT" +print "GIT_REPO = $GIT_REPO" +print "GIT_DIR = $GIT_DIR" + +TEMP_DIR=$(mktemp --dir) +TAR_FILE=$PWD/${NAME}-${VERSION}-${GIT_COMMIT:0:7}.tgz +CMP_FILE=$PWD/composer-psr7.json + +pushd $TEMP_DIR + print "Cloning git repo..." + $GIT clone $GIT_REPO + + pushd $GIT_DIR + print "Checking out commit..." + $GIT checkout $GIT_COMMIT + cp composer.json $CMP_FILE + popd + + TAR_DIR=${GIT_NAME}-${GIT_COMMIT} + print "TAR_DIR = $TAR_DIR" + + mv $GIT_DIR $TAR_DIR + + print "TAR_FILE = $TAR_FILE" + + [ -e $TAR_FILE ] && rm -f $TAR_FILE + tar --exclude-vcs -czf $TAR_FILE $TAR_DIR + chmod 0644 $TAR_FILE +popd + +rm -rf $TEMP_DIR diff --git a/php-laminas-diactoros2.spec b/php-laminas-diactoros2.spec index 4b71c84..3165b15 100644 --- a/php-laminas-diactoros2.spec +++ b/php-laminas-diactoros2.spec @@ -11,33 +11,35 @@ %global gh_owner laminas %global gh_project laminas-diactoros %global zf_name zend-diactoros -%global gh_commit 56a9aca1f89231763d24d2ae13531b97fa5f4029 +%global gh_commit 95178c4751d737cdf9ab0a9f70a42754ac860e7b %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global php_home %{_datadir}/php %global namespace Laminas %global library Diactoros +%global major 2 + %global gh_psr7_owner php-http %global gh_psr7_name psr7-integration-tests -%global gh_psr7_version 0 -%global gh_psr7_commit 5dfefb2da33ca24ae20c971b725c9a6fe7403008 +%global gh_psr7_version 1.0.0 +%global gh_psr7_commit c3bb79ca4a276df57364ff45bf2f619f769ded4a %global gh_psr7_short %(c=%{gh_psr7_commit}; echo ${c:0:7}) -# "php": "^5.6 || ^7.0" -%global php_min_ver 5.6 -# "psr/http-message": "^1.0" -%global psr_http_message_min_ver 1.0 -%global psr_http_message_max_ver 2.0 +%global gh_factory_owner http-interop +%global gh_factory_name http-factory-tests +%global gh_factory_version 0.5.0 +%global gh_factory_commit 3c6c62052daeb67ca7dc3e1ea1b72c0f0cc19070 +%global gh_factory_short %(c=%{gh_factory_commit}; echo ${c:0:7}) # Build using "--without tests" to disable tests %global with_tests 0%{!?_without_tests:1} %{!?phpdir: %global phpdir %{_datadir}/php} -Name: php-%{gh_project} -Version: 1.8.7p1 -Release: 2%{?gh_release}%{?dist} -Summary: PSR HTTP Message implementations +Name: php-%{gh_project}%{major} +Version: 2.2.2 +Release: 1%{?gh_release}%{?dist} +Summary: PSR HTTP Message implementations v%{major} License: BSD URL: https://github.com/%{gh_owner}/%{gh_project} @@ -46,33 +48,43 @@ URL: https://github.com/%{gh_owner}/%{gh_project} # Run makesrc.sh to create full source. Source0: %{name}-%{version}-%{gh_short}.tgz Source1: makesrc.sh -# Temporarily bundled, no release, only used for tests +# Temporarily bundled, only used for tests Source2: %{gh_psr7_owner}-%{gh_psr7_name}-%{gh_psr7_version}-%{gh_psr7_short}.tgz Source3: %{gh_psr7_owner}-%{gh_psr7_name}-get-source.sh +# Temporarily bundled, only used for tests +Source4: php-%{gh_factory_owner}-%{gh_factory_name}-%{gh_factory_version}-%{gh_factory_short}.tgz +Source5: php-%{gh_factory_owner}-%{gh_factory_name}-get-source.sh BuildArch: noarch # Tests %if %{with_tests} ## composer.json -BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php(language) >= 7.1 # remirepo:1 %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 BuildRequires: (php-autoloader(%{gh_owner}/laminas-zendframework-bridge) >= 1.0 with php-autoloader(%{gh_owner}/laminas-zendframework-bridge) < 2) -BuildRequires: (php-composer(psr/http-message) >= %{psr_http_message_min_ver} with php-composer(psr/http-message) < %{psr_http_message_max_ver}) +BuildRequires: (php-composer(psr/http-message) >= 1.0 with php-composer(psr/http-message) < 2) +BuildRequires: (php-composer(psr/http-factory) >= 1.0 with php-composer(psr/http-factory) < 2) # remirepo:4 %else BuildRequires: php-laminas-zendframework-bridge BuildRequires: php-psr-http-message +BuildRequires: php-psr-http-factory %endif -%global phpunit %{_bindir}/phpunit6 -BuildRequires: %{phpunit} +# "require-dev": { +# "ext-curl": "*", +# "ext-dom": "*", +# "ext-libxml": "*", +# "http-interop/http-factory-tests": "^0.5.0", +# "laminas/laminas-coding-standard": "~1.0.0", +# "php-http/psr7-integration-tests": "dev-master", +# "phpunit/phpunit": "^7.5.18" +# }, +%global phpunit %{_bindir}/phpunit7 +BuildRequires: phpunit7 >= 7.5.18 BuildRequires: php-dom BuildRequires: php-libxml -## phpcompatinfo (computed from version 1.8.7p1) -### NOTE: curl, gd, gmp, and shmop are all optional for -### LaminasTest\Diactoros\StreamTest::getResourceFor67() -### (test/StreamTest.php) but the first one found wins -### so only curl is chosen as a requirement here. +## phpcompatinfo (computed from version 2.2.2) BuildRequires: php-curl BuildRequires: php-dom BuildRequires: php-json @@ -86,31 +98,37 @@ BuildRequires: php-spl BuildRequires: php-fedora-autoloader-devel # composer.json -Requires: php(language) >= %{php_min_ver} +# "require": { +# "php": "^7.1", +# "laminas/laminas-zendframework-bridge": "^1.0", +# "psr/http-factory": "^1.0", +# "psr/http-message": "^1.0" +Requires: php(language) >= 7.1 # remirepo:1 %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 Requires: (php-autoloader(%{gh_owner}/laminas-zendframework-bridge) >= 1.0 with php-autoloader(%{gh_owner}/laminas-zendframework-bridge) < 2) -Requires: (php-composer(psr/http-message) >= %{psr_http_message_min_ver} with php-composer(psr/http-message) < %{psr_http_message_max_ver}) +Requires: (php-composer(psr/http-message) >= 1.0 with php-composer(psr/http-message) < 2) +Requires: (php-composer(psr/http-factory) >= 1.0 with php-composer(psr/http-factory) < 2) # remirepo:4 %else Requires: php-laminas-zendframework-bridge Requires: php-psr-http-message +Requires: php-psr-http-factory %endif -# phpcompatinfo (computed from version 1.8.7p1) +# phpcompatinfo (computed from version 2.2.2) Requires: php-json Requires: php-pcre Requires: php-spl # Autoloader Requires: php-composer(fedora/autoloader) -# Composer # Compatibily ensure by the bridge -Obsoletes: php-zendframework-%{zf_name} < 1.8.7p1 -Provides: php-zendframework-%{zf_name} = %{version} Provides: php-composer(%{gh_owner}/%{gh_project}) = %{version} Provides: php-composer(zendframework/%{zf_name}) = %{version} Provides: php-autoloader(%{gh_owner}/%{gh_project}) = %{version} Provides: php-autoloader(zendframework/%{zf_name}) = %{version} + +Provides: php-composer(psr/http-factory-implementation) = 1.0 Provides: php-composer(psr/http-message-implementation) = 1.0 @@ -121,16 +139,17 @@ http.Server [2]. Documentation: https://docs.laminas.dev/%{gh_project}/ -Autoloader: %{phpdir}/%{namespace}/Diactoros/autoload.php +Autoloader: %{phpdir}/%{namespace}/%{library}%{major}/autoload.php [1] http://www.php-fig.org/psr/psr-7/ [2] http://nodejs.org/api/http.html %prep -%setup -qn %{gh_project}-%{gh_commit} -a2 +%setup -qn %{gh_project}-%{gh_commit} -a2 -a4 mv %{gh_psr7_name}-%{gh_psr7_commit} psr7 +mv %{gh_factory_name}-%{gh_factory_commit} factory mv LICENSE.md LICENSE @@ -140,6 +159,7 @@ phpab --template fedora --output src/autoload.php src cat <<'AUTOLOAD' | tee -a src/autoload.php \Fedora\Autoloader\Dependencies::required(array( '%{phpdir}/Psr/Http/Message/autoload.php', + '%{phpdir}/Psr/Http/Message/http-factory-autoload.php', __DIR__.'/functions/create_uploaded_file.php', __DIR__.'/functions/marshal_headers_from_sapi.php', __DIR__.'/functions/marshal_method_from_sapi.php', @@ -154,7 +174,7 @@ AUTOLOAD cat << 'EOF' | tee zf.php <?php require_once '%{php_home}/Fedora/Autoloader/autoload.php'; -$dir = dirname(dirname(__DIR__)) . '/%{namespace}/%{library}'; +$dir = dirname(dirname(__DIR__)) . '/%{namespace}/%{library}%{major}'; \Fedora\Autoloader\Dependencies::required([ '%{php_home}/%{namespace}/ZendFrameworkBridge/autoload.php', $dir . '/autoload.php', @@ -173,11 +193,11 @@ EOF %install : Laminas library mkdir -p %{buildroot}%{php_home}/%{namespace}/ -cp -pr src %{buildroot}%{php_home}/%{namespace}/%{library} +cp -pr src %{buildroot}%{php_home}/%{namespace}/%{library}%{major} : Zend equiv -mkdir -p %{buildroot}%{php_home}/Zend/%{library} -cp -pr zf.php %{buildroot}%{php_home}/Zend/%{library}/autoload.php +mkdir -p %{buildroot}%{php_home}/Zend/%{library}%{major} +cp -pr zf.php %{buildroot}%{php_home}/Zend/%{library}%{major}/autoload.php %check @@ -186,32 +206,28 @@ cp -pr zf.php %{buildroot}%{php_home}/Zend/%{library}/autoload.php cat <<'BOOTSTRAP' | tee bootstrap.php <?php -require_once '%{buildroot}%{phpdir}/%{namespace}/Diactoros/autoload.php'; -\Fedora\Autoloader\Autoload::addPsr4('%{namespace}Test\\Diactoros\\', __DIR__.'/test'); +require_once '%{buildroot}%{phpdir}/%{namespace}/%{library}%{major}/autoload.php'; +\Fedora\Autoloader\Autoload::addPsr4('%{namespace}Test\\%{library}\\', __DIR__.'/test'); \Fedora\Autoloader\Autoload::addPsr4('Http\\Psr7Test\\', __DIR__.'/psr7/src'); - -\Fedora\Autoloader\Dependencies::required(array( - __DIR__.'/test/TestAsset/Functions.php', - __DIR__.'/test/TestAsset/SapiResponse.php', -)); +\Fedora\Autoloader\Autoload::addPsr4('Interop\\Http\\Factory\\', __DIR__.'/factory/test'); BOOTSTRAP : Upstream tests -# Skip testReasonPhraseDefaultsAgainstIana requiring network access +# Skip tests requiring network access RETURN_CODE=0 for CMDARG in "php %{phpunit}" php72 php73 php74; do if which $CMDARG; then set $CMDARG - $1 ${2:-%{_bindir}/phpunit6} \ + $1 ${2:-%{_bindir}/phpunit7} \ --bootstrap bootstrap.php \ - --filter '^((?!(testReasonPhraseDefaultsAgainstIana)).)*$' \ + --filter '^((?!(testReasonPhraseDefaultsAgainstIana|testIsNotSeekable|testIsNotWritable|testIsNotReadable|testRewindNotSeekable)).)*$' \ --verbose || RETURN_CODE=1 fi done : check compat autoloader php -r ' -require "%{buildroot}%{php_home}/Zend/%{library}/autoload.php"; +require "%{buildroot}%{php_home}/Zend/%{library}%{major}/autoload.php"; exit (class_exists("\\Zend\\%{library}\\Request") ? 0 : 1); ' @@ -227,11 +243,19 @@ exit $RETURN_CODE %license LICENSE %doc *.md %doc composer.json -%{php_home}/Zend/%{library} -%{php_home}/%{namespace}/%{library} +%{php_home}/Zend/%{library}%{major} +%{php_home}/%{namespace}/%{library}%{major} %changelog +* Wed Jan 22 2020 Remi Collet <remi@remirepo.net> - 2.2.2-1 +- update to 2.2.2 +- rename to php-laminas-diactoros2 +- install to /usr/share/php/Laminas/Diactoros2 +- raise dependency on PHP 7.1 +- add dependency on psr/http-factory +- switch to phpunit7 + * Fri Jan 17 2020 Remi Collet <remi@remirepo.net> - 1.8.7p1-2 - cleanup |