From f3f0ea7f0e6f471d0f10e277262ba276f56aea83 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 16 May 2017 07:36:59 +0200 Subject: sync with Fedora --- .gitignore | 7 ++++ php-mnapoli-phpunit-easymock.spec | 79 ++++++++++++++++----------------------- 2 files changed, 40 insertions(+), 46 deletions(-) create mode 100644 .gitignore 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-mnapoli-phpunit-easymock.spec b/php-mnapoli-phpunit-easymock.spec index a2fe4bf..74c9c7a 100644 --- a/php-mnapoli-phpunit-easymock.spec +++ b/php-mnapoli-phpunit-easymock.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-mnapoli-phpunit-easymock # -# Copyright (c) 2016 Shawn Iwinski +# Copyright (c) 2016-2017 Shawn Iwinski # # License: MIT # http://opensource.org/licenses/MIT @@ -31,7 +31,7 @@ Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 1%{?github_release}%{?dist} +Release: 3%{?github_release}%{?dist} Summary: Helpers to build PHPUnit mocks Group: Development/Libraries @@ -43,28 +43,28 @@ URL: https://github.com/%{github_owner}/%{github_name} Source0: %{name}-%{github_version}-%{github_commit}.tar.gz Source1: %{name}-get-source.sh -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-composer(phpunit/phpunit) +BuildRequires: php-composer(phpunit/phpunit-mock-objects) < %{phpunit_mock_objects_max_ver} BuildRequires: php-composer(phpunit/phpunit-mock-objects) >= %{phpunit_mock_objects_min_ver} +BuildRequires: php-composer(phpunit/phpunit) ## phpcompatinfo (computed from version 0.2.3) 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(phpunit/phpunit-mock-objects) >= %{phpunit_mock_objects_min_ver} +Requires: php(language) >= %{php_min_ver} Requires: php-composer(phpunit/phpunit-mock-objects) < %{phpunit_mock_objects_max_ver} +Requires: php-composer(phpunit/phpunit-mock-objects) >= %{phpunit_mock_objects_min_ver} # phpcompatinfo (computed from version 0.2.3) # # Autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} @@ -78,74 +78,56 @@ Autoloader: %{phpdir}/EasyMock/autoload.php %prep %setup -qn %{github_name}-%{github_commit} + +%build + : Create autoloader cat <<'AUTOLOAD' | tee src/autoload.php register(); -} - -$fedoraClassLoader->addPrefix('EasyMock\\', dirname(__DIR__)); +\Fedora\Autoloader\Autoload::addPsr4('EasyMock\\', __DIR__); -// Required dependency -require_once '%{phpdir}/PHPUnit/Framework/MockObject/Autoload.php'; - -return $fedoraClassLoader; +\Fedora\Autoloader\Dependencies::required(array( + '%{phpdir}/PHPUnit/Framework/MockObject/Autoload.php', +)); AUTOLOAD -%build -# Empty build section, nothing to build - - %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{phpdir}/EasyMock cp -rp src/* %{buildroot}%{phpdir}/EasyMock/ %check %if %{with_tests} -: Make PSR-0 tests -mkdir -p tests-psr0/EasyMock -ln -s ../../tests tests-psr0/EasyMock/Test - : Create tests bootstrap cat <<'BOOTSTRAP' | tee bootstrap.php addPrefix('EasyMock\\Test\\', __DIR__.'/tests-psr0'); +require_once '%{buildroot}%{phpdir}/EasyMock/autoload.php'; +\Fedora\Autoloader\Autoload::addPsr4('EasyMock\\Test\\', __DIR__.'/tests'); BOOTSTRAP -: Run tests -%{_bindir}/phpunit --verbose --bootstrap bootstrap.php - -if which php70; then - php70 %{_bindir}/phpunit --verbose --bootstrap bootstrap.php -fi +: Upstream tests +RETURN_CODE=0 +PHPUNIT=$(which phpunit) +for PHP_EXEC in "" %{?rhel: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 @@ -154,6 +136,11 @@ rm -rf %{buildroot} %changelog +* Mon May 15 2017 Shawn Iwinski - 0.2.3-3 +- Switch autoloader to php-composer(fedora/autoloader) +- Add max versions to build dependencies +- Test with SCLs if available + * Mon Jun 13 2016 Remi Collet - 0.2.3-1 - Updated to 0.2.3 -- cgit