diff options
author | Remi Collet <remi@remirepo.net> | 2017-09-22 15:06:12 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2017-09-22 15:06:12 +0200 |
commit | 894ded843470ac2f29b46f3c59c2df39a02b9c6d (patch) | |
tree | b32d768bc7a25c6cedbc8fc9532996db4ac222b4 | |
parent | d7296609d640e72dd30d3d2f4fbd1f7d40fc895f (diff) |
sync with fedora
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | php-symfony-psr-http-message-bridge-upstream-pull-31.patch | 137 | ||||
-rw-r--r-- | php-symfony-psr-http-message-bridge.spec | 134 |
3 files changed, 221 insertions, 57 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ab5c4f --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/php-symfony-psr-http-message-bridge-upstream-pull-31.patch b/php-symfony-psr-http-message-bridge-upstream-pull-31.patch new file mode 100644 index 0000000..9d0ca3c --- /dev/null +++ b/php-symfony-psr-http-message-bridge-upstream-pull-31.patch @@ -0,0 +1,137 @@ +From f5c46f0ff42ac4cd2557a48a14bdb85c6f48d65f Mon Sep 17 00:00:00 2001 +From: Christian Flothmann <christian.flothmann@sensiolabs.de> +Date: Thu, 4 May 2017 21:07:18 +0200 +Subject: [PATCH] test suite compatibility with PHPUnit 6 + +--- + .travis.yml | 17 +++++++++-------- + Tests/Factory/DiactorosFactoryTest.php | 9 +++++++-- + Tests/Factory/HttpFoundationFactoryTest.php | 4 ++-- + composer.json | 2 +- + 4 files changed, 19 insertions(+), 13 deletions(-) + +diff --git a/.travis.yml b/.travis.yml +index 3008471..da2f48c 100644 +--- a/.travis.yml ++++ b/.travis.yml +@@ -5,6 +5,7 @@ sudo: false + cache: + directories: + - $HOME/.composer/cache/files ++ - $HOME/symfony-bridge/.phpunit + + matrix: + include: +@@ -13,9 +14,9 @@ matrix: + - php: 5.5 + - php: 5.6 + - php: 5.3 +- env: deps=low ++ env: COMPOSER_OPTIONS="--prefer-lowest --prefer-stable" SYMFONY_DEPRECATIONS_HELPER=weak + - php: 5.6 +- env: deps=high ++ env: COMPOSER_OPTIONS="" SYMFONY_DEPRECATIONS_HELPER=weak + - php: 7.0 + - php: hhvm + allow_failures: +@@ -25,7 +26,9 @@ matrix: + env: + global: + - deps=no +- - SYMFONY_DEPRECATIONS_HELPER=weak ++ - SYMFONY_DEPRECATIONS_HELPER=strict ++ - SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit" ++ - COMPOSER_OPTIONS="--prefer-stable" + + before_install: + - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi; +@@ -37,10 +40,8 @@ before_install: + + install: + - if [ "$TRAVIS_PHP_VERSION" != "5.3" ]; then composer require --no-update zendframework/zend-diactoros; fi; +- - if [ "$deps" = "no" ]; then export SYMFONY_DEPRECATIONS_HELPER=strict; fi; +- - if [ "$deps" = "no" ]; then composer --prefer-source install; fi; +- - if [ "$deps" = "high" ]; then composer --prefer-source update; fi; +- - if [ "$deps" = "low" ]; then composer --prefer-source --prefer-lowest --prefer-stable update; fi; ++ - composer update --prefer-source $COMPOSER_OPTIONS ++ - vendor/bin/simple-phpunit install + + script: +- - phpunit ++ - vendor/bin/simple-phpunit +diff --git a/Tests/Factory/DiactorosFactoryTest.php b/Tests/Factory/DiactorosFactoryTest.php +index ddf0806..fbc1ce8 100644 +--- a/Tests/Factory/DiactorosFactoryTest.php ++++ b/Tests/Factory/DiactorosFactoryTest.php +@@ -11,6 +11,7 @@ + + namespace Symfony\Bridge\PsrHttpMessage\Tests\Factory; + ++use PHPUnit\Framework\TestCase; + use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory; + use Symfony\Component\HttpFoundation\BinaryFileResponse; + use Symfony\Component\HttpFoundation\Cookie; +@@ -22,7 +23,7 @@ + /** + * @author Kévin Dunglas <dunglas@gmail.com> + */ +-class DiactorosFactoryTest extends \PHPUnit_Framework_TestCase ++class DiactorosFactoryTest extends TestCase + { + private $factory; + private $tmpDir; +@@ -143,7 +144,11 @@ public function testCreateResponse() + $this->assertEquals('Response content.', $psrResponse->getBody()->__toString()); + $this->assertEquals(202, $psrResponse->getStatusCode()); + $this->assertEquals(array('2.8'), $psrResponse->getHeader('X-Symfony')); +- $this->assertEquals(array('city=Lille; expires=Wed, 13-Jan-2021 22:23:01 GMT; path=/; httponly'), $psrResponse->getHeader('Set-Cookie')); ++ ++ $cookieHeader = $psrResponse->getHeader('Set-Cookie'); ++ $this->assertInternalType('array', $cookieHeader); ++ $this->assertCount(1, $cookieHeader); ++ $this->assertRegExp('{city=Lille; expires=Wed, 13-Jan-2021 22:23:01 GMT;( max-age=\d+;)? path=/; httponly}', $cookieHeader[0]); + } + + public function testCreateResponseFromStreamed() +diff --git a/Tests/Factory/HttpFoundationFactoryTest.php b/Tests/Factory/HttpFoundationFactoryTest.php +index 47ef4e3..8790a20 100644 +--- a/Tests/Factory/HttpFoundationFactoryTest.php ++++ b/Tests/Factory/HttpFoundationFactoryTest.php +@@ -11,6 +11,7 @@ + + namespace Symfony\Bridge\PsrHttpMessage\Tests\Factory; + ++use PHPUnit\Framework\TestCase; + use Psr\Http\Message\UploadedFileInterface; + use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory; + use Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\Response; +@@ -22,7 +23,7 @@ + /** + * @author Kévin Dunglas <dunglas@gmail.com> + */ +-class HttpFoundationFactoryTest extends \PHPUnit_Framework_TestCase ++class HttpFoundationFactoryTest extends TestCase + { + /** @var HttpFoundationFactory */ + private $factory; +@@ -198,7 +199,6 @@ public function testCreateResponse() + 'theme=light', + 'test', + 'ABC=AeD; Domain=dunglas.fr; Path=/kevin; Expires=Wed, 13 Jan 2021 22:23:01 GMT; Secure; HttpOnly', +- + ), + ), + new Stream('The response body'), +diff --git a/composer.json b/composer.json +index ad25080..90412ac 100644 +--- a/composer.json ++++ b/composer.json +@@ -21,7 +21,7 @@ + "symfony/http-foundation": "~2.3|~3.0" + }, + "require-dev": { +- "symfony/phpunit-bridge": "~2.7|~3.0" ++ "symfony/phpunit-bridge": "~3.2" + }, + "suggest": { + "psr/http-message-implementation": "To use the HttpFoundation factory", diff --git a/php-symfony-psr-http-message-bridge.spec b/php-symfony-psr-http-message-bridge.spec index 38acc15..aed1ecc 100644 --- a/php-symfony-psr-http-message-bridge.spec +++ b/php-symfony-psr-http-message-bridge.spec @@ -1,9 +1,8 @@ # remirepo spec file for php-symfony-psr-http-message-bridge, from: # -# # Fedora spec file for php-symfony-psr-http-message-bridge # -# Copyright (c) 2015 Shawn Iwinski <shawn.iwinski@gmail.com> +# Copyright (c) 2015-2017 Shawn Iwinski <shawn.iwinski@gmail.com> # # License: MIT # http://opensource.org/licenses/MIT @@ -13,8 +12,8 @@ %global github_owner symfony %global github_name psr-http-message-bridge -%global github_version 0.2 -%global github_commit dc7e308e1dc2898a46776e2221a643cb08315453 +%global github_version 1.0.0 +%global github_commit 66085f246d3893cbdbcec5f5ad15ac60546cf0de %global composer_vendor symfony %global composer_project psr-http-message-bridge @@ -25,7 +24,8 @@ %global psr_http_message_min_ver 1.0 %global psr_http_message_max_ver 2.0 # "symfony/http-foundation": "~2.3|~3.0" -%global symfony_min_ver %{?el6:2.3.31}%{!?el6:2.7.3} +# NOTE: Min version not 2.3 because autoloader required +%global symfony_min_ver %{?el6:2.3.31}%{!?el6:2.7.1} %global symfony_max_ver 4.0 %global with_zend_diactoros 0%{!?el6:1} @@ -37,7 +37,7 @@ Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 2%{?github_release}%{?dist} +Release: 3%{?github_release}%{?dist} Summary: Symfony PSR HTTP message bridge Group: Development/Libraries @@ -45,114 +45,123 @@ License: MIT URL: https://github.com/%{github_owner}/%{github_name} Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +# Fix test suite with !el6 and zendframework/zend-diactoros +# https://github.com/symfony/psr-http-message-bridge/pull/31 +Patch0: %{name}-upstream-pull-31.patch + BuildArch: noarch # Tests %if %{with_tests} %if %{with_zend_diactoros} BuildRequires: php-composer(zendframework/zend-diactoros) %endif -BuildRequires: %{_bindir}/phpunit +BuildRequires: php-composer(phpunit/phpunit) ## composer.json -BuildRequires: php(language) >= %{php_min_ver} -BuildRequires: php-composer(psr/http-message) >= %{psr_http_message_min_ver} +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(psr/http-message) < %{psr_http_message_max_ver} +BuildRequires: php-composer(psr/http-message) >= %{psr_http_message_min_ver} +BuildRequires: php-composer(symfony/http-foundation) < %{symfony_max_ver} BuildRequires: php-composer(symfony/http-foundation) >= %{symfony_min_ver} -## phpcompatinfo (computed from version 0.2) +## phpcompatinfo (computed from version 1.0.0) BuildRequires: php-date BuildRequires: php-reflection BuildRequires: php-spl ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif # composer.json -Requires: php(language) >= %{php_min_ver} -Requires: php-composer(psr/http-message) >= %{psr_http_message_min_ver} -Requires: php-composer(psr/http-message) < %{psr_http_message_max_ver} -Requires: php-composer(symfony/http-foundation) >= %{symfony_min_ver} +Requires: php(language) >= %{php_min_ver} +Requires: php-composer(psr/http-message) < %{psr_http_message_max_ver} +Requires: php-composer(psr/http-message) >= %{psr_http_message_min_ver} Requires: php-composer(symfony/http-foundation) < %{symfony_max_ver} -# phpcompatinfo (computed from version 0.2) +Requires: php-composer(symfony/http-foundation) >= %{symfony_min_ver} +# phpcompatinfo (computed from version 1.0.0) Requires: php-date Requires: php-spl # Autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) + +# Weak dependencies +%if 0%{?fedora} >= 21 +Suggests: php-composer(psr/http-message-implementation) +%if %{with_zend_diactoros} +Suggests: php-composer(zendframework/zend-diactoros) +%endif +%endif # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} %description Provides integration for PSR7. -%if %{with_zend_diactoros} -Optional: -* php-zendframework-zend-diactoros: To use the Zend Diactoros factory -%endif + +Autoloader: %{phpdir}/Symfony/Bridge/PsrHttpMessage/autoload.php %prep %setup -qn %{github_name}-%{github_commit} +%if 0%{!?el6:1} +%patch0 -p1 +%endif + + +%build : Create autoloader cat <<'AUTOLOAD' | tee autoload.php <?php /** * Autoloader for %{name} and its' dependencies - * - * Created by %{name}-%{version}-%{release} - * - * @return \Symfony\Component\ClassLoader\ClassLoader + * (created by %{name}-%{version}-%{release}). */ +require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; -if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) { - if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) { - require_once '%{phpdir}/Symfony/Component/ClassLoader/ClassLoader.php'; - } - - $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader(); - $fedoraClassLoader->register(); -} +\Fedora\Autoloader\Autoload::addPsr4('Symfony\\Bridge\\PsrHttpMessage\\', __DIR__); -$fedoraClassLoader->addPrefix('Symfony\\Bridge\\PsrHttpMessage\\', dirname(dirname(dirname(__DIR__)))); +\Fedora\Autoloader\Dependencies::required(array( + '%{phpdir}/Psr/Http/Message/autoload.php', + array( + '%{phpdir}/Symfony3/Component/HttpFoundation/autoload.php', + '%{phpdir}/Symfony/Component/HttpFoundation/autoload.php', + ), +)); +AUTOLOAD -require_once '%{phpdir}/Psr/Http/Message/autoload.php'; -require_once '%{phpdir}/Symfony/Component/HttpFoundation/autoload.php'; %if %{with_zend_diactoros} +cat <<'AUTOLOAD' | tee -a autoload.php -if (file_exists('%{phpdir}/Zend/Diactoros/autoload.php')) { - require_once '%{phpdir}/Zend/Diactoros/autoload.php'; -} -%endif - -return $fedoraClassLoader; +\Fedora\Autoloader\Dependencies::optional(array( + '%{phpdir}/Zend/Diactoros/autoload.php', +)); AUTOLOAD - - -%build -# Empty build section, nothing required +%endif %install -rm -rf %{buildroot} - mkdir -p %{buildroot}%{phpdir}/Symfony/Bridge/PsrHttpMessage cp -rp *.php Factory Tests %{buildroot}%{phpdir}/Symfony/Bridge/PsrHttpMessage/ %check %if %{with_tests} -: Run tests -%{_bindir}/phpunit --verbose \ - --bootstrap %{buildroot}%{phpdir}/Symfony/Bridge/PsrHttpMessage/autoload.php +: Upstream tests +RETURN_CODE=0 +PHPUNIT=$(which phpunit) +for PHP_EXEC in "" %{?rhel:php54 php55} php56 php70 php71 php72; do + if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then + $PHP_EXEC $PHPUNIT --verbose \ + --bootstrap %{buildroot}%{phpdir}/Symfony/Bridge/PsrHttpMessage/autoload.php \ + || RETURN_CODE=1 + fi +done +exit $RETURN_CODE %else : Tests skipped %endif -%clean -rm -rf %{buildroot} - - %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE %doc *.md @@ -162,6 +171,17 @@ rm -rf %{buildroot} %changelog +* Thu Sep 21 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.0.0-3 +- Allow Symfony 3 +- Modify tests +- Apply patch to fix test suite with !el6 and zendframework/zend-diactoros + +* Sat Apr 15 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.0.0-1 +- Update to 1.0.0 (RHBZ #1370802) +- Add max versions to BuildRequires +- Switch autoloader to php-composer(fedora/autoloader) +- Test with SCLs if available + * Wed Aug 5 2015 Remi Collet <remi@remirepo.net> - 0.2-2 - backport for #remirepo |