summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore7
-rw-r--r--php-behat-mink-pull-736.patch29
-rw-r--r--php-behat-mink.spec134
3 files changed, 96 insertions, 74 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-behat-mink-pull-736.patch b/php-behat-mink-pull-736.patch
new file mode 100644
index 0000000..ceab27a
--- /dev/null
+++ b/php-behat-mink-pull-736.patch
@@ -0,0 +1,29 @@
+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 b0e526f..1a5ed73 100644
--- a/php-behat-mink.spec
+++ b/php-behat-mink.spec
@@ -2,7 +2,7 @@
#
# Fedora spec file for php-behat-mink
#
-# Copyright (c) 2015 Shawn Iwinski <shawn@iwin.ski>
+# Copyright (c) 2015-2017 Shawn Iwinski <shawn@iwin.ski>
#
# License: MIT
# http://opensource.org/licenses/MIT
@@ -33,7 +33,7 @@
Name: php-%{composer_vendor}-%{composer_project}
Version: %{github_version}
-Release: 1%{?dist}
+Release: 3%{?dist}
Summary: Browser controller/emulator abstraction for PHP
Group: Development/Libraries
@@ -47,14 +47,18 @@ 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
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
# Tests
%if %{with_tests}
## composer.json
-BuildRequires: php(language) >= %{php_min_ver}
+BuildRequires: php(language) >= %{php_min_ver}
BuildRequires: php-composer(phpunit/phpunit)
+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)
BuildRequires: php-dom
@@ -66,11 +70,11 @@ BuildRequires: php-reflection
BuildRequires: php-session
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(language) >= %{php_min_ver}
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)
@@ -78,7 +82,7 @@ Requires: php-mbstring
Requires: php-pcre
Requires: php-spl
# Autoloader
-Requires: php-composer(symfony/class-loader)
+Requires: php-composer(fedora/autoloader)
# Composer
Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
@@ -134,31 +138,12 @@ Bootstrap: %{testsdir}/%{name}-driver-testsuite/boostrap.php
%prep
%setup -qn %{github_name}-%{github_commit}
-: Make PSR-0 driver testsuite tests
-# Separate "tests-psr0" and "tests" directories so driver testsuite users (other
-# packages) do not need to update their code
-mkdir -p driver-testsuite/tests-psr0/Behat/Mink/Tests/
-ln -s ../../../../tests driver-testsuite/tests-psr0/Behat/Mink/Tests/Driver
-
-: Create driver testsuite autoloader
-cat <<'AUTOLOAD' | tee driver-testsuite/autoload.php
-<?php
-/**
- * Autoloader for %{name}-driver-testsuite and its' dependencies
- * (created by %{name}-driver-testsuite-%{version}-%{release}).
- *
- * @return \Symfony\Component\ClassLoader\ClassLoader
- */
-
-$fedoraClassLoader = require '%{phpdir}/Behat/Mink/autoload.php';
-$fedoraClassLoader->addPrefix('Behat\\Mink\\Tests\\Driver\\', __DIR__ . '/tests-psr0');
-
-return $fedoraClassLoader;
-AUTOLOAD
-
: Patch driver testsuite bootstrap
%patch0 -p1
+: [Selector/NamedSelector] Fix PHP 7.2 count function errors
+%patch1 -p1
+
%build
: Create library autoloader
@@ -167,30 +152,34 @@ cat <<'AUTOLOAD' | tee src/autoload.php
/**
* Autoloader for %{name} and its' dependencies
* (created by %{name}-%{version}-%{release}).
- *
- * @return \Symfony\Component\ClassLoader\ClassLoader
*/
+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';
- }
+\Fedora\Autoloader\Autoload::addPsr4('Behat\\Mink\\', __DIR__);
- $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader();
- $fedoraClassLoader->register();
-}
+\Fedora\Autoloader\Dependencies::required(array(
+ '%{phpdir}/Symfony/Component/CssSelector/autoload.php',
+));
+AUTOLOAD
-$fedoraClassLoader->addPrefix('Behat\\Mink\\', dirname(dirname(__DIR__)));
+: 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';
-require_once '%{phpdir}/Symfony/Component/CssSelector/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('Behat\\Mink\\Tests\\Driver\\', __DIR__.'/tests');
-return $fedoraClassLoader;
+\Fedora\Autoloader\Dependencies::required(array(
+ '%{phpdir}/Behat/Mink/autoload.php',
+));
AUTOLOAD
%install
-rm -rf %{buildroot}
-
: Library
mkdir -p %{buildroot}%{phpdir}/Behat/Mink
cp -pr src/* %{buildroot}%{phpdir}/Behat/Mink/
@@ -202,49 +191,38 @@ cp -pr driver-testsuite %{buildroot}%{testsdir}/%{name}-driver-testsuite
%check
%if %{with_tests}
-: Make PSR-0 tests
-mkdir -p tests-psr0/Behat/Mink/
-ln -s ../../../tests tests-psr0/Behat/Mink/Tests
-
: Create tests autoloader
-cat <<'AUTOLOAD' | tee tests-psr0/autoload.php
+cat <<'AUTOLOAD' | tee bootstrap.php
<?php
-$fedoraClassLoader = require_once '%{buildroot}%{phpdir}/Behat/Mink/autoload.php';
-$fedoraClassLoader->addPrefix('Behat\\Mink\\Tests\\', __DIR__);
+require_once '%{buildroot}%{phpdir}/Behat/Mink/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('Behat\\Mink\\Tests\\', __DIR__.'/tests');
AUTOLOAD
-%if 0%{?el5}
-sed -e 's/function testEscapedSelectors/function SKIP_testEscapedSelectors/' \
- -e 's/function testSelectors/function SKIP_testSelectors/' \
- -i tests/Selector/NamedSelectorTest.php
+%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
-: Run tests
-run=0
-ret=0
-if which php56; then
- php56 %{_bindir}/phpunit --bootstrap tests-psr0/autoload.php || ret=1
- run=1
-fi
-if which php71; then
- php71 %{_bindir}/phpunit --bootstrap tests-psr0/autoload.php || ret=1
- run=1
-fi
-if [ $run -eq 0 ]; then
-%{_bindir}/phpunit --verbose --bootstrap tests-psr0/autoload.php
-fi
-exit $ret
+: 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 bootstrap.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
@@ -258,6 +236,14 @@ rm -rf %{buildroot}
%changelog
+* Fri May 12 2017 Shawn Iwinski <shawn@iwin.ski> - 1.7.1-3
+- Switch autoloader to php-composer(fedora/autoloader)
+- Add max versions to build dependencies
+- Test with SCLs if available
+
+* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.1-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
+
* Tue Aug 09 2016 Shawn Iwinski <shawn@iwin.ski> - 1.7.1-1
- Updated to 1.7.1 (RHBZ #1314987)