diff options
-rw-r--r-- | 0000-Fix-a-test-to-catch-TypeError-instead-of-Exception.patch | 29 | ||||
-rw-r--r-- | composer.json | 9 | ||||
-rw-r--r-- | php-evenement.spec | 100 |
3 files changed, 69 insertions, 69 deletions
diff --git a/0000-Fix-a-test-to-catch-TypeError-instead-of-Exception.patch b/0000-Fix-a-test-to-catch-TypeError-instead-of-Exception.patch deleted file mode 100644 index 9c06cfa..0000000 --- a/0000-Fix-a-test-to-catch-TypeError-instead-of-Exception.patch +++ /dev/null @@ -1,29 +0,0 @@ -From ca430b3bff35f5fd7878a421b761fb6a7e408d75 Mon Sep 17 00:00:00 2001 -From: Randy Barlow <randy@electronsweatshop.com> -Date: Sat, 14 Jan 2017 23:55:50 -0500 -Subject: [PATCH] Fix a test to catch TypeError instead of Exception. - -In PHP 7, TypeError is no longer an Exception but is an Error -instead. This commit adjusts a test case to catch TypeError instead -of Exception. - -Signed-off-by: Randy Barlow <randy@electronsweatshop.com> ---- - tests/Evenement/Tests/EventEmitterTest.php | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/tests/Evenement/Tests/EventEmitterTest.php b/tests/Evenement/Tests/EventEmitterTest.php -index 7eeaa3d..64c5ffc 100644 ---- a/tests/Evenement/Tests/EventEmitterTest.php -+++ b/tests/Evenement/Tests/EventEmitterTest.php -@@ -44,6 +44,7 @@ class EventEmitterTest extends \PHPUnit_Framework_TestCase - $this->emitter->on('foo', 'not a callable'); - $this->fail(); - } catch (\Exception $e) { -+ } catch (\TypeError $e) { - } - } - --- -2.11.0 - diff --git a/composer.json b/composer.json index 88849a8..cbb4827 100644 --- a/composer.json +++ b/composer.json @@ -10,10 +10,10 @@ } ], "require": { - "php": ">=5.4.0" + "php": ">=7.0" }, "require-dev": { - "phpunit/phpunit": "^6.0||^5.7||^4.8.35" + "phpunit/phpunit": "^6.0" }, "autoload": { "psr-0": { @@ -25,10 +25,5 @@ "Evenement": "tests" }, "files": ["tests/Evenement/Tests/functions.php"] - }, - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } } } diff --git a/php-evenement.spec b/php-evenement.spec index 1768bbc..dc72f27 100644 --- a/php-evenement.spec +++ b/php-evenement.spec @@ -7,28 +7,55 @@ # # Please preserve changelog entries # -Name: php-evenement -Version: 2.1.0 -Release: 1%{?dist} -BuildArch: noarch - -License: MIT -Summary: Événement is a very simple event dispatching library for PHP -URL: https://github.com/igorw/evenement -Source0: %{url}/archive/v%{version}.tar.gz - -BuildRequires: php-composer(phpunit/phpunit) +%global github_owner igorw +%global github_name evenement +%global github_version 3.0.1 +%global github_commit 531bfb9d15f8aa57454f5f0285b18bec903b8fb7 + +%global composer_vendor evenement +%global composer_project evenement + +# "php": ">=7.0" +%global php_min_ver 7.0 + +# Build using "--without tests" to disable tests +%global with_tests 0%{!?_without_tests:1} + +%{!?phpdir: %global phpdir %{_datadir}/php} + +Name: php-%{composer_project} +Epoch: 1 +Version: %{github_version} +Release: 1%{?github_release}%{?dist} + +License: MIT +Summary: Événement is a very simple event dispatching library for PHP +URL: https://github.com/%{github_owner}/%{github_name} +Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz + +BuildArch: noarch +# Tests +%if %{with_tests} +## composer.json +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: phpunit6 +## phpcompatinfo (computed from version 3.0.1) +## <none> +## Autoloader BuildRequires: php-composer(fedora/autoloader) -# phpcompatinfo (computed from version 2.1.0) -# <none> +%endif -Requires: php(language) >= 5.4.0 -# This is for the autoloader -Requires: php-composer(fedora/autoloader) -# phpcompatinfo (computed from version 2.1.0) +# composer.json +Requires: php(language) >= %{php_min_ver} +# phpcompatinfo (computed from version 3.0.1) # <none> +# Autoloader +Requires: php-composer(fedora/autoloader) -Provides: php-composer(evenement/evenement) = %{version} +# Standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming +Provides: php-%{composer_vendor}-%{composer_project} = %{epoch}:%{version}-%{release} +# Composer +Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} %description @@ -43,7 +70,7 @@ Autoloader: %{_datadir}/php/Evenement/autoload.php %prep -%setup -q -n evenement-%{version} +%setup -qn %{github_name}-%{github_commit} %build @@ -54,21 +81,21 @@ cat <<'AUTOLOAD' | tee src/Evenement/autoload.php * Autoloader for %{name} and its' dependencies * (created by %{name}-%{version}-%{release}). */ -require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php'; +require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; \Fedora\Autoloader\Autoload::addPsr4('Evenement\\', __DIR__); AUTOLOAD %install -install -d -p -m 0755 %{buildroot}/%{_datadir}/php - -cp -a -r src/Evenement %{buildroot}/%{_datadir}/php/ +mkdir -p %{buildroot}%{phpdir} +cp -rp src/Evenement %{buildroot}%{phpdir}/ %check -: Create tests autoloader -cat <<'AUTOLOAD' | tee autoload.php +%if %{with_tests} +: Create tests bootstrap +cat <<'BOOTSTRAP' | tee bootstrap.php <?php require_once '%{buildroot}%{_datadir}/php/Evenement/autoload.php'; @@ -77,30 +104,37 @@ require_once '%{buildroot}%{_datadir}/php/Evenement/autoload.php'; \Fedora\Autoloader\Dependencies::required([ __DIR__.'/tests/Evenement/Tests/functions.php' ]); -AUTOLOAD - -phpunit --bootstrap autoload.php +BOOTSTRAP : Upstream tests RETURN_CODE=0 -PHPUNIT=$(which phpunit) -for PHP_EXEC in "" %{?rhel:php55} php56 php70 php71 php72; do +PHPUNIT=$(which phpunit6) +for PHP_EXEC in "" php71 php72 php73 php74; do if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then - $PHP_EXEC $PHPUNIT --verbose --bootstrap autoload.php \ + $PHP_EXEC $PHPUNIT --verbose --bootstrap bootstrap.php \ || RETURN_CODE=1 fi done exit $RETURN_CODE +%else +: Tests skipped +%endif %files %{!?_licensedir:%global license %%doc} %license LICENSE -%doc CHANGELOG.md composer.json README.md -%{_datadir}/php/Evenement +%doc *.md +%doc composer.json +%doc doc +%{phpdir}/Evenement %changelog +* Sat Dec 14 2019 Shawn Iwinski <shawn@iwin.ski> - 1:3.0.1-1 +- Update to 3.0.1 (RHBZ #1480022) +- Use PHPUnit 6 + * Sun Sep 10 2017 Shawn Iwinski <shawn@iwin.ski> - 2.1.0-1 - Update to 2.1.0 - Remove now unneeded patch |