diff options
author | Remi Collet <remi@remirepo.net> | 2020-03-17 15:33:29 +0100 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2020-03-17 15:33:29 +0100 |
commit | 1ec67a54adff45052e581bd66ea3c579d69a3a19 (patch) | |
tree | 8839ed6b5fd308f3be4a5d43a0d553435be8caa7 | |
parent | 08a997c4b658e416525815b91a8bf26320798af1 (diff) |
-rw-r--r-- | composer.json | 10 | ||||
l--------- | makesrc.sh | 1 | ||||
-rw-r--r-- | php-behat-mink-driver-testsuite-bootstrap.patch | 26 | ||||
-rwxr-xr-x | php-behat-mink-get-source.sh | 9 | ||||
-rw-r--r-- | php-behat-mink-pull-736.patch | 29 | ||||
-rw-r--r-- | php-behat-mink.spec | 201 |
6 files changed, 111 insertions, 165 deletions
diff --git a/composer.json b/composer.json index 2ebdacb..8b5e0e5 100644 --- a/composer.json +++ b/composer.json @@ -16,17 +16,21 @@ "require": { "php": ">=5.3.1", - "symfony/css-selector": "~2.1|~3.0" + "symfony/css-selector": "^2.7|^3.0|^4.0|^5.0" }, "require-dev": { - "symfony/phpunit-bridge": "~2.7|~3.0" + "symfony/debug": "^2.7|^3.0|^4.0", + "symfony/phpunit-bridge": "^3.4.38 || ^5.0.5", + "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20" + }, "suggest": { "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)", "behat/mink-goutte-driver": "fast headless driver for any app without JS emulation", "behat/mink-selenium2-driver": "slow, but JS-enabled driver for any app (requires Selenium2)", + "dmore/chrome-mink-driver": "fast and JS-enabled driver for any app (requires chromium or google chrome)", "behat/mink-zombie-driver": "fast and JS-enabled headless driver for any app (requires node.js)" }, @@ -44,7 +48,7 @@ "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.8.x-dev" } } } diff --git a/makesrc.sh b/makesrc.sh new file mode 120000 index 0000000..ec167ca --- /dev/null +++ b/makesrc.sh @@ -0,0 +1 @@ +php-behat-mink-get-source.sh
\ No newline at end of file diff --git a/php-behat-mink-driver-testsuite-bootstrap.patch b/php-behat-mink-driver-testsuite-bootstrap.patch deleted file mode 100644 index 7ed656b..0000000 --- a/php-behat-mink-driver-testsuite-bootstrap.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/driver-testsuite/bootstrap.php b/driver-testsuite/bootstrap.php -index f69a45b..ff6c7d1 100644 ---- a/driver-testsuite/bootstrap.php -+++ b/driver-testsuite/bootstrap.php -@@ -1,20 +1,6 @@ - <?php - --$file = __DIR__.'/../../../autoload.php'; -- --if (!file_exists($file)) { -- echo PHP_EOL.'The Mink driver testsuite expects Mink to be installed as a composer dependency of your project'.PHP_EOL; -- exit(1); --} -- --/** @var \Composer\Autoload\ClassLoader $loader */ --$loader = require $file; -- --$loader->addPsr4('Behat\Mink\Tests\Driver\\', __DIR__.'/tests'); -- --// Clean the global variables --unset($file); --unset($loader); -+require_once __DIR__ . '/autoload.php'; - - // Check the definition of the driverLoaderFactory - diff --git a/php-behat-mink-get-source.sh b/php-behat-mink-get-source.sh index 1d762fb..4a51e05 100755 --- a/php-behat-mink-get-source.sh +++ b/php-behat-mink-get-source.sh @@ -24,6 +24,10 @@ else SPEC=`ls *.spec | head -1` fi +SPEC_DIR=`pwd` + +print "SPEC_DIR = $SPEC_DIR" + NAME=`echo $SPEC | sed 's#\.spec##'` VERSION=`egrep '%global\s*github_version' $SPEC | awk '{print $3}'` @@ -43,8 +47,6 @@ print "GIT_REPO = $GIT_REPO" print "GIT_DIR = $GIT_DIR" TEMP_DIR=$(mktemp --dir) -TAR_FILE=${PWD}/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz -CMP_FILE=${PWD}/composer.json pushd $TEMP_DIR print "Cloning git repo..." @@ -53,7 +55,7 @@ pushd $TEMP_DIR pushd $GIT_DIR print "Checking out commit..." $GIT checkout $GIT_COMMIT - cp composer.json $CMP_FILE + cp composer.json ${SPEC_DIR}/composer.json popd TAR_DIR=${GIT_NAME}-${GIT_COMMIT} @@ -61,6 +63,7 @@ pushd $TEMP_DIR mv $GIT_DIR $TAR_DIR + TAR_FILE=${SPEC_DIR}/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz print "TAR_FILE = $TAR_FILE" [ -e $TAR_FILE ] && rm -f $TAR_FILE diff --git a/php-behat-mink-pull-736.patch b/php-behat-mink-pull-736.patch deleted file mode 100644 index ceab27a..0000000 --- a/php-behat-mink-pull-736.patch +++ /dev/null @@ -1,29 +0,0 @@ -From ff4933f553ad32ff7ed4cc0b2d311420f53b7655 Mon Sep 17 00:00:00 2001 -From: Shawn Iwinski <siwinski@redhat.com> -Date: Thu, 11 May 2017 23:02:24 -0400 -Subject: [PATCH] [Selector/NamedSelector] Fix PHP 7.2 count() errors - ---- - src/Selector/NamedSelector.php | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/src/Selector/NamedSelector.php b/src/Selector/NamedSelector.php -index d1936cc..600d891 100644 ---- a/src/Selector/NamedSelector.php -+++ b/src/Selector/NamedSelector.php -@@ -199,11 +199,13 @@ public function registerNamedXpath($name, $xpath) - */ - public function translateToXPath($locator) - { -- if (2 < count($locator)) { -+ $isArray = is_array($locator); -+ -+ if ($isArray && (2 < count($locator))) { - throw new \InvalidArgumentException('NamedSelector expects array(name, locator) as argument'); - } - -- if (2 == count($locator)) { -+ if ($isArray && (2 == count($locator))) { - $selector = $locator[0]; - $locator = $locator[1]; - } else { diff --git a/php-behat-mink.spec b/php-behat-mink.spec index 5e6bc7f..d45c2e3 100644 --- a/php-behat-mink.spec +++ b/php-behat-mink.spec @@ -1,8 +1,8 @@ -# remirepo spec for php-guzzlehttp-ringphp, from Fedora: +# remirepo spec for php-behat-mink, from Fedora: # # Fedora spec file for php-behat-mink # -# 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,72 +12,105 @@ %global github_owner minkphp %global github_name Mink -%global github_version 1.7.1 -%global github_commit e6930b9c74693dff7f4e58577e1b1743399f3ff9 +%global github_version 1.8.1 +%global github_commit 07c6a9fe3fa98c2de074b25d9ed26c22904e3887 %global composer_vendor behat %global composer_project mink +%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.1" %global php_min_ver 5.3.1 -# "symfony/css-selector": "~2.1|~3.0" -# NOTE: Min version not 2.1 because autoloader required -%global symfony_min_ver %{?el6:2.3.31}%{!?el6:2.7.1} -%global symfony_max_ver 4.0 +# "symfony/css-selector": "^2.7|^3.0|^4.0|^5.0" +%if %{with_symfony2} +# NOTE: Min version not 2.7 because autoloader required +%global symfony_min_ver 2.7.1 +%else +%global symfony_min_ver 3.0 +%endif +%global symfony_max_ver 6.0 + +# PHPUnit +%if 0%{?fedora} >= 28 || 0%{?rhel} >= 8 +%global phpunit_require phpunit7 +%global phpunit_exec phpunit7 +%else +%global phpunit_require php-composer(phpunit/phpunit) +%global phpunit_exec phpunit +%endif # 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: 5%{?dist} +Release: 1%{?dist} Summary: Browser controller/emulator abstraction for PHP -Group: Development/Libraries License: MIT URL: http://mink.behat.org/ -# GitHub export does not include tests. -# Run php-behat-mink-get-source.sh to create full source. +# GitHub export does not include tests +# Run php-behat-mink-get-source.sh to create full source Source0: %{name}-%{github_version}-%{github_commit}.tar.gz Source1: %{name}-get-source.sh - -# Modify driver testsuite bootstrap -Patch0: %{name}-driver-testsuite-bootstrap.patch -# [Selector/NamedSelector] Fix PHP 7.2 count() errors -# https://github.com/minkphp/Mink/pull/736 -# https://github.com/minkphp/Mink/pull/736.patch -Patch1: %{name}-pull-736.patch +# Test suite +Source2: 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} ## composer.json BuildRequires: php(language) >= %{php_min_ver} -BuildRequires: php-composer(phpunit/phpunit) +BuildRequires: %{phpunit_require} +%if %{with_range_dependencies} +BuildRequires: (php-composer(symfony/css-selector) >= %{symfony_min_ver} with php-composer(symfony/css-selector) < %{symfony_max_ver}) +%else BuildRequires: php-composer(symfony/css-selector) < %{symfony_max_ver} BuildRequires: php-composer(symfony/css-selector) >= %{symfony_min_ver} -## phpcompatinfo (computed from version 1.7.1) +%endif +## phpcompatinfo (computed from version 1.8.1) BuildRequires: php-dom -BuildRequires: php-gd -BuildRequires: php-json BuildRequires: php-mbstring BuildRequires: php-pcre BuildRequires: php-reflection -BuildRequires: php-session BuildRequires: php-spl +### Test suite (computed from commit 9ce01154e5331640d2a4f2b9791baf19bb0f4a5d) +BuildRequires: php-date +BuildRequires: php-gd +BuildRequires: php-json +BuildRequires: php-session ## Autoloader BuildRequires: php-composer(fedora/autoloader) %endif # composer.json Requires: php(language) >= %{php_min_ver} +%if %{with_range_dependencies} +Requires: (php-composer(symfony/css-selector) >= %{symfony_min_ver} with php-composer(symfony/css-selector) < %{symfony_max_ver}) +%else Requires: php-composer(symfony/css-selector) >= %{symfony_min_ver} Requires: php-composer(symfony/css-selector) < %{symfony_max_ver} -# phpcompatinfo (computed from version 1.7.1) +%endif +# phpcompatinfo (computed from version 1.8.1) Requires: php-mbstring Requires: php-pcre Requires: php-spl @@ -87,6 +120,9 @@ Requires: php-composer(fedora/autoloader) # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} +# Obsolete test suite sub-package +Obsoletes: %{name}-driver-testsuite < %{version}-%{release} + %description One of the most important parts in the web is a browser. Browser is the window through which web users interact with web applications and other users. Users @@ -105,44 +141,9 @@ Autoloader: %{phpdir}/Behat/Mink/autoload.php [1] http://mink.behat.org/en/latest/at-a-glance.html -# ------------------------------------------------------------------------------ - -%package driver-testsuite - -Summary: Mink driver testsuite -Group: Development/Libraries - -Requires: %{name} = %{version}-%{release} -# phpcompatinfo (computed from version 1.7.0) -Requires: php-gd -Requires: php-json -Requires: php-pcre -Requires: php-reflection -Requires: php-session -Requires: php-spl - -# Bundled -## driver-testsuite/web-fixtures/js/jquery-1.6.2-min.js -Provides: bundled(js-jquery1) = 1.6.2 -## driver-testsuite/web-fixtures/js/jquery-ui-1.8.14.custom.min.js -Provides: bundled(js-jquery-ui) = 1.8.14 - -%description driver-testsuite -%{summary}. - -Autoloader: %{testsdir}/%{name}-driver-testsuite/autoload.php -Bootstrap: %{testsdir}/%{name}-driver-testsuite/boostrap.php - -# ------------------------------------------------------------------------------ %prep -%setup -qn %{github_name}-%{github_commit} - -: Patch driver testsuite bootstrap -%patch0 -p1 - -: [Selector/NamedSelector] Fix PHP 7.2 count function errors -%patch1 -p1 +%setup -qn %{github_name}-%{github_commit} -a 2 %build @@ -159,64 +160,52 @@ require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; \Fedora\Autoloader\Dependencies::required(array( array( + '%{phpdir}/Symfony5/Component/CssSelector/autoload.php', + '%{phpdir}/Symfony4/Component/CssSelector/autoload.php', '%{phpdir}/Symfony3/Component/CssSelector/autoload.php', +%if %{with_symfony2} '%{phpdir}/Symfony/Component/CssSelector/autoload.php', +%endif ), )); AUTOLOAD -: Create driver testsuite autoloader -cat <<'AUTOLOAD' | tee driver-testsuite/autoload.php -<?php -/** - * Autoloader for %{name} and its' dependencies - * (created by %{name}-%{version}-%{release}). - */ -require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; - -\Fedora\Autoloader\Autoload::addPsr4('Behat\\Mink\\Tests\\Driver\\', __DIR__.'/tests'); - -\Fedora\Autoloader\Dependencies::required(array( - '%{phpdir}/Behat/Mink/autoload.php', -)); -AUTOLOAD - %install : Library -mkdir -p %{buildroot}%{phpdir}/Behat/Mink -cp -pr src/* %{buildroot}%{phpdir}/Behat/Mink/ - -: Driver testsuite -mkdir -p %{buildroot}%{testsdir} -cp -pr driver-testsuite %{buildroot}%{testsdir}/%{name}-driver-testsuite +mkdir -p %{buildroot}%{phpdir}/Behat +cp -pr src %{buildroot}%{phpdir}/Behat/Mink %check %if %{with_tests} -: Create tests autoloader -cat <<'AUTOLOAD' | tee bootstrap.php +: Setup driver testsuite +mkdir -p vendor/mink +ln -s ../../driver-testsuite-%{testsuite_github_commit} vendor/mink/driver-testsuite + +: Create mock Composer autoloader +cat <<'AUTOLOAD' | tee vendor/autoload.php <?php require_once '%{buildroot}%{phpdir}/Behat/Mink/autoload.php'; -\Fedora\Autoloader\Autoload::addPsr4('Behat\\Mink\\Tests\\', __DIR__.'/tests'); + +\Fedora\Autoloader\Autoload::addPsr4('Behat\\Mink\\Tests\\', 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'); AUTOLOAD -%if 0%{?el6} -: Skip tests requiring PHPUnit with the "willReturn" function -sed 's/function testCreateNodeElements/function SKIP_testCreateNodeElements/' \ - -i tests/Driver/CoreDriverTest.php -sed 's/function testGetResponseHeader/function SKIP_testGetResponseHeader/' \ - -i tests/SessionTest.php -sed 's/function testAddressEqualsEmptyPath/function SKIP_testAddressEqualsEmptyPath/' \ - -i tests/WebAssertTest.php -%endif +: Remove SymfonyTestsListener +sed \ + -e '/SymfonyTestsListener/d' \ + -e '/listeners>/d' \ + phpunit.xml.dist > phpunit.xml : Upstream tests RETURN_CODE=0 -PHPUNIT=$(which phpunit) -for PHP_EXEC in "" %{?rhel:php54 php55} php56 php70 php71 php72; do +PHPUNIT=$(which %{phpunit_exec}) +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 @@ -233,12 +222,16 @@ exit $RETURN_CODE %dir %{phpdir}/Behat %{phpdir}/Behat/Mink -%files driver-testsuite -%dir %{testsdir} - %{testsdir}/%{name}-driver-testsuite - %changelog +* Tue Mar 17 2020 Shawn Iwinski <shawn@iwin.ski> - 1.8.1-1 +- Update to 1.8.1 (RHBZ #1812690) +- Obsolete test suite sub-package +- Testsuite as source to ensure proper version/commit +- Conditionally use range dependencies +- Conditionally drop Symfony 2 interoperability +- Conditionally use PHPUnit 7 + * Fri Sep 22 2017 Shawn Iwinski <shawn@iwin.ski> - 1.7.1-5 - Fix autoloader for Symfony 3 |