diff options
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | php-behat-mink-browserkit-driver.spec | 108 |
2 files changed, 52 insertions, 63 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-browserkit-driver.spec b/php-behat-mink-browserkit-driver.spec index 26e5453..7b16fff 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 Shawn Iwinski <shawn@iwin.ski> +# Copyright (c) 2015-2017 Shawn Iwinski <shawn@iwin.ski> # # License: MIT # http://opensource.org/licenses/MIT @@ -40,7 +40,7 @@ Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 1%{?dist} +Release: 3%{?dist} Summary: Symfony BrowserKit driver for Mink framework Group: Development/Libraries @@ -48,37 +48,42 @@ 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 -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 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} -BuildRequires: php-composer(behat/mink) >= %{mink_min_ver} -BuildRequires: php-composer(silex/silex) >= %{silex_min_ver} +BuildRequires: php(language) >= %{php_min_ver} +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-pcre BuildRequires: php-reflection ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif # composer.json -Requires: php(language) >= %{php_min_ver} -Requires: php-composer(behat/mink) >= %{mink_min_ver} -Requires: php-composer(behat/mink) < %{mink_max_ver} -Requires: php-composer(symfony/browser-kit) >= %{symfony_min_ver} +Requires: php(language) >= %{php_min_ver} +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/dom-crawler) >= %{symfony_min_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) Requires: php-pcre Requires: php-reflection +# Autoloader +BuildRequires: php-composer(fedora/autoloader) # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} @@ -104,35 +109,20 @@ cat <<'AUTOLOAD' | tee src/autoload-browserkit.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'; - } - - $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader(); - $fedoraClassLoader->register(); -} - -$fedoraClassLoader->addPrefix( - 'Behat\\Mink\\Driver\\', - dirname(dirname(dirname(__DIR__))) -); - -require_once '%{phpdir}/Behat/Mink/autoload.php'; -require_once '%{phpdir}/Symfony/Component/BrowserKit/autoload.php'; -require_once '%{phpdir}/Symfony/Component/DomCrawler/autoload.php'; +\Fedora\Autoloader\Autoload::addPsr4('Behat\\Mink\\Driver\\', __DIR__); -return $fedoraClassLoader; +\Fedora\Autoloader\Dependencies::required(array( + '%{phpdir}/Behat/Mink/autoload.php', + '%{phpdir}/Symfony/Component/BrowserKit/autoload.php', + '%{phpdir}/Symfony/Component/DomCrawler/autoload.php', +)); AUTOLOAD %install -rm -rf %{buildroot} - mkdir -p %{buildroot}%{phpdir}/Behat/Mink/Driver cp -pr src/* %{buildroot}%{phpdir}/Behat/Mink/Driver/ @@ -143,47 +133,34 @@ cp -pr src/* %{buildroot}%{phpdir}/Behat/Mink/Driver/ mkdir -p vendor/behat/mink/ ln -s %{testsdir}/php-behat-mink-driver-testsuite vendor/behat/mink/driver-testsuite -: Make PSR-0 tests -mkdir -p tests-psr0/Behat/Mink/Tests -ln -s ../../../../tests tests-psr0/Behat/Mink/Tests/Driver - : Create tests bootstrap cat <<'BOOTSTRAP' | tee bootstrap.php <?php -$fedoraClassLoader = - require '%{buildroot}%{phpdir}/Behat/Mink/Driver/autoload-browserkit.php'; -$fedoraClassLoader->addPrefix('Behat\\Mink\\Tests\\Driver\\', __DIR__ . '/tests-psr0'); +require_once '%{buildroot}%{phpdir}/Behat/Mink/Driver/autoload-browserkit.php'; + +\Fedora\Autoloader\Autoload::addPsr4('Behat\\Mink\\Tests\\Driver\\', __DIR__.'/tests'); -require_once '%{phpdir}/Silex/autoload.php'; -require_once __DIR__ . '/vendor/behat/mink/driver-testsuite/bootstrap.php'; +\Fedora\Autoloader\Dependencies::required(array( + '%{phpdir}/Silex/autoload.php', + '%{testsdir}/php-behat-mink-driver-testsuite/autoload.php', +)); BOOTSTRAP -: Run tests -run=0 -ret=0 -if which php56; then - php56 %{_bindir}/phpunit --bootstrap bootstrap.php || ret=1 - run=1 -fi -if which php71; then - php71 %{_bindir}/phpunit --bootstrap bootstrap.php || ret=1 - run=1 -fi -if [ $run -eq 0 ]; then -%{_bindir}/phpunit --verbose --bootstrap bootstrap.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 @@ -193,6 +170,11 @@ rm -rf %{buildroot} %changelog +* 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 +- Test with SCLs if available + * Tue Aug 09 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.3.2-1 - Updated to 1.3.2 (RHBZ #1300118) |