diff options
author | Remi Collet <remi@remirepo.net> | 2020-03-17 15:18:07 +0100 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2020-03-17 15:18:07 +0100 |
commit | ca01ae15951f516f507147a000c10696d9a1a9f5 (patch) | |
tree | 2064a9c1bdc8d069fa5fa0f7a49e7868e425b304 | |
parent | 2c026eb3d02d9d33fbeb10eab70e18390296ad74 (diff) |
-rw-r--r-- | php-behat-mink-browserkit-driver.spec | 131 |
1 files changed, 99 insertions, 32 deletions
diff --git a/php-behat-mink-browserkit-driver.spec b/php-behat-mink-browserkit-driver.spec index 7b16fff..7ab2ff8 100644 --- a/php-behat-mink-browserkit-driver.spec +++ b/php-behat-mink-browserkit-driver.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-behat-mink-browserkit-driver # -# Copyright (c) 2015-2017 Shawn Iwinski <shawn@iwin.ski> +# Copyright (c) 2015-2020 Shawn Iwinski <shawn@iwin.ski> # # License: MIT # http://opensource.org/licenses/MIT @@ -12,74 +12,110 @@ %global github_owner minkphp %global github_name MinkBrowserKitDriver -%global github_version 1.3.2 -%global github_commit 10e67fb4a295efcd62ea0bf16025a85ea19534fb +%global github_version 1.3.4 +%global github_commit e3b90840022ebcd544c7b394a3c9597ae242cbee %global composer_vendor behat %global composer_project mink-browserkit-driver +%global testsuite_github_owner minkphp +%global testsuite_github_name driver-testsuite +%global testsuite_github_commit 9ce01154e5331640d2a4f2b9791baf19bb0f4a5d + +%if 0%{?fedora} >= 32 || 0%{?rhel} >= 8 +%global with_symfony2 0 +%else +%global with_symfony2 1 +%endif + # "php": ">=5.3.6" %global php_min_ver 5.3.6 # "behat/mink": "^1.7.1@dev" %global mink_min_ver 1.7.1 %global mink_max_ver 2.0 -# "silex/silex": "~1.2" -%global silex_min_ver 1.2 -%global silex_max_ver 2.0 -# "symfony/browser-kit": "~2.3|~3.0" -# "symfony/dom-crawler": "~2.3|~3.0" +# "symfony/browser-kit": "~2.3|~3.0|~4.0" +# "symfony/dom-crawler": "~2.3|~3.0|~4.0" +# "symfony/http-kernel": "~2.3|~3.0|~4.0" +%if %{with_symfony2} # NOTE: Min version not 2.3 because autoloader required -%global symfony_min_ver 2.7.1 -%global symfony_max_ver 4.0 +%global symfony_min_ver %{?el6:2.3.31}%{!?el6:2.7.1} +%else +%global symfony_min_ver 3.0 +%endif +%global symfony_max_ver 5.0 # Build using "--without tests" to disable tests %global with_tests 0%{!?_without_tests:1} -%global phpdir %{_datadir}/php -%global testsdir %{_datadir}/tests +# Range dependencies supported? +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +%global with_range_dependencies 1 +%else +%global with_range_dependencies 0 +%endif + +%{!?phpdir: %global phpdir %{_datadir}/php} Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 3%{?dist} +Release: 2%{?dist} Summary: Symfony BrowserKit driver for Mink framework -Group: Development/Libraries License: MIT URL: http://mink.behat.org/en/latest/drivers/browserkit.html Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz +# Test suite +Source1: https://github.com/%{testsuite_github_owner}/%{testsuite_github_name}/archive/%{testsuite_github_commit}/%{name}-testsuite-%{testsuite_github_commit}.tar.gz BuildArch: noarch # Tests %if %{with_tests} BuildRequires: php-composer(phpunit/phpunit) -BuildRequires: php-behat-mink-driver-testsuite ## composer.json BuildRequires: php(language) >= %{php_min_ver} +%if %{with_range_dependencies} +BuildRequires: (php-composer(behat/mink) >= %{mink_min_ver} with php-composer(behat/mink) < %{mink_max_ver}) +BuildRequires: (php-composer(symfony/browser-kit) >= %{symfony_min_ver} with php-composer(symfony/browser-kit) < %{symfony_max_ver}) +BuildRequires: (php-composer(symfony/dom-crawler) >= %{symfony_min_ver} with php-composer(symfony/dom-crawler) < %{symfony_max_ver}) +BuildRequires: (php-composer(symfony/http-kernel) >= %{symfony_min_ver} with php-composer(symfony/http-kernel) < %{symfony_max_ver}) +%else BuildRequires: php-composer(behat/mink) < %{mink_max_ver} BuildRequires: php-composer(behat/mink) >= %{mink_min_ver} -BuildRequires: php-composer(silex/silex) < %{silex_max_ver} -BuildRequires: php-composer(silex/silex) >= %{silex_min_ver} BuildRequires: php-composer(symfony/browser-kit) < %{symfony_max_ver} BuildRequires: php-composer(symfony/browser-kit) >= %{symfony_min_ver} BuildRequires: php-composer(symfony/dom-crawler) < %{symfony_max_ver} BuildRequires: php-composer(symfony/dom-crawler) >= %{symfony_min_ver} -## phpcompatinfo (computed from version 1.3.2) -BuildRequires: php-json +BuildRequires: php-composer(symfony/http-kernel) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/http-kernel) >= %{symfony_min_ver} +%endif +## phpcompatinfo (computed from version 1.3.4) BuildRequires: php-pcre BuildRequires: php-reflection +### Test suite (computed from commit 9ce01154e5331640d2a4f2b9791baf19bb0f4a5d) +BuildRequires: php-date +BuildRequires: php-gd +BuildRequires: php-json +BuildRequires: php-session +BuildRequires: php-spl ## Autoloader BuildRequires: php-composer(fedora/autoloader) %endif # composer.json Requires: php(language) >= %{php_min_ver} +%if %{with_range_dependencies} +Requires: (php-composer(behat/mink) >= %{mink_min_ver} with php-composer(behat/mink) < %{mink_max_ver}) +Requires: (php-composer(symfony/browser-kit) >= %{symfony_min_ver} with php-composer(symfony/browser-kit) < %{symfony_max_ver}) +Requires: (php-composer(symfony/dom-crawler) >= %{symfony_min_ver} with php-composer(symfony/dom-crawler) < %{symfony_max_ver}) +%else Requires: php-composer(behat/mink) < %{mink_max_ver} Requires: php-composer(behat/mink) >= %{mink_min_ver} Requires: php-composer(symfony/browser-kit) < %{symfony_max_ver} Requires: php-composer(symfony/browser-kit) >= %{symfony_min_ver} Requires: php-composer(symfony/dom-crawler) < %{symfony_max_ver} Requires: php-composer(symfony/dom-crawler) >= %{symfony_min_ver} -# phpcompatinfo (computed from version 1.3.2) +%endif +# phpcompatinfo (computed from version 1.3.4) Requires: php-pcre Requires: php-reflection # Autoloader @@ -99,7 +135,7 @@ Autoloader: %{phpdir}/Behat/Mink/Driver/autoload-browserkit.php %prep -%setup -qn %{github_name}-%{github_commit} +%setup -qn %{github_name}-%{github_commit} -a 1 %build @@ -116,8 +152,20 @@ require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; \Fedora\Autoloader\Dependencies::required(array( '%{phpdir}/Behat/Mink/autoload.php', - '%{phpdir}/Symfony/Component/BrowserKit/autoload.php', - '%{phpdir}/Symfony/Component/DomCrawler/autoload.php', + array( + '%{phpdir}/Symfony4/Component/BrowserKit/autoload.php', + '%{phpdir}/Symfony3/Component/BrowserKit/autoload.php', +%if %{with_symfony2} + '%{phpdir}/Symfony/Component/BrowserKit/autoload.php', +%endif + ), + array( + '%{phpdir}/Symfony4/Component/DomCrawler/autoload.php', + '%{phpdir}/Symfony3/Component/DomCrawler/autoload.php', +%if %{with_symfony2} + '%{phpdir}/Symfony/Component/DomCrawler/autoload.php', +%endif + ), )); AUTOLOAD @@ -130,28 +178,36 @@ cp -pr src/* %{buildroot}%{phpdir}/Behat/Mink/Driver/ %check %if %{with_tests} : Setup driver testsuite -mkdir -p vendor/behat/mink/ -ln -s %{testsdir}/php-behat-mink-driver-testsuite vendor/behat/mink/driver-testsuite +mkdir -p vendor/mink +ln -s ../../driver-testsuite-%{testsuite_github_commit} vendor/mink/driver-testsuite -: Create tests bootstrap -cat <<'BOOTSTRAP' | tee bootstrap.php +: Create mock Composer autoloader +cat <<'BOOTSTRAP' | tee vendor/autoload.php <?php require_once '%{buildroot}%{phpdir}/Behat/Mink/Driver/autoload-browserkit.php'; -\Fedora\Autoloader\Autoload::addPsr4('Behat\\Mink\\Tests\\Driver\\', __DIR__.'/tests'); +\Fedora\Autoloader\Autoload::addPsr4('Behat\\Mink\\Tests\\Driver\\', dirname(__DIR__).'/tests'); + +\Fedora\Autoloader\Autoload::addPsr4('Behat\\Mink\\Tests\\Driver\\Util\\', __DIR__.'/mink/driver-testsuite/src'); +\Fedora\Autoloader\Autoload::addPsr4('Behat\\Mink\\Tests\\Driver\\', __DIR__.'/mink/driver-testsuite/tests'); \Fedora\Autoloader\Dependencies::required(array( - '%{phpdir}/Silex/autoload.php', - '%{testsdir}/php-behat-mink-driver-testsuite/autoload.php', + array( + '%{phpdir}/Symfony4/Component/HttpKernel/autoload.php', + '%{phpdir}/Symfony3/Component/HttpKernel/autoload.php', +%if %{with_symfony2} + '%{phpdir}/Symfony/Component/HttpKernel/autoload.php', +%endif + ), )); BOOTSTRAP : Upstream tests RETURN_CODE=0 PHPUNIT=$(which phpunit) -for PHP_EXEC in "" %{?rhel:php54 php55} php56 php70 php71 php72; do +for PHP_EXEC in "" %{?rhel:php54 php55 php56 php70} php71 php72 php73 php74; do if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then - $PHP_EXEC $PHPUNIT --verbose --bootstrap bootstrap.php || RETURN_CODE=1 + $PHP_EXEC $PHPUNIT --verbose || RETURN_CODE=1 fi done exit $RETURN_CODE @@ -170,6 +226,17 @@ exit $RETURN_CODE %changelog +* Tue Mar 17 2020 Shawn Iwinski <shawn@iwin.ski> - 1.3.4-2 +- Conditional Symfony 2 or not +- Fix autoloader for PHP < 5.4 +- Add test suite BuildRequires + +* Tue Mar 17 2020 Shawn Iwinski <shawn@iwin.ski> - 1.3.4-1 +- Update to 1.3.4 (RHBZ #1574132) +- Testsuite as source to ensure proper version/commit +- Conditionally use range dependencies +- Drop Symfony 2 interoperability + * Fri May 12 2017 Shawn Iwinski <shawn@iwin.ski> - 1.3.2-3 - Switch autoloader to php-composer(fedora/autoloader) - Add max versions to build dependencies |