summaryrefslogtreecommitdiffstats
path: root/php-cache-integration-tests.spec
blob: e7a28f9ca61914b84c34899a498294e69aa6079a (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
# remirepo spec file for php-cache-integration-tests, from:
#
# Fedora spec file for php-cache-integration-tests
#
# Copyright (c) 2017-2021 Shawn Iwinski <shawn@iwin.ski>
#
# License: MIT
# http://opensource.org/licenses/MIT
#
# Please preserve changelog entries
#

%global github_owner     php-cache
%global github_name      integration-tests
%global github_version   0.17.0
%global github_commit    eda2e6b8bc5abcd623c8047e2345cda38dd6479e

%global composer_vendor  cache
%global composer_project integration-tests

# "php": "^5.4|^7",
%global php_min_ver 5.4
# "psr/cache": "~1.0"
%global psr_cache_min_ver 1.0
%global psr_cache_max_ver 2.0
# "cache/tag-interop": "^1.0"
%global cache_tag_interop_min_ver 1.0
%global cache_tag_interop_max_ver 2.0

%{!?phpdir:  %global phpdir  %{_datadir}/php}

Name:          php-%{composer_vendor}-%{composer_project}
Version:       %{github_version}
Release:       2%{?github_release}%{?dist}
Summary:       Integration tests for PSR-6 and PSR-16 cache implementations

License:       MIT
URL:           http://www.php-cache.com
Source0:       https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz

BuildArch:     noarch
# Minimal autoloader test
BuildRequires: php-cli
BuildRequires: phpunit9
## composer.json
BuildRequires: php(language) >= %{php_min_ver}
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
BuildRequires:(php-composer(cache/tag-interop) >= %{cache_tag_interop_min_ver} with php-composer(cache/tag-interop) <  %{cache_tag_interop_max_ver})
BuildRequires:(php-composer(psr/cache) >= %{psr_cache_min_ver} with php-composer(psr/cache) <  %{psr_cache_max_ver})
# remirepo:6
%else
BuildRequires: php-cache-tag-interop <  %{cache_tag_interop_max_ver}
BuildRequires: php-cache-tag-interop >= %{cache_tag_interop_min_ver}
BuildRequires: php-psr-cache <  %{psr_cache_max_ver}
BuildRequires: php-psr-cache >= %{psr_cache_min_ver}
%endif
## Autoloader
BuildRequires: php-composer(fedora/autoloader)

# composer.json
Requires:      php(language) >= %{php_min_ver}
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
Requires:     (php-composer(cache/tag-interop) >= %{cache_tag_interop_min_ver} with php-composer(cache/tag-interop) <  %{cache_tag_interop_max_ver})
Requires:     (php-composer(psr/cache) >= %{psr_cache_min_ver} with php-composer(psr/cache) <  %{psr_cache_max_ver})
# remirepo:6
%else
Requires:      php-cache-tag-interop <  %{cache_tag_interop_max_ver}
Requires:      php-cache-tag-interop >= %{cache_tag_interop_min_ver}
Requires:      php-psr-cache <  %{psr_cache_max_ver}
Requires:      php-psr-cache >= %{psr_cache_min_ver}
%endif
# phpcompatinfo (computed from version 0.17.0)
Requires:      php-date
# Autoloader
Requires:      php-composer(fedora/autoloader)

# Composer
Provides:      php-composer(%{composer_vendor}/%{composer_project}) = %{version}

%description
This package contains integration tests to make sure your implementation of a
PSR-6 and/or PSR-16 cache follows the rules by PHP-FIG. It is a part of the PHP
Cache organization.

Autoloader: %{phpdir}/Cache/IntegrationTests/autoload.php


%prep
%setup -qn %{github_name}-%{github_commit}

: Remove unnecessary exec bits
chmod a-x composer.json LICENSE


%build
: Create autoloader
cat <<'AUTOLOAD' | tee src/autoload.php
<?php
/**
 * Autoloader for %{name} and its' dependencies
 * (created by %{name}-%{version}-%{release}).
 */
require_once '%{phpdir}/Fedora/Autoloader/autoload.php';

\Fedora\Autoloader\Autoload::addPsr4('Cache\\IntegrationTests\\', __DIR__);

\Fedora\Autoloader\Dependencies::required([
    '%{phpdir}/Cache/TagInterop/autoload.php',
    '%{phpdir}/Psr/Cache/autoload.php',
]);
AUTOLOAD


%install
mkdir -p %{buildroot}%{phpdir}/Cache
cp -rp src %{buildroot}%{phpdir}/Cache/IntegrationTests


%check
: Minimal autoloader test
php -r '
    require_once "%{phpdir}/PHPUnit9/autoload.php";
    require_once "%{buildroot}%{phpdir}/Cache/IntegrationTests/autoload.php";
    exit(class_exists("Cache\\IntegrationTests\\CachePoolTest") ? 0 : 1);
'


%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.md
%doc composer.json
%{phpdir}/Cache/IntegrationTests


%changelog
* Mon May  3 2021 Remi Collet <remi@remirepo.net> - 0.17.0-2
- Fix dependencies: don't require PHPUnit autoloader as
  will always be used from phpunit command, various versions

* Mon May  3 2021 Remi Collet <remi@remirepo.net> - 0.17.0-1
- update to 0.17.0

* Fri Apr 14 2017 Shawn Iwinski <shawn@iwin.ski> - 0.16.0-1
- Initial package