diff options
-rw-r--r-- | composer.json | 6 | ||||
-rwxr-xr-x | makesrc.sh | 33 | ||||
-rw-r--r-- | php-hamcrest2.spec | 41 | ||||
-rw-r--r-- | upstream.patch | 397 |
4 files changed, 56 insertions, 421 deletions
diff --git a/composer.json b/composer.json index 712ad96..ddffd19 100644 --- a/composer.json +++ b/composer.json @@ -15,12 +15,12 @@ }, "require": { - "php": "^5.3|^7.0|^8.0" + "php": "^7.4|^8.0" }, "require-dev": { - "phpunit/php-file-iterator": "^1.4 || ^2.0", - "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" + "phpunit/php-file-iterator": "^1.4 || ^2.0 || ^3.0", + "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0 || ^8.0 || ^9.0" }, "replace": { diff --git a/makesrc.sh b/makesrc.sh new file mode 100755 index 0000000..142ce02 --- /dev/null +++ b/makesrc.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +NAME=$(sed -n '/^Name:/{s/.* //;p}' *.spec) +DATE=$(sed -n '/^%global gh_date/{s/.* //;p}' $NAME.spec) +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} + +DATE=$(date -d "$DATE -4 days" +%Y-%m-%d) + +if [ -f $NAME-$VERSION-$SHORT.tgz ]; then + echo "Skip $NAME-$VERSION-$SHORT.tgz" +else + echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION, Commit=$COMMIT, Date=$DATE\n" + + echo "Cloning..." + git clone --shallow-since=$DATE https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT || exit 1 + + echo "Getting commit..." + pushd $PROJECT-$COMMIT + git checkout $COMMIT || exit1 + cp composer.json ../ + popd + + echo "Archiving..." + tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT + + echo "Cleaning..." + rm -rf $PROJECT-$COMMIT +fi + diff --git a/php-hamcrest2.spec b/php-hamcrest2.spec index 84e44e0..88c915b 100644 --- a/php-hamcrest2.spec +++ b/php-hamcrest2.spec @@ -6,7 +6,8 @@ # # Please, preserve the changelog entries # -%global gh_commit 8c3d0a3f6af734494ad8f6fbbee0ba92422859f3 +%global gh_date 2025-04-30 +%global gh_commit f8b1c0173b22fa6ec77a81fe63e5b01eba7e6487 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner hamcrest %global gh_project hamcrest-php @@ -15,43 +16,38 @@ %bcond_without tests Name: php-hamcrest2 -Version: 2.0.1 -Release: 12%{?dist} +Version: 2.1.1 +Release: 1%{?dist} Summary: PHP port of Hamcrest Matchers License: BSD-3-Clause URL: https://github.com/%{gh_owner}/%{gh_project} -Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{gh_short}.tar.gz +# git snapshot with tests +Source0: %{name}-%{version}-%{gh_short}.tgz +Source1: makesrc.sh # Use generated autoloader instead of composer one Patch0: bootstrap-autoload.patch -# Upstream patch for testsuite -Patch1: upstream.patch BuildArch: noarch BuildRequires: php-fedora-autoloader-devel %if %{with tests} # From composer.json, require-dev: -# "phpunit/php-file-iterator": "^1.4 || ^2.0", +# "phpunit/php-file-iterator": "^1.4 || ^2.0 || ^3.0", # "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0 || ^8.0 || ^9.0" BuildRequires: phpunit9 -# composer.json, require: -# "php": "^5.3|^7.0|^8.0" -BuildRequires: php(language) >= 5.3 -# From phpcompatinfo report for 2.0.0 -BuildRequires: php-reflection +BuildRequires: php(language) >= 7.4 +# From phpcompatinfo report for 2.1.1 BuildRequires: php-ctype BuildRequires: php-dom -BuildRequires: php-pcre -BuildRequires: php-spl %endif -Requires: php(language) >= 5.3 -# From phpcompatinfo report for 2.0.0 +# composer.json, require: +# "php": "^7.4|^8.0" +Requires: php(language) >= 7.4 +# From phpcompatinfo report for 2.1.1 Requires: php-ctype Requires: php-dom -Requires: php-pcre -Requires: php-spl # Autoloader Requires: php-composer(fedora/autoloader) @@ -73,8 +69,7 @@ Autoloader: %{_datadir}/php/%{ns_project}%{major}/autoload.php %setup -q -n %{gh_project}-%{gh_commit} %patch -P0 -p0 -b .rpm -%patch -P1 -p1 -b .up -find . -name \*.rpm -o -name \*.up -exec rm {} \; +find . -name \*.rpm -exec rm {} \; -print # Move to Library tree mv hamcrest/%{ns_project}.php hamcrest/%{ns_project}/%{ns_project}.php @@ -105,7 +100,7 @@ cd tests ret=0 for cmd in php php81 php82 php83 php84; do if which $cmd; then - $cmd %{_bindir}/phpunit9 --verbose || ret=1 + $cmd %{_bindir}/phpunit9 || ret=1 fi done exit $ret @@ -122,6 +117,10 @@ exit $ret %changelog +* Tue May 6 2025 Remi Collet <remi@remirepo.net> - 2.1.1-1 +- update to 2.1.1 +- raise dependency on PHP 7.4 + * Wed Jan 22 2025 Remi Collet <remi@remirepo.net> - 2.0.1-12 - switch to phpunit9 - re-license spec file to CECILL-2.1 diff --git a/upstream.patch b/upstream.patch deleted file mode 100644 index f01e722..0000000 --- a/upstream.patch +++ /dev/null @@ -1,397 +0,0 @@ -From 696163addf28bb4e01455254e055a9a75e0ba6c4 Mon Sep 17 00:00:00 2001 -From: Fabien Villepinte <fabien.villepinte@gmail.com> -Date: Thu, 14 Dec 2023 12:00:58 +0100 -Subject: [PATCH] Allow installation of PHPUnit 8 in order to test with PHP 8.1 - and 8.2 (#82) - -* Allow installation of PHPUnit 8 -* Run the tests with PHP 8.1 and 8.2 ---- - .github/workflows/tests.yml | 9 ++------- - .gitignore | 1 + - composer.json | 2 +- - tests/Hamcrest/Core/CombinableMatcherTest.php | 5 ++++- - tests/Hamcrest/Core/IsInstanceOfTest.php | 5 ++++- - tests/Hamcrest/Core/SetTest.php | 5 ++++- - tests/Hamcrest/FeatureMatcherTest.php | 5 ++++- - tests/Hamcrest/MatcherAssertTest.php | 5 ++++- - tests/Hamcrest/StringDescriptionTest.php | 5 ++++- - tests/Hamcrest/Text/IsEqualIgnoringWhiteSpaceTest.php | 5 ++++- - tests/Hamcrest/Text/StringContainsIgnoringCaseTest.php | 5 ++++- - tests/Hamcrest/Text/StringContainsInOrderTest.php | 5 ++++- - tests/Hamcrest/Text/StringContainsTest.php | 5 ++++- - tests/Hamcrest/Text/StringEndsWithTest.php | 5 ++++- - tests/Hamcrest/Text/StringStartsWithTest.php | 5 ++++- - tests/Hamcrest/Xml/HasXPathTest.php | 5 ++++- - 16 files changed, 56 insertions(+), 21 deletions(-) - -diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml -index 06255a1b9..f23413216 100644 ---- a/.github/workflows/tests.yml -+++ b/.github/workflows/tests.yml -@@ -10,7 +10,7 @@ jobs: - runs-on: ubuntu-latest - strategy: - matrix: -- php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0'] -+ php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] - - name: PHP ${{ matrix.php }} - -@@ -26,13 +26,8 @@ jobs: - tools: composer:v2 - coverage: none - -- - name: Install PHP 7 dependencies -+ - name: Install PHP dependencies - run: composer update --prefer-dist --no-interaction --no-progress -- if: "matrix.php != '8.0'" -- -- - name: Install PHP 8 dependencies -- run: composer update --prefer-dist --no-interaction --no-progress --ignore-platform-reqs -- if: "matrix.php == '8.0'" - - - name: Execute tests - run: vendor/bin/phpunit -c tests/phpunit.xml.dist -diff --git a/.gitignore b/.gitignore -index 987e2a253..7611d841f 100644 ---- a/.gitignore -+++ b/.gitignore -@@ -1,2 +1,3 @@ - composer.lock -+tests/.phpunit.result.cache - vendor -diff --git a/composer.json b/composer.json -index 712ad9655..180f341d8 100644 ---- a/composer.json -+++ b/composer.json -@@ -20,7 +20,7 @@ - - "require-dev": { - "phpunit/php-file-iterator": "^1.4 || ^2.0", -- "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" -+ "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0 || ^8.0" - }, - - "replace": { -diff --git a/tests/Hamcrest/Core/CombinableMatcherTest.php b/tests/Hamcrest/Core/CombinableMatcherTest.php -index 463c75437..ef9418674 100644 ---- a/tests/Hamcrest/Core/CombinableMatcherTest.php -+++ b/tests/Hamcrest/Core/CombinableMatcherTest.php -@@ -7,7 +7,10 @@ class CombinableMatcherTest extends \Hamcrest\AbstractMatcherTest - private $_either_3_or_4; - private $_not_3_and_not_4; - -- protected function setUp() -+ /** -+ * @before -+ */ -+ protected function setUpTest() - { - $this->_either_3_or_4 = \Hamcrest\Core\CombinableMatcher::either(equalTo(3))->orElse(equalTo(4)); - $this->_not_3_and_not_4 = \Hamcrest\Core\CombinableMatcher::both(not(equalTo(3)))->andAlso(not(equalTo(4))); -diff --git a/tests/Hamcrest/Core/IsInstanceOfTest.php b/tests/Hamcrest/Core/IsInstanceOfTest.php -index f74cfdb52..b4fdd04fd 100644 ---- a/tests/Hamcrest/Core/IsInstanceOfTest.php -+++ b/tests/Hamcrest/Core/IsInstanceOfTest.php -@@ -7,7 +7,10 @@ class IsInstanceOfTest extends \Hamcrest\AbstractMatcherTest - private $_baseClassInstance; - private $_subClassInstance; - -- protected function setUp() -+ /** -+ * @before -+ */ -+ protected function setUpTest() - { - $this->_baseClassInstance = new \Hamcrest\Core\SampleBaseClass('good'); - $this->_subClassInstance = new \Hamcrest\Core\SampleSubClass('good'); -diff --git a/tests/Hamcrest/Core/SetTest.php b/tests/Hamcrest/Core/SetTest.php -index aa5e4e7be..f00efa4f4 100644 ---- a/tests/Hamcrest/Core/SetTest.php -+++ b/tests/Hamcrest/Core/SetTest.php -@@ -7,7 +7,10 @@ class SetTest extends \Hamcrest\AbstractMatcherTest - public static $_classProperty; - public $_instanceProperty; - -- protected function setUp() -+ /** -+ * @before -+ */ -+ protected function setUpTest() - { - self::$_classProperty = null; - unset($this->_instanceProperty); -diff --git a/tests/Hamcrest/FeatureMatcherTest.php b/tests/Hamcrest/FeatureMatcherTest.php -index 1b0230498..dfae872bf 100644 ---- a/tests/Hamcrest/FeatureMatcherTest.php -+++ b/tests/Hamcrest/FeatureMatcherTest.php -@@ -34,7 +34,10 @@ class FeatureMatcherTest extends \Hamcrest\AbstractMatcherTest - - private $_resultMatcher; - -- protected function setUp() -+ /** -+ * @before -+ */ -+ protected function setUpTest() - { - $this->_resultMatcher = $this->_resultMatcher(); - } -diff --git a/tests/Hamcrest/MatcherAssertTest.php b/tests/Hamcrest/MatcherAssertTest.php -index dc12fba54..e34919869 100644 ---- a/tests/Hamcrest/MatcherAssertTest.php -+++ b/tests/Hamcrest/MatcherAssertTest.php -@@ -6,7 +6,10 @@ - class MatcherAssertTest extends TestCase - { - -- protected function setUp() -+ /** -+ * @before -+ */ -+ protected function setUpTest() - { - \Hamcrest\MatcherAssert::resetCount(); - } -diff --git a/tests/Hamcrest/StringDescriptionTest.php b/tests/Hamcrest/StringDescriptionTest.php -index ed716d13e..b42b9b469 100644 ---- a/tests/Hamcrest/StringDescriptionTest.php -+++ b/tests/Hamcrest/StringDescriptionTest.php -@@ -23,7 +23,10 @@ class StringDescriptionTest extends TestCase - - private $_description; - -- protected function setUp() -+ /** -+ * @before -+ */ -+ protected function setUpTest() - { - $this->_description = new \Hamcrest\StringDescription(); - } -diff --git a/tests/Hamcrest/Text/IsEqualIgnoringWhiteSpaceTest.php b/tests/Hamcrest/Text/IsEqualIgnoringWhiteSpaceTest.php -index 27ad338b7..42444489f 100644 ---- a/tests/Hamcrest/Text/IsEqualIgnoringWhiteSpaceTest.php -+++ b/tests/Hamcrest/Text/IsEqualIgnoringWhiteSpaceTest.php -@@ -6,7 +6,10 @@ class IsEqualIgnoringWhiteSpaceTest extends \Hamcrest\AbstractMatcherTest - - private $_matcher; - -- protected function setUp() -+ /** -+ * @before -+ */ -+ protected function setUpTest() - { - $this->_matcher = \Hamcrest\Text\IsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace( - "Hello World how\n are we? " -diff --git a/tests/Hamcrest/Text/StringContainsIgnoringCaseTest.php b/tests/Hamcrest/Text/StringContainsIgnoringCaseTest.php -index 73023007b..8b4463a9e 100644 ---- a/tests/Hamcrest/Text/StringContainsIgnoringCaseTest.php -+++ b/tests/Hamcrest/Text/StringContainsIgnoringCaseTest.php -@@ -8,7 +8,10 @@ class StringContainsIgnoringCaseTest extends \Hamcrest\AbstractMatcherTest - - private $_stringContains; - -- protected function setUp() -+ /** -+ * @before -+ */ -+ protected function setUpTest() - { - $this->_stringContains = \Hamcrest\Text\StringContainsIgnoringCase::containsStringIgnoringCase( - strtolower(self::EXCERPT) -diff --git a/tests/Hamcrest/Text/StringContainsInOrderTest.php b/tests/Hamcrest/Text/StringContainsInOrderTest.php -index 4c465b29d..adb8658f4 100644 ---- a/tests/Hamcrest/Text/StringContainsInOrderTest.php -+++ b/tests/Hamcrest/Text/StringContainsInOrderTest.php -@@ -6,7 +6,10 @@ class StringContainsInOrderTest extends \Hamcrest\AbstractMatcherTest - - private $_m; - -- protected function setUp() -+ /** -+ * @before -+ */ -+ protected function setUpTest() - { - $this->_m = \Hamcrest\Text\StringContainsInOrder::stringContainsInOrder(array('a', 'b', 'c')); - } -diff --git a/tests/Hamcrest/Text/StringContainsTest.php b/tests/Hamcrest/Text/StringContainsTest.php -index bf4afa3c9..814c1ca1b 100644 ---- a/tests/Hamcrest/Text/StringContainsTest.php -+++ b/tests/Hamcrest/Text/StringContainsTest.php -@@ -8,7 +8,10 @@ class StringContainsTest extends \Hamcrest\AbstractMatcherTest - - private $_stringContains; - -- protected function setUp() -+ /** -+ * @before -+ */ -+ protected function setUpTest() - { - $this->_stringContains = \Hamcrest\Text\StringContains::containsString(self::EXCERPT); - } -diff --git a/tests/Hamcrest/Text/StringEndsWithTest.php b/tests/Hamcrest/Text/StringEndsWithTest.php -index 9a30f9520..46177f464 100644 ---- a/tests/Hamcrest/Text/StringEndsWithTest.php -+++ b/tests/Hamcrest/Text/StringEndsWithTest.php -@@ -8,7 +8,10 @@ class StringEndsWithTest extends \Hamcrest\AbstractMatcherTest - - private $_stringEndsWith; - -- protected function setUp() -+ /** -+ * @before -+ */ -+ protected function setUpTest() - { - $this->_stringEndsWith = \Hamcrest\Text\StringEndsWith::endsWith(self::EXCERPT); - } -diff --git a/tests/Hamcrest/Text/StringStartsWithTest.php b/tests/Hamcrest/Text/StringStartsWithTest.php -index 3be201f1a..f0eb14b7e 100644 ---- a/tests/Hamcrest/Text/StringStartsWithTest.php -+++ b/tests/Hamcrest/Text/StringStartsWithTest.php -@@ -8,7 +8,10 @@ class StringStartsWithTest extends \Hamcrest\AbstractMatcherTest - - private $_stringStartsWith; - -- protected function setUp() -+ /** -+ * @before -+ */ -+ protected function setUpTest() - { - $this->_stringStartsWith = \Hamcrest\Text\StringStartsWith::startsWith(self::EXCERPT); - } -diff --git a/tests/Hamcrest/Xml/HasXPathTest.php b/tests/Hamcrest/Xml/HasXPathTest.php -index 677488716..3db5e46e0 100644 ---- a/tests/Hamcrest/Xml/HasXPathTest.php -+++ b/tests/Hamcrest/Xml/HasXPathTest.php -@@ -7,7 +7,10 @@ class HasXPathTest extends \Hamcrest\AbstractMatcherTest - protected static $doc; - protected static $html; - -- public static function setUpBeforeClass() -+ /** -+ * @beforeClass -+ */ -+ public static function setUpBeforeClassTest() - { - self::$xml = <<<XML - <?xml version="1.0"?> -From 103d1443ec6c552ff1c15e2bddbb9ce7c96528be Mon Sep 17 00:00:00 2001 -From: Fabien Villepinte <fabien.villepinte@gmail.com> -Date: Fri, 3 May 2024 15:45:43 +0200 -Subject: [PATCH] Fix all PHPUnit's deprecations - ---- - .github/workflows/tests.yml | 14 +++++++++++++- - tests/Hamcrest/UtilTest.php | 23 +++++++++++++++-------- - 2 files changed, 28 insertions(+), 9 deletions(-) - -diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml -index f23413216..68b483587 100644 ---- a/.github/workflows/tests.yml -+++ b/.github/workflows/tests.yml -@@ -10,7 +10,19 @@ jobs: - runs-on: ubuntu-latest - strategy: - matrix: -- php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] -+ php: -+ - '5.3' -+ - '5.4' -+ - '5.5' -+ - '5.6' -+ - '7.0' -+ - '7.1' -+ - '7.2' -+ - '7.3' -+ - '7.4' -+ - '8.0' -+ - '8.1' -+ - '8.2' - - name: PHP ${{ matrix.php }} - -diff --git a/tests/Hamcrest/UtilTest.php b/tests/Hamcrest/UtilTest.php -index 7248978c7..1fec63eed 100644 ---- a/tests/Hamcrest/UtilTest.php -+++ b/tests/Hamcrest/UtilTest.php -@@ -28,21 +28,28 @@ public function testCheckAllAreMatchersAcceptsMatchers() - )); - } - -- /** -- * @expectedException InvalidArgumentException -- */ - public function testCheckAllAreMatchersFailsForPrimitive() - { -- \Hamcrest\Util::checkAllAreMatchers(array( -- new \Hamcrest\Text\MatchesPattern('/fo+/'), -- 'foo', -- )); -+ $exceptionThrown = false; -+ try { -+ \Hamcrest\Util::checkAllAreMatchers(array( -+ new \Hamcrest\Text\MatchesPattern('/fo+/'), -+ 'foo', -+ )); -+ } catch (\InvalidArgumentException $exception) { -+ $exceptionThrown = true; -+ } -+ -+ $this->assertTrue( -+ $exceptionThrown, -+ 'Failed asserting that exception of type "InvalidArgumentException" is thrown.' -+ ); - } - - private function callAndAssertCreateMatcherArray($items) - { - $matchers = \Hamcrest\Util::createMatcherArray($items); -- $this->assertInternalType('array', $matchers); -+ $this->assertTrue(is_array($matchers), sprintf('Type "array" expected, but got "%s" instead', gettype($matchers))); - $this->assertSameSize($items, $matchers); - foreach ($matchers as $matcher) { - $this->assertInstanceOf('\Hamcrest\Matcher', $matcher); -From e3b7bfcda4bc88f94e7f37f2a3a3380d4944735d Mon Sep 17 00:00:00 2001 -From: Fabien Villepinte <fabien.villepinte@gmail.com> -Date: Fri, 3 May 2024 15:50:55 +0200 -Subject: [PATCH] Allow installation of PHPUnit 9 in order to test with PHP 8.3 - ---- - .github/workflows/tests.yml | 1 + - composer.json | 4 ++-- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml -index 68b483587..de0cfff6f 100644 ---- a/.github/workflows/tests.yml -+++ b/.github/workflows/tests.yml -@@ -23,6 +23,7 @@ jobs: - - '8.0' - - '8.1' - - '8.2' -+ - '8.3' - - name: PHP ${{ matrix.php }} - -diff --git a/composer.json b/composer.json -index 180f341d8..c89b279e1 100644 ---- a/composer.json -+++ b/composer.json -@@ -19,8 +19,8 @@ - }, - - "require-dev": { -- "phpunit/php-file-iterator": "^1.4 || ^2.0", -- "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0 || ^8.0" -+ "phpunit/php-file-iterator": "^1.4 || ^2.0 || ^3.0", -+ "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0 || ^8.0 || ^9.0" - }, - - "replace": { |