summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2025-02-10 08:34:22 +0100
committerRemi Collet <remi@php.net>2025-02-10 08:34:22 +0100
commitaf2934d736ca70fa91ce64a9e4968ed73ad8891a (patch)
tree11611ea13287f58c35f65271997fb49ce11a1b16
dup
-rw-r--r--.gitignore9
-rw-r--r--Makefile4
-rw-r--r--composer.json104
-rwxr-xr-xmakesrc.sh28
-rw-r--r--php-yoast-phpunit-polyfills3.spec172
5 files changed, 317 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..01f0400
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+clog
+package-*.xml
+*.tgz
+*.tar.bz2
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..91b0fd5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../common/Makefile
+
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..ba28086
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,104 @@
+{
+ "name": "yoast/phpunit-polyfills",
+ "description": "Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests",
+ "license": "BSD-3-Clause",
+ "type": "library",
+ "keywords": [
+ "phpunit",
+ "polyfill",
+ "testing"
+ ],
+ "authors": [
+ {
+ "name": "Team Yoast",
+ "email": "support@yoast.com",
+ "homepage": "https://yoast.com"
+ },
+ {
+ "name": "Contributors",
+ "homepage": "https://github.com/Yoast/PHPUnit-Polyfills/graphs/contributors"
+ }
+ ],
+ "homepage": "https://github.com/Yoast/PHPUnit-Polyfills",
+ "support": {
+ "issues": "https://github.com/Yoast/PHPUnit-Polyfills/issues",
+ "source": "https://github.com/Yoast/PHPUnit-Polyfills",
+ "security": "https://github.com/Yoast/PHPUnit-Polyfills/security/policy"
+ },
+ "require": {
+ "php": ">=7.0",
+ "phpunit/phpunit": "^6.4.4 || ^7.0 || ^8.0 || ^9.0 || ^11.0"
+ },
+ "require-dev": {
+ "php-parallel-lint/php-console-highlighter": "^1.0.0",
+ "php-parallel-lint/php-parallel-lint": "^1.4.0",
+ "yoast/yoastcs": "^3.1.0"
+ },
+ "minimum-stability": "dev",
+ "prefer-stable": true,
+ "autoload": {
+ "files": [
+ "phpunitpolyfills-autoload.php"
+ ]
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Yoast\\PHPUnitPolyfills\\Tests\\": "tests/"
+ }
+ },
+ "config": {
+ "allow-plugins": {
+ "dealerdirect/phpcodesniffer-composer-installer": true
+ },
+ "lock": false
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-main": "3.x-dev"
+ }
+ },
+ "scripts": {
+ "lint7": [
+ "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --show-deprecated --exclude vendor --exclude .git --exclude tests/Polyfills/Fixtures/ValueObjectUnion.php --exclude tests/Polyfills/Fixtures/ValueObjectUnionReturnType.php"
+ ],
+ "lint70": [
+ "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --show-deprecated --exclude vendor --exclude .git --exclude src/Exceptions/Error.php --exclude src/Exceptions/TypeError.php --exclude tests/Polyfills/Fixtures/ValueObjectParamNotRequired.php --exclude tests/Polyfills/Fixtures/ValueObjectNullableReturnType.php --exclude tests/Polyfills/Fixtures/ValueObjectUnion.php --exclude tests/Polyfills/Fixtures/ValueObjectUnionReturnType.php"
+ ],
+ "lint-gte80": [
+ "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --show-deprecated --exclude vendor --exclude .git"
+ ],
+ "lint-gte84": [
+ "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --show-deprecated --exclude vendor --exclude .git"
+ ],
+ "check-cs": [
+ "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --runtime-set testVersion 7.0-"
+ ],
+ "fix-cs": [
+ "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf"
+ ],
+ "test": [
+ "@php ./vendor/phpunit/phpunit/phpunit --no-coverage"
+ ],
+ "coverage": [
+ "@php ./vendor/phpunit/phpunit/phpunit"
+ ],
+ "test10": [
+ "@php ./vendor/phpunit/phpunit/phpunit -c phpunit10.xml.dist --no-coverage"
+ ],
+ "coverage10": [
+ "@php ./vendor/phpunit/phpunit/phpunit -c phpunit10.xml.dist"
+ ]
+ },
+ "scripts-descriptions": {
+ "lint7": "Check the PHP files for parse errors. (PHP 7.1 - 7.4)",
+ "lint70": "Check the PHP files for parse errors. (PHP 7.0)",
+ "lint-gte80": "Check the PHP files for parse errors. (PHP 8.0 - 8.3)",
+ "lint-gte84": "Check the PHP files for parse errors. (PHP 8.4+)",
+ "check-cs": "Check the PHP files for code style violations and best practices.",
+ "fix-cs": "Auto-fix code style violations in the PHP files.",
+ "test": "Run the unit tests without code coverage (PHPUnit < 10).",
+ "coverage": "Run the unit tests with code coverage (PHPUnit < 10).",
+ "test10": "Run the unit tests without code coverage using the PHPUnit 10/11 configuration file.",
+ "coverage10": "Run the unit tests with code coverage using the PHPUnit 10/11 configuration file."
+ }
+}
diff --git a/makesrc.sh b/makesrc.sh
new file mode 100755
index 0000000..f578f06
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+NAME=$(basename $PWD)
+OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec)
+PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec)
+VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec)
+COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec)
+SHORT=${COMMIT:0:7}
+
+echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION, Commit=$COMMIT\n"
+
+echo "Cloning..."
+git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
+
+echo "Getting commit..."
+pushd $PROJECT-$COMMIT
+git checkout $COMMIT || exit 1
+cp composer.json ../composer.json
+popd
+
+echo "Archiving..."
+tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT
+
+echo "Cleaning..."
+rm -rf $PROJECT-$COMMIT
+
+echo "Done."
+
diff --git a/php-yoast-phpunit-polyfills3.spec b/php-yoast-phpunit-polyfills3.spec
new file mode 100644
index 0000000..b586132
--- /dev/null
+++ b/php-yoast-phpunit-polyfills3.spec
@@ -0,0 +1,172 @@
+# remirepo/fedora spec file for php-yoast-phpunit-polyfills
+#
+# SPDX-FileCopyrightText: Copyright 2020-2025 Remi Collet
+# SPDX-License-Identifier: CECILL-2.1
+# http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+#
+# Please preserve changelog entries
+#
+# Github
+%global gh_commit 59b3f8ffa2eab9c8258e8638d97c3e37fac9a80e
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner Yoast
+%global gh_project PHPUnit-Polyfills
+# Packagist
+%global pk_vendor yoast
+%global pk_project phpunit-polyfills
+# Namespace
+%global ns_vendor Yoast
+%global ns_project PHPUnitPolyfills
+# don't change major version used in package name
+%global major 3
+%bcond_without tests
+%global php_home %{_datadir}/php
+
+Name: php-%{pk_vendor}-%{pk_project}
+Version: 3.1.0
+Release: 1%{?dist}
+Summary: Set of polyfills for changed PHPUnit functionality, version %{major}
+
+License: BSD-3-Clause
+URL: https://github.com/%{gh_owner}/%{gh_project}
+# git snapshot to get upstream test suite
+Source0: %{name}-%{version}-%{gh_short}.tgz
+Source1: makesrc.sh
+
+BuildArch: noarch
+%if %{with tests}
+BuildRequires: php(language) >= 7.0
+BuildRequires: php-reflection
+# From composer.json, "require-dev": {
+# "yoast/yoastcs": "^2.3.0"
+# remirepo:1
+BuildRequires: phpunit11
+# phpunit10 is not supported
+BuildRequires: phpunit9
+BuildRequires: phpunit8
+%endif
+BuildRequires: php-fedora-autoloader-devel
+
+# From composer.json, "require": {
+# "php": ">=7.0",
+# "phpunit/phpunit": "^6.4.4 || ^7.0 || ^8.0 || ^9.0 || ^11.0"
+Requires: php(language) >= 7.0
+# from phpcompatinfo report on version 0.2.0
+Requires: php-reflection
+
+Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version}
+
+
+%description
+Set of polyfills for changed PHPUnit functionality to allow for creating
+PHPUnit cross-version compatible tests.
+
+Autoloader: %{php_home}/%{ns_vendor}/%{ns_project}%{major}/autoload.php
+
+
+
+%prep
+%setup -q -n %{gh_project}-%{gh_commit}
+
+# Fix for RPM layout
+sed -e 's:src/::' phpunitpolyfills-autoload.php > src/autoload.php
+
+
+%build
+# Empty build section, most likely nothing required.
+
+
+%install
+mkdir -p %{buildroot}/%{php_home}/%{ns_vendor}
+cp -pr src %{buildroot}/%{php_home}/%{ns_vendor}/%{ns_project}%{major}
+
+
+%check
+%if %{with tests}
+: Use installed tree and autoloader
+mkdir vendor
+cat << 'EOF' | tee -a vendor/autoload.php
+<?php
+require_once '%{php_home}/Fedora/Autoloader/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('Yoast\\PHPUnitPolyfills\\Tests\\', dirname(__DIR__) . '/tests');
+require_once '%{buildroot}/%{php_home}/%{ns_vendor}/%{ns_project}%{major}/autoload.php';
+EOF
+
+: Run upstream test suite
+ret=0
+if [ -x %{_bindir}/phpunit8 ]; then
+ for cmd in php php81 php82 php83; do
+ if which $cmd; then
+ $cmd %{_bindir}/phpunit8 --no-coverage || ret=1
+ fi
+ done
+fi
+if [ -x %{_bindir}/phpunit9 ]; then
+ for cmd in php php81 php82 php83 php84; do
+ if which $cmd; then
+ $cmd %{_bindir}/phpunit9 --no-coverage || ret=1
+ fi
+ done
+fi
+if [ -x %{_bindir}/phpunit11 ]; then
+ for cmd in php php82 php83 php84; do
+ if which $cmd; then
+ $cmd %{_bindir}/phpunit11 --no-coverage || ret=1
+ fi
+ done
+fi
+
+exit $ret
+%endif
+
+
+%files
+%license LICENSE
+%doc *.md
+%doc composer.json
+%{php_home}/%{ns_vendor}
+
+
+%changelog
+* Thu Jan 9 2025 Remi Collet <remi@remirepo.net> - 3.1.0-1
+- update to 3.1.0
+- re-license spec file to CECILL-2.1
+
+* Mon Sep 9 2024 Remi Collet <remi@remirepo.net> - 3.0.0-1
+- update to 3.0.0
+- move to /usr/share/php/Yoast/PHPUnitPolyfills3
+- raise dependency on PHP 7.0
+- drop phpunit10, add phpunit11
+
+* Fri Aug 30 2024 Remi Collet <remi@remirepo.net> - 2.0.1-1
+- update to 2.0.1
+- move to /usr/share/php/Yoast/PHPUnitPolyfills2
+- raise dependency on PHP 5.6
+- drop phpunit7, add phpunit10
+
+* Tue Apr 9 2024 Remi Collet <remi@remirepo.net> - 1.1.1-1
+- update to 1.1.1
+
+* Fri Mar 31 2023 Remi Collet <remi@remirepo.net> - 1.0.5-1
+- update to 1.0.5
+
+* Wed Nov 16 2022 Remi Collet <remi@remirepo.net> - 1.0.4-1
+- update to 1.0.4
+
+* Tue Nov 23 2021 Remi Collet <remi@remirepo.net> - 1.0.3-1
+- update to 1.0.3
+
+* Mon Oct 4 2021 Remi Collet <remi@remirepo.net> - 1.0.2-1
+- update to 1.0.2
+
+* Tue Aug 10 2021 Remi Collet <remi@remirepo.net> - 1.0.1-1
+- update to 1.0.1
+
+* Mon Jun 21 2021 Remi Collet <remi@remirepo.net> - 1.0.0-1
+- update to 1.0.0
+
+* Wed Mar 10 2021 Remi Collet <remi@remirepo.net> - 0.2.0-2
+- reduce build matrix
+
+* Thu Nov 26 2020 Remi Collet <remi@remirepo.net> - 0.2.0-1
+- initial rpm