summaryrefslogtreecommitdiffstats
path: root/php-phpspec-prophecy.spec
blob: 1c83f6f2dd15d45a0485b03ef5eceeb2293a1e39 (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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# remirepo/fedora spec file for php-phpspec-prophecy
#
# Copyright (c) 2015-2021 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%global gh_commit    d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner     phpspec
%global gh_project   prophecy

%bcond_without       tests

Name:           php-phpspec-prophecy
Version:        1.14.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

BuildArch:      noarch
BuildRequires:  php(language) >= 7.2
%if %{with tests}
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
BuildRequires:  (php-composer(phpdocumentor/reflection-docblock) >= 5.2   with php-composer(phpdocumentor/reflection-docblock) < 6)
BuildRequires:  (php-composer(sebastian/comparator)              >= 3.0   with php-composer(sebastian/comparator)              < 5)
BuildRequires:  (php-composer(sebastian/recursion-context)       >= 3.0   with php-composer(sebastian/recursion-context)       < 5)
BuildRequires:  (php-composer(doctrine/instantiator)             >= 1.2   with php-composer(doctrine/instantiator)             < 2)
# remirepo:6
%else
BuildRequires:  php-phpdocumentor-reflection-docblock5           >= 5.2
BuildRequires:  php-sebastian-comparator3
BuildRequires:  php-sebastian-recursion-context3
BuildRequires:  php-doctrine-instantiator                        >= 1.2
%endif
# from composer.json, "require-dev": {
#        "phpspec/phpspec": "^6.0 | ^7.0"
#        "phpunit/phpunit": "^8.0 || ^9.0"
BuildRequires:  php-composer(phpspec/phpspec) >= 6.0
%global phpunit %{_bindir}/phpunit9
BuildRequires:  %{phpunit}
%endif
# Autoloader
BuildRequires:  php-fedora-autoloader-devel

# from composer.json, "requires": {
#        "php":                               "^7.2 || ~8.0, <8.2",
#        "phpdocumentor/reflection-docblock": "^5.2",
#        "sebastian/comparator":              "^3.0|^4.0",
#        "doctrine/instantiator":             "^1.2",
#        "sebastian/recursion-context":       "^3.0|^4.0"
Requires:       php(language) >= 7.2
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
Requires:       (php-composer(phpdocumentor/reflection-docblock) >= 5.2   with php-composer(phpdocumentor/reflection-docblock) < 6)
Requires:       (php-composer(sebastian/comparator)              >= 3.0   with php-composer(sebastian/comparator)              < 5)
Requires:       (php-composer(sebastian/recursion-context)       >= 3.0   with php-composer(sebastian/recursion-context)       < 5)
Requires:       (php-composer(doctrine/instantiator)             >= 1.2   with php-composer(doctrine/instantiator)             < 2)
# remirepo:6
%else
Requires:       php-phpdocumentor-reflection-docblock5           >= 5.2
Requires:       php-sebastian-comparator3
Requires:       php-sebastian-recursion-context3
Requires:       php-doctrine-instantiator                        >= 1.2
%endif
# From phpcompatinfo report for version 1.11.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}


%build
phpab --template fedora --output src/Prophecy/autoload.php src
cat << 'EOF' | tee -a src/Prophecy/autoload.php

\Fedora\Autoloader\Dependencies::required([
    '%{_datadir}/php/Doctrine/Instantiator/autoload.php',
    '%{_datadir}/php/phpDocumentor/Reflection/DocBlock5/autoload.php',
]);
if (!class_exists('SebastianBergmann\\Comparator\\Comparator')) { // v2 from phpunit, v1 from phpspec
    \Fedora\Autoloader\Dependencies::required([
        [
            '%{_datadir}/php/SebastianBergmann/Comparator4/autoload.php',
            '%{_datadir}/php/SebastianBergmann/Comparator3/autoload.php',
        ],
    ]);
}
if (!class_exists('SebastianBergmann\\RecursionContext\\Context')) { // v2 from phpunit, v1 from phpspec
    \Fedora\Autoloader\Dependencies::required([
        [
            '%{_datadir}/php/SebastianBergmann/RecursionContext4/autoload.php',
            '%{_datadir}/php/SebastianBergmann/RecursionContext3/autoload.php',
        ],
    ]);
}
EOF


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


%check
%if %{with tests}
: Dev autoloader
mkdir vendor
phpab --output vendor/autoload.php fixtures

cat << 'EOF' | tee -a vendor/autoload.php
require_once '%{buildroot}%{_datadir}/php/Prophecy/autoload.php';
EOF

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

: check phpspec
phpspec --version

ret=0
# ignore it_can_not_double_an_enum on all version. Not ready
for cmdarg in "php %{phpunit}" php73 php74 php80 php81; do
  if which $cmdarg; then
    set $cmdarg
    $1 -d auto_prepend_file=vendor/autoload.php \
      %{_bindir}/phpspec run --format pretty --verbose --no-ansi || ret=1

    $1 -d auto_prepend_file=vendor/autoload.php \
       ${2:-%{_bindir}/phpunit9} \
         --filter '^((?!(it_can_not_double_an_enum)).)*$' \
         || ret=1
  fi
done
exit $ret
%else
: Test suite disabled
%endif


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


%changelog
* Fri Sep 10 2021 Remi Collet <remi@remirepo.net> - 1.14.0-1
- update to 1.14.0

* Thu Mar 18 2021 Remi Collet <remi@remirepo.net> - 1.13.0-1
- update to 1.13.0

* Mon Dec 21 2020 Remi Collet <remi@remirepo.net> - 1.12.2-1
- update to 1.12.2
- switch to phpunit9

* Tue Sep 29 2020 Remi Collet <remi@remirepo.net> - 1.12.1-1
- update to 1.12.1

* Mon Sep 28 2020 Remi Collet <remi@remirepo.net> - 1.12.0-2
- switch to classmap autoloader

* Mon Sep 28 2020 Remi Collet <remi@remirepo.net> - 1.12.0-1
- update to 1.12.0
- raise dependency on phpdocumentor/reflection-docblock 5.2

* Wed Jul  8 2020 Remi Collet <remi@remirepo.net> - 1.11.1-1
- update to 1.11.1

* Wed Jul  8 2020 Remi Collet <remi@remirepo.net> - 1.11.0-1
- update to 1.11.0
- raise dependency on PHP 7.2
- raise dependency on phpdocumentor/reflection-docblock 5.0
- raise dependency on sebastian/comparator 3.0
- raise dependency on doctrine/instantiator 1.2
- raise dependency on sebastian/recursion-context 3.0

* Fri Mar  6 2020 Remi Collet <remi@remirepo.net> - 1.10.3-1
- update to 1.10.3
- allow phpdocumentor/reflection-docblock 5.0

* Tue Jan 21 2020 Remi Collet <remi@remirepo.net> - 1.10.2-1
- update to 1.10.2
- allow sebastian/comparator 4 and sebastian/recursion-context 4

* Fri Jan  3 2020 Remi Collet <remi@remirepo.net> - 1.10.1-1
- update to 1.10.1

* Thu Dec 19 2019 Remi Collet <remi@remirepo.net> - 1.10.0-1
- update to 1.10.0
- raise dependency on sebastian/comparator 1.2.3

* Fri Oct  4 2019 Remi Collet <remi@remirepo.net> - 1.9.0-1
- update to 1.9.0

* Thu Jun 13 2019 Remi Collet <remi@remirepo.net> - 1.8.1-1
- update to 1.8.1

* Thu Dec  6 2018 Remi Collet <remi@remirepo.net> - 1.8.0-2
- cleanup for EL-8

* 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