From 1fd4a038b3ffb546cbd395b7ccea918875dbe605 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 11 May 2017 07:29:07 +0200 Subject: switch to fedora/autoloader --- php-mock-integration/.gitignore | 7 +++ php-mock-integration/php-mock-integration.spec | 33 +++++++------- php-mock-phpunit/.gitignore | 7 +++ php-mock-phpunit/php-mock-phpunit.spec | 30 +++++++------ php-mock/.gitignore | 7 +++ php-mock/composer.json | 38 +++++++++++++++++ php-mock/php-mock-autoload.php | 18 -------- php-mock/php-mock.spec | 59 ++++++++++++++++---------- 8 files changed, 129 insertions(+), 70 deletions(-) create mode 100644 php-mock-integration/.gitignore create mode 100644 php-mock-phpunit/.gitignore create mode 100644 php-mock/.gitignore create mode 100644 php-mock/composer.json delete mode 100644 php-mock/php-mock-autoload.php diff --git a/php-mock-integration/.gitignore b/php-mock-integration/.gitignore new file mode 100644 index 0000000..1ab5c4f --- /dev/null +++ b/php-mock-integration/.gitignore @@ -0,0 +1,7 @@ +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/php-mock-integration/php-mock-integration.spec b/php-mock-integration/php-mock-integration.spec index 6ad3362..845ee0d 100644 --- a/php-mock-integration/php-mock-integration.spec +++ b/php-mock-integration/php-mock-integration.spec @@ -14,7 +14,7 @@ Name: php-mock-integration Version: 1.0.0 -Release: 2%{?dist} +Release: 4%{?dist} Summary: Integration package for PHP-Mock Group: Development/Libraries @@ -22,15 +22,18 @@ License: WTFPL URL: https://github.com/%{gh_owner}/%{gh_project} Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: php(language) >= 5.5 %if %{with_tests} # from composer.json, "require-dev": { # "phpunit/phpunit": "^4|^5" +BuildRequires: php-composer(php-mock/php-mock) < 2 BuildRequires: php-composer(php-mock/php-mock) >= 1 +BuildRequires: php-composer(phpunit/php-text-template) < 2 BuildRequires: php-composer(phpunit/php-text-template) >= 1 BuildRequires: php-composer(phpunit/phpunit) > 4 +# For autoloader +BuildRequires: php-composer(fedora/autoloader) %endif # from composer.json, "require": { @@ -63,7 +66,6 @@ This is a support package for PHP-Mock integration into other frameworks. %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{_datadir}/php/ mkdir -p %{buildroot}%{_datadir}/php/phpmock cp -pr classes %{buildroot}%{_datadir}/php/phpmock/integration @@ -74,26 +76,24 @@ cp -pr classes %{buildroot}%{_datadir}/php/phpmock/integration mkdir vendor cat << 'EOF' | tee vendor/autoload.php addPrefix('phpmock\\', '%{buildroot}%{_datadir}/php'); +\Fedora\Autoloader\Autoload::addPsr4('phpmock\\', '%{buildroot}%{_datadir}/php/phpmock'); EOF -%{_bindir}/phpunit - -if which php70; then - php70 %{_bindir}/phpunit -fi +ret=0 +for cmd in php php56 php70 php71 php72; do + if which $cmd; then + %{_bindir}/phpunit --verbose || ret=1 + fi +done +exit $ret %else : bootstrap build with test suite disabled %endif -%clean -rm -rf %{buildroot} - - %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE %doc composer.json @@ -102,8 +102,11 @@ rm -rf %{buildroot} %changelog +* Thu May 11 2017 Remi Collet - 1.0.0-4 +- switch to fedora/autoloader + * Mon Feb 22 2016 Remi Collet - 1.0.0-2 - Fix: license is WTFPL * Fri Feb 12 2016 Remi Collet - 1.0.0-1 -- initial package \ No newline at end of file +- initial package diff --git a/php-mock-phpunit/.gitignore b/php-mock-phpunit/.gitignore new file mode 100644 index 0000000..1ab5c4f --- /dev/null +++ b/php-mock-phpunit/.gitignore @@ -0,0 +1,7 @@ +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/php-mock-phpunit/php-mock-phpunit.spec b/php-mock-phpunit/php-mock-phpunit.spec index 3eb6824..af998fc 100644 --- a/php-mock-phpunit/php-mock-phpunit.spec +++ b/php-mock-phpunit/php-mock-phpunit.spec @@ -14,7 +14,7 @@ Name: php-mock-phpunit Version: 1.1.2 -Release: 1%{?dist} +Release: 3%{?dist} Summary: Mock built-in PHP functions with PHPUnit. Group: Development/Libraries @@ -22,12 +22,14 @@ License: WTFPL URL: https://github.com/%{gh_owner}/%{gh_project} Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: php(language) >= 5.5 %if %{with_tests} +BuildRequires: php-composer(php-mock/php-mock-integration) < 2 BuildRequires: php-composer(php-mock/php-mock-integration) >= 1 BuildRequires: php-composer(phpunit/phpunit) > 4 +# For autoloader +BuildRequires: php-composer(fedora/autoloader) %endif # from composer.json, "require": { @@ -64,7 +66,6 @@ No further extension is needed. %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{_datadir}/php/ mkdir -p %{buildroot}%{_datadir}/php/phpmock cp -pr classes %{buildroot}%{_datadir}/php/phpmock/phpunit @@ -75,26 +76,24 @@ cp -pr classes %{buildroot}%{_datadir}/php/phpmock/phpunit mkdir vendor cat << 'EOF' | tee vendor/autoload.php addPrefix('phpmock\\', '%{buildroot}%{_datadir}/php'); +\Fedora\Autoloader\Autoload::addPsr4('phpmock\\', '%{buildroot}%{_datadir}/php/phpmock'); EOF -%{_bindir}/phpunit - -if which php71; then - php71 %{_bindir}/phpunit -fi +ret=0 +for cmd in php php56 php70 php71 php72; do + if which $cmd; then + %{_bindir}/phpunit --verbose || ret=1 + fi +done +exit $ret %else : bootstrap build with test suite disabled %endif -%clean -rm -rf %{buildroot} - - %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE %doc composer.json @@ -103,6 +102,9 @@ rm -rf %{buildroot} %changelog +* Thu May 11 2017 Remi Collet - 1.1.2-3 +- switch to fedora/autoloader + * Thu Jun 16 2016 Remi Collet - 1.1.2-1 - update to 1.1.2 (no change) diff --git a/php-mock/.gitignore b/php-mock/.gitignore new file mode 100644 index 0000000..1ab5c4f --- /dev/null +++ b/php-mock/.gitignore @@ -0,0 +1,7 @@ +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/php-mock/composer.json b/php-mock/composer.json new file mode 100644 index 0000000..b48be43 --- /dev/null +++ b/php-mock/composer.json @@ -0,0 +1,38 @@ +{ + "name": "php-mock/php-mock", + "type": "library", + "description": "PHP-Mock can mock built-in PHP functions (e.g. time()). PHP-Mock relies on PHP's namespace fallback policy. No further extension is needed.", + "keywords": ["mock", "stub", "test double", "function", "test", "TDD", "BDD"], + "homepage": "https://github.com/php-mock/php-mock", + "license": "WTFPL", + "authors": [ + { + "name": "Markus Malkusch", + "email": "markus@malkusch.de", + "homepage": "http://markus.malkusch.de", + "role": "Developer" + } + ], + "autoload": { + "psr-4": { + "phpmock\\": ["classes/", "tests/unit/"] + } + }, + "require": { + "php": ">=5.5", + "phpunit/php-text-template": "^1" + }, + "require-dev": { + "phpunit/phpunit": "^4|^5" + }, + "replace": { + "malkusch/php-mock": "*" + }, + "suggest": { + "php-mock/php-mock-phpunit": "Allows integration into PHPUnit testcase with the trait PHPMock.", + "php-mock/php-mock-mockery": "Allows using PHPMockery for Mockery integration" + }, + "archive": { + "exclude": ["/tests"] + } +} diff --git a/php-mock/php-mock-autoload.php b/php-mock/php-mock-autoload.php deleted file mode 100644 index c0ee5c2..0000000 --- a/php-mock/php-mock-autoload.php +++ /dev/null @@ -1,18 +0,0 @@ -register(); -} - -$fedoraClassLoader->addPrefix('phpmock\\', dirname(__DIR__)); - -// Dependencies -require_once $vendorDir . '/Text/Template/Autoload.php'; diff --git a/php-mock/php-mock.spec b/php-mock/php-mock.spec index 0450cf2..c5de4fd 100644 --- a/php-mock/php-mock.spec +++ b/php-mock/php-mock.spec @@ -14,26 +14,25 @@ Name: php-mock Version: 1.0.1 -Release: 2%{?dist} +Release: 4%{?dist} Summary: PHP-Mock can mock built-in PHP functions Group: Development/Libraries License: WTFPL URL: https://github.com/%{gh_owner}/%{gh_project} Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz -Source1: %{name}-autoload.php -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: php(language) >= 5.5 %if %{with_tests} # from composer.json, "require-dev": { # "phpunit/phpunit": "^4|^5" +BuildRequires: php-composer(phpunit/php-text-template) < 2 BuildRequires: php-composer(phpunit/php-text-template) >= 1 BuildRequires: php-composer(phpunit/phpunit) > 4 %endif # For autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) # from composer.json, "require": { # "php": ">=5.5", @@ -46,7 +45,7 @@ Requires: php-date Requires: php-reflection Requires: php-spl # For autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) %if 0%{?fedora} > 21 # from composer.json, "suggest": { # "php-mock/php-mock-phpunit": "Allows integration into PHPUnit testcase with the trait PHPMock.", @@ -69,7 +68,25 @@ Autoloader: %{_datadir}/php/phpmock/autoload.php %prep %setup -q -n %{gh_project}-%{gh_commit} -cp %{SOURCE1} classes/autoload.php +: Create autoloader +cat << 'AUTOLOAD' | tee classes/autoload.php +addPrefix('phpmock\\', '%{_datadir}/tests'); -EOF %check %if %{with_tests} -%{_bindir}/phpunit --bootstrap %{buildroot}%{_datadir}/php/phpmock/autoload.php - -if which php70; then - php70 %{_bindir}/phpunit --bootstrap %{buildroot}%{_datadir}/php/phpmock/autoload.php -fi +# TODO: local build fails, build in mock is ok +ret=0 +for cmd in php php56 php70 php71 php72; do + if which $cmd; then + %{_bindir}/phpunit --bootstrap %{buildroot}%{_datadir}/php/phpmock/autoload.php --verbose || ret=1 + fi +done +exit $ret %else : bootstrap build with test suite disabled %endif -%clean -rm -rf %{buildroot} - - %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE %doc composer.json @@ -118,8 +128,11 @@ rm -rf %{buildroot} %changelog +* Thu May 11 2017 Remi Collet - 1.0.1-4 +- switch to fedora/autoloader + * Mon Feb 22 2016 Remi Collet - 1.0.1-2 - Fix: license is WTFPL, from review #1306968 * Fri Feb 12 2016 Remi Collet - 1.0.1-1 -- initial package \ No newline at end of file +- initial package -- cgit