diff options
author | Remi Collet <remi@remirepo.net> | 2017-05-16 07:36:59 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2017-05-16 07:36:59 +0200 |
commit | f3f0ea7f0e6f471d0f10e277262ba276f56aea83 (patch) | |
tree | 85ba41dfba4f446e8cbc4e0970f88efd5c3adddc | |
parent | a611888ab36a1ebb82c227edb5dda739c764dbf3 (diff) |
sync with Fedora
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | php-mnapoli-phpunit-easymock.spec | 79 |
2 files changed, 40 insertions, 46 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-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 <shawn@iwin.ski> +# Copyright (c) 2016-2017 Shawn Iwinski <shawn@iwin.ski> # # 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) # <none> # 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 <?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('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 <?php -$fedoraClassLoader = require '%{buildroot}%{phpdir}/EasyMock/autoload.php'; -$fedoraClassLoader->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 <shawn.iwinski@gmail.com> - 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 <remi@fedoraproject.org> - 0.2.3-1 - Updated to 0.2.3 |