diff options
Diffstat (limited to 'php-mockery.spec')
-rw-r--r-- | php-mockery.spec | 112 |
1 files changed, 67 insertions, 45 deletions
diff --git a/php-mockery.spec b/php-mockery.spec index 818a9bd..f8159b2 100644 --- a/php-mockery.spec +++ b/php-mockery.spec @@ -1,4 +1,4 @@ -# remirepo spec file for php-deepend-Mockery, from +# remirepo spec file for php-mockery, from # # Fedora spec file for php-deepend-Mockery # @@ -7,50 +7,62 @@ # # Please preserve changelog entries # -%global gh_commit 6fdb61243844dc924071d3404bb23994ea0b6856 +%global gh_commit 1bac8c362b12f522fdd1f1fa3556284c91affa38 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner padraic %global gh_project mockery +%global ns_project Mockery +%global major 1 %global with_tests 0%{!?_without_tests:1} -Name: php-deepend-Mockery -Version: 0.9.9 -Release: 4%{?dist} +Name: php-mockery +Version: 1.0 +Release: 1%{?dist} Summary: Mockery is a simple but flexible PHP mock object framework Group: Development/Libraries License: BSD 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 - -# Autoloader -Source1: %{gh_project}-autoload.php +Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{gh_short}.tar.gz # Use our autoloader Patch0: %{gh_project}-tests.patch -# Upstream patch for 7.2 -Patch1: https://github.com/mockery/mockery/commit/b2f20b33942c2c84bc3b3b169098b448b3e66737.patch -Patch2: https://patch-diff.githubusercontent.com/raw/mockery/mockery/pull/798.patch +# Patch for 7.2 +# From https://github.com/mockery/mockery/pull/798 +Patch2: 798.patch BuildArch: noarch %if %{with_tests} # From composer.json, "require-dev": { -# "phpunit/phpunit": "~4.0" -BuildRequires: php-composer(phpunit/phpunit) >= 4.0 -BuildRequires: php(language) >= 5.3.2 -BuildRequires: php-composer(hamcrest/hamcrest-php) >= 1.1 +# "phpunit/phpunit": "~5.7|~6.1" +%if 0%{?fedora} >= 26 +%global phpunit %{_bindir}/phpunit6 +BuildRequires: phpunit6 +%else +%global phpunit %{_bindir}/phpunit +BuildRequires: php-phpunit-PHPUnit >= 5.7 +%endif +BuildRequires: php(language) >= 5.6.0 +%if 0%{?fedora} >= 27 +BuildRequires: (php-composer(hamcrest/hamcrest-php) >= 2.0 with php-composer(hamcrest/hamcrest-php) < 3) +%else +BuildRequires: php-hamcrest2 +%endif # Autoloader -BuildRequires: php-composer(fedora/autoloader) %endif +BuildRequires: php-fedora-autoloader-devel # From composer.json, "require": { -# "php": ">=5.3.2", +# "php": ">=5.6.0", # "lib-pcre": ">=7.0", -# "hamcrest/hamcrest-php": "~1.1" -Requires: php(language) >= 5.3.2 -Requires: php-composer(hamcrest/hamcrest-php) >= 1.1 -Requires: php-composer(hamcrest/hamcrest-php) < 2 -# From phpcompatinfo report for version 0.9.7 +# "hamcrest/hamcrest-php": "~2.0" +Requires: php(language) >= 5.6.0 +%if 0%{?fedora} >= 27 +Requires: (php-composer(hamcrest/hamcrest-php) >= 2.0 with php-composer(hamcrest/hamcrest-php) < 3) +%else +Requires: php-hamcrest2 +%endif +# From phpcompatinfo report for version 1.0 Requires: php-pcre Requires: php-spl Requires: php-reflection @@ -58,8 +70,6 @@ Requires: php-reflection Requires: php-composer(fedora/autoloader) Provides: php-composer(mockery/mockery) = %{version} -Provides: php-pear(pear.survivethedeepend.com/Mockery) = %{version} -Obsoletes: php-channel-deepend <= 1.3 %description @@ -67,17 +77,26 @@ Mockery is a simple but flexible PHP mock object framework for use in unit testing. It is inspired by Ruby's flexmock and Java's Mockito, borrowing elements from both of their APIs. -To use this library, you just have to add, in your project: - require_once '%{_datadir}/php/Mockery/autoload.php'; +Autoloader: %{_datadir}/php/%{ns_project}%{major}/autoload.php %prep %setup -q -n %{gh_project}-%{gh_commit} -cp %{SOURCE1} library/Mockery/autoload.php +mv library/*.php library/%{ns_project}/ +phpab --template fedora --output library/%{ns_project}/autoload.php library + +cat << 'EOF' | tee -a library/%{ns_project}/autoload.php + +\Fedora\Autoloader\Dependencies::required([ + '/usr/share/php/Hamcrest2/autoload.php', +]); +EOF + %patch0 -p0 -b .rpm -%patch1 -p1 -%patch2 -p1 +%patch2 -p0 -b .test + +rm -f docs/.gitignore %build @@ -86,42 +105,45 @@ cp %{SOURCE1} library/Mockery/autoload.php %install mkdir -p %{buildroot}/%{_datadir}/php -cp -rp library/* %{buildroot}/%{_datadir}/php/ +cp -rp library/%{ns_project} %{buildroot}/%{_datadir}/php/%{ns_project}%{major} %check %if %{with_tests} : Use installed tree and our autoloader -sed -e 's:@BUILD@:%{buildroot}/%{_datadir}/php:' -i tests/Bootstrap.php +export COMPOSER_VENDOR_DIR=%{buildroot}%{_datadir}/php/%{ns_project}%{major} : Run upstream test suite ret=0 -for cmd in php php56 php70 php71 php72; do - if which $cmd; then - $cmd %{_bindir}/phpunit --verbose || ret=1 - fi +for cmd in "php %{phpunit}" php70 php71 php72; do + if which $cmd; then + set $cmd + $1 ${2:-%{_bindir}/phpunit6} \ + --no-coverage \ + --verbose || ret=1 + fi done exit $ret %endif -%post -if [ -x %{_bindir}/pear ]; then - %{_bindir}/pear uninstall --nodeps --ignore-errors --register-only \ - pear.survivethedeepend.com/Mockery >/dev/null || : -fi - %files %{!?_licensedir:%global license %%doc} %license LICENSE -%doc README.md docs +%doc *.md docs %doc composer.json -%{_datadir}/php/Mockery/ -%{_datadir}/php/Mockery.php +%{_datadir}/php/%{ns_project}%{major} %changelog +* Mon Jan 22 2018 Remi Collet <remi@remirepo.net> - 1.0-1 +- Update to 1.0 +- rename to php-mockery and move to /usr/share/php/Mockery1 +- raise dependency on PHP 5.6 +- raise dependency on hamcrest/hamcrest-php 2.0 +- use phpunit6 on F26+ + * Fri Oct 6 2017 Remi Collet <remi@remirepo.net> - 0.9.9-4 - add patches for PHP 7.2 |