summaryrefslogtreecommitdiffstats
path: root/php-phpspec-prophecy.spec
blob: d9e227fad917cc36cae71942251f4360a6f7c028 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# remirepo/fedora spec file for php-phpspec-prophecy
#
# Copyright (c) 2015-2018 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%global bootstrap    0
%global gh_commit    4ba436b55987b4bf311cb7c6ba82aa528aac0a06
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner     phpspec
%global gh_project   prophecy
%if %{bootstrap}
# no test because of circular dependency with phpspec
%global with_tests   0%{?_with_tests:1}
%else
%global with_tests   0%{!?_without_tests:1}
%endif

Name:           php-phpspec-prophecy
Version:        1.8.0
Release:        1%{?dist}
Summary:        Highly opinionated mocking framework for PHP

License:        MIT
URL:            https://github.com/%{gh_owner}/%{gh_project}
Source0:        %{name}-%{version}-%{gh_short}.tgz
Source2:        makesrc.sh

# Autoloader
Source1:        %{name}-autoload.php

BuildArch:      noarch
%if %{with_tests}
# from composer.json, "require-dev": {
#        "phpspec/phpspec": "^2.5|^3.2"
#        "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1"
BuildRequires:  php-composer(phpspec/phpspec) >= 2.5
# Autoloader
BuildRequires:  php-composer(fedora/autoloader)
%endif

# from composer.json, "requires": {
#        "php":                               "^5.3|^7.0",
#        "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0",
#        "sebastian/comparator":              "^1.1|^2.0|^3.0",
#        "doctrine/instantiator":             "^1.0.2",
#        "sebastian/recursion-context":       "^1.0|^2.0|^3.0"
Requires:       php(language) >= 5.3
%if 0%{?fedora} >= 27
Requires:       (php-composer(phpdocumentor/reflection-docblock) >= 2.0   with php-composer(phpdocumentor/reflection-docblock) < 5)
Requires:       (php-composer(sebastian/comparator)              >= 1.1   with php-composer(sebastian/comparator)              < 4)
# recursion-context will be pulled by phpspec or phpunit or phpunit6
#Requires:      (php-composer(sebastian/recursion-context)       >= 1.0   with php-composer(sebastian/recursion-context)       < 4)
# use 1.0.4 to ensure we have the autoloader
Requires:       (php-composer(doctrine/instantiator)             >= 1.0.4 with php-composer(doctrine/instantiator)             < 2)
%else
Requires:       php-composer(phpdocumentor/reflection-docblock) >= 2.0
# ignore v4 for now
Requires:       php-composer(phpdocumentor/reflection-docblock) <  4
Requires:       php-composer(sebastian/comparator)              >= 1.1
Requires:       php-composer(sebastian/comparator)              <  3
# recursion-context will be pulled by phpspec or phpunit or phpunit6
#Requires:       php-composer(sebastian/recursion-context)       >= 1.0
#Requires:       php-composer(sebastian/recursion-context)       <  4
# use 1.0.4 to ensure we have the autoloader
Requires:       php-composer(doctrine/instantiator)             >= 1.0.4
Requires:       php-composer(doctrine/instantiator)             <  2
%endif
# From phpcompatinfo report for version 1.1.0
Requires:       php-pcre
Requires:       php-reflection
Requires:       php-spl
# Autoloader
Requires:       php-composer(fedora/autoloader)

Provides:       php-composer(phpspec/prophecy) = %{version}


%description
Prophecy is a highly opinionated yet very powerful and flexible PHP object
mocking framework.

Though initially it was created to fulfil phpspec2 needs, it is flexible enough
to be used inside any testing framework out there with minimal effort.


%prep
%setup -q -n %{gh_project}-%{gh_commit}

cp %{SOURCE1} src/Prophecy/autoload.php


%build
# Nothing


%install
mkdir -p     %{buildroot}%{_datadir}/php
cp -pr src/* %{buildroot}%{_datadir}/php


%check
%if %{with_tests}
: check autoloader
php %{buildroot}%{_datadir}/php/Prophecy/autoload.php

: check phpspec
phpspec --version
VER=$(phpspec --version | sed -n -e 's/.* //;s/\..*$//;p')
if [ $VER -ge 4 ]; then
  : phpspec $VER is too recent
  exit 0
fi

ret=0
for cmd in php php70 php71 php72 php73; do
  if which $cmd; then
    $cmd -d include_path=.:%{buildroot}%{_datadir}/php:%{_datadir}/php \
      %{_bindir}/phpspec run --format pretty --verbose --no-ansi || ret=1
  fi
done
exit $ret
%else
: Test suite disabled
%endif


%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.md
%doc composer.json
%{_datadir}/php/Prophecy


%changelog
* Mon Aug 20 2018 Remi Collet <remi@remirepo.net> - 1.8.0-1
- update to 1.8.0

* Thu Apr 19 2018 Remi Collet <remi@remirepo.net> - 1.7.6-1
- update to 1.7.6

* Tue Feb 20 2018 Remi Collet <remi@remirepo.net> - 1.7.5-1
- Update to 1.7.5

* Mon Feb 12 2018 Remi Collet <remi@remirepo.net> - 1.7.4-1
- Update to 1.7.4
- use range dependency on F27+

* Mon Nov 27 2017 Remi Collet <remi@remirepo.net> - 1.7.3-1
- Update to 1.7.3

* Tue Sep  5 2017 Remi Collet <remi@remirepo.net> - 1.7.2-1
- Update to 1.7.2

* Mon Sep  4 2017 Remi Collet <remi@remirepo.net> - 1.7.1-1
- Update to 1.7.1
- use git snapshot for sources
- skip test with phpspec v4

* Thu Apr 13 2017 Shawn Iwinski <shawn@iwin.ski> - 1.7.0-4
- Prepare for php-phpdocumentor-reflection-docblock =>
  php-phpdocumentor-reflection-docblock2 dependency rename
- Update autoloader to try loading newest
  php-composer(phpdocumentor/reflection-docblock), then try loading older v2,
  then trigger an error if neither are found in include path

* Sat Mar  4 2017 Remi Collet <remi@remirepo.net> - 1.7.0-3
- drop implicit dependency on sebastian/recursion-context

* Fri Mar  3 2017 Remi Collet <remi@remirepo.net> - 1.7.0-2
- fix autoloader for dep. with multiple versions

* Fri Mar  3 2017 Remi Collet <remi@remirepo.net> - 1.7.0-1
- Update to 1.7.0

* Tue Nov 22 2016 Remi Collet <remi@fedoraproject.org> - 1.6.2-1
- update to 1.6.2
- allow sebastian/recursion-context 2.0
- switch to fedora/autoloader

* Tue Jun  7 2016 Remi Collet <remi@fedoraproject.org> - 1.6.1-1
- update to 1.6.1

* Mon Feb 15 2016 Remi Collet <remi@fedoraproject.org> - 1.6.0-1
- update to 1.6.0
- add dependency on sebastian/recursion-context
- run test suite with both PHP 5 and 7 when available
- ignore 1 failed spec with PHP 7
  open https://github.com/phpspec/prophecy/issues/258

* Wed Oct 28 2015 Remi Collet <remi@fedoraproject.org> - 1.5.0-2
- fix autolaoder, rely on include_path for symfony/class-loader

* Thu Aug 13 2015 Remi Collet <remi@fedoraproject.org> - 1.5.0-1
- update to 1.5.0

* Mon Jun 29 2015 Remi Collet <remi@fedoraproject.org> - 1.4.1-4
- use symfony/class-loader
- enable test suite

* Tue Apr 28 2015 Remi Collet <remi@fedoraproject.org> - 1.4.1-1
- update to 1.4.1

* Sun Mar 29 2015 Remi Collet <remi@fedoraproject.org> - 1.4.0-1
- update to 1.4.0
- add dependency on sebastian/comparator

* Fri Feb 13 2015 Remi Collet <remi@fedoraproject.org> - 1.3.1-1
- initial package