summaryrefslogtreecommitdiffstats
path: root/php-mock/php-mock.spec
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2017-05-11 07:29:07 +0200
committerRemi Collet <remi@remirepo.net>2017-05-11 07:29:07 +0200
commit1fd4a038b3ffb546cbd395b7ccea918875dbe605 (patch)
tree2b375a44cac682bd05dd495c15bac63090dc3692 /php-mock/php-mock.spec
parent7360e1427a7917692cc64c6dd1a7159fbf281d6f (diff)
switch to fedora/autoloaderHEADmaster
Diffstat (limited to 'php-mock/php-mock.spec')
-rw-r--r--php-mock/php-mock.spec59
1 files changed, 36 insertions, 23 deletions
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
+<?php
+/* Autoloader for %{name} and its dependencies */
+require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php';
+
+\Fedora\Autoloader\Autoload::addPsr4('phpmock\\', __DIR__);
+\Fedora\Autoloader\Dependencies::required(array(
+ '%{_datadir}/php/Text/Template/Autoload.php',
+));
+AUTOLOAD
+
+cat << 'AUTOLOAD' | tee tests/unit/autoload.php
+<?php
+/* Autoloader for %{name} tests */
+
+require_once '%{_datadir}/php/phpmock/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('phpmock\\', __DIR__);
+AUTOLOAD
%build
@@ -77,38 +94,31 @@ cp %{SOURCE1} classes/autoload.php
%install
-rm -rf %{buildroot}
# Library
mkdir -p %{buildroot}%{_datadir}/php/
cp -pr classes %{buildroot}%{_datadir}/php/phpmock
+
# Unit tests
mkdir -p %{buildroot}%{_datadir}/tests
cp -pr tests/unit %{buildroot}%{_datadir}/tests/phpmock
-cat <<'EOF' | tee %{buildroot}%{_datadir}/tests/phpmock/autoload.php
-<?php
-require_once '%{_datadir}/php/phpmock/autoload.php';
-$fedoraClassLoader->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 <remi@remirepo.net> - 1.0.1-4
+- switch to fedora/autoloader
+
* Mon Feb 22 2016 Remi Collet <remi@fedoraproject.org> - 1.0.1-2
- Fix: license is WTFPL, from review #1306968
* Fri Feb 12 2016 Remi Collet <remi@fedoraproject.org> - 1.0.1-1
-- initial package \ No newline at end of file
+- initial package