diff options
-rw-r--r-- | 993.patch | 66 | ||||
-rw-r--r-- | composer.json | 97 | ||||
-rwxr-xr-x | makesrc.sh | 28 | ||||
-rw-r--r-- | php-mockery.spec | 137 |
4 files changed, 208 insertions, 120 deletions
diff --git a/993.patch b/993.patch deleted file mode 100644 index 1248e23..0000000 --- a/993.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 077d174cf14ea2951dd49d9a3b8f1e5ae0309b89 Mon Sep 17 00:00:00 2001 -From: Remi Collet <remi@remirepo.net> -Date: Mon, 19 Aug 2019 17:10:08 +0200 -Subject: [PATCH 1/2] don't use is_real which is deprecated in 7.4 - ---- - library/Mockery/Matcher/Type.php | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/library/Mockery/Matcher/Type.php b/library/Mockery/Matcher/Type.php -index dc189ab0..d81ce834 100644 ---- a/library/Mockery/Matcher/Type.php -+++ b/library/Mockery/Matcher/Type.php -@@ -30,7 +30,11 @@ class Type extends MatcherAbstract - */ - public function match(&$actual) - { -- $function = 'is_' . strtolower($this->_expected); -+ if ($this->_expected == 'real') { -+ $function = 'is_float'; -+ } else { -+ $function = 'is_' . strtolower($this->_expected); -+ } - if (function_exists($function)) { - return $function($actual); - } elseif (is_string($this->_expected) - -From b06f129832b21f4ba70dd52cd0221cf8dc623bd1 Mon Sep 17 00:00:00 2001 -From: Remi Collet <remi@remirepo.net> -Date: Mon, 19 Aug 2019 17:13:17 +0200 -Subject: [PATCH 2/2] real => float in test suite - ---- - tests/Mockery/ExpectationTest.php | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/tests/Mockery/ExpectationTest.php b/tests/Mockery/ExpectationTest.php -index e718015d..13774bfa 100644 ---- a/tests/Mockery/ExpectationTest.php -+++ b/tests/Mockery/ExpectationTest.php -@@ -1276,14 +1276,14 @@ public function testObjectConstraintThrowsExceptionWhenConstraintUnmatched() - - public function testRealConstraintMatchesArgument() - { -- $this->mock->shouldReceive('foo')->with(Mockery::type('real'))->once(); -+ $this->mock->shouldReceive('foo')->with(Mockery::type('float'))->once(); - $this->mock->foo(2.25); - } - - public function testRealConstraintNonMatchingCase() - { - $this->mock->shouldReceive('foo')->times(3); -- $this->mock->shouldReceive('foo')->with(1, Mockery::type('real'))->never(); -+ $this->mock->shouldReceive('foo')->with(1, Mockery::type('float'))->never(); - $this->mock->foo(); - $this->mock->foo(1); - $this->mock->foo(1, 2, 3); -@@ -1291,7 +1291,7 @@ public function testRealConstraintNonMatchingCase() - - public function testRealConstraintThrowsExceptionWhenConstraintUnmatched() - { -- $this->mock->shouldReceive('foo')->with(Mockery::type('real')); -+ $this->mock->shouldReceive('foo')->with(Mockery::type('float')); - $this->expectException(\Mockery\Exception::class); - $this->mock->foo('f'); - Mockery::close(); diff --git a/composer.json b/composer.json index 4534259..ca84c58 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,8 @@ { "name": "mockery/mockery", "description": "Mockery is a simple yet flexible PHP mock object framework", - "scripts": { - "docs": "phpdoc -d library -t docs/api" - }, + "license": "BSD-3-Clause", + "type": "library", "keywords": [ "bdd", "library", @@ -16,41 +15,103 @@ "test double", "testing" ], - "homepage": "https://github.com/mockery/mockery", - "license": "BSD-3-Clause", "authors": [ { "name": "Pádraic Brady", "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" + "homepage": "https://github.com/padraic", + "role": "Author" }, { "name": "Dave Marshall", "email": "dave.marshall@atstsolutions.co.uk", - "homepage": "http://davedevelopment.co.uk" + "homepage": "https://davedevelopment.co.uk", + "role": "Developer" + }, + { + "name": "Nathanael Esayeas", + "email": "nathanael.esayeas@protonmail.com", + "homepage": "https://github.com/ghostwriter", + "role": "Lead Developer" } ], + "homepage": "https://github.com/mockery/mockery", + "support": { + "issues": "https://github.com/mockery/mockery/issues", + "source": "https://github.com/mockery/mockery", + "docs": "https://docs.mockery.io/", + "rss": "https://github.com/mockery/mockery/releases.atom", + "security": "https://github.com/mockery/mockery/security/advisories" + }, "require": { - "php": ">=5.6.0", + "php": ">=7.3", "lib-pcre": ">=7.0", - "hamcrest/hamcrest-php": "~2.0" + "hamcrest/hamcrest-php": "^2.0.1" }, "require-dev": { - "phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0" + "phpunit/phpunit": "^8.5 || ^9.6.17", + "symplify/easy-coding-standard": "^12.1.14" + }, + "conflict": { + "phpunit/phpunit": "<8.0" }, "autoload": { - "psr-0": { - "Mockery": "library/" - } + "psr-4": { + "Mockery\\": "library/Mockery" + }, + "files": [ + "library/helpers.php", + "library/Mockery.php" + ] }, "autoload-dev": { "psr-4": { + "Fixture\\": "tests/Fixture/", + "Mockery\\Tests\\Unit\\": "tests/Unit", "test\\": "tests/" - } + }, + "files": [ + "fixtures/autoload.php", + "vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php" + ] }, - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } + "config": { + "optimize-autoloader": true, + "platform": { + "php": "7.3.999" + }, + "preferred-install": "dist", + "sort-packages": true + }, + "scripts": { + "check": [ + "@composer validate", + "@ecs", + "@test" + ], + "docs": "vendor/bin/phpdoc -d library -t docs/api", + "ecs": [ + "@ecs:fix", + "@ecs:check" + ], + "ecs:check": "ecs check --clear-cache || true", + "ecs:fix": "ecs check --clear-cache --fix", + "phive": [ + ".phive/tools/phive update --force-accept-unsigned", + ".phive/tools/phive purge" + ], + "phpunit": "vendor/bin/phpunit --do-not-cache-result --colors=always", + "phpunit:coverage": "@phpunit --coverage-clover=coverage.xml", + "psalm": ".phive/tools/psalm --no-diff --no-cache", + "psalm:baseline": "@psalm --set-baseline=psalm-baseline.xml", + "psalm:dry-run": "@psalm --alter --issues=all --dry-run", + "psalm:security": "@psalm --taint-analysis", + "psalm:shepherd": "@psalm --stats --shepherd --output-format=github", + "test": [ + "@phpunit --stop-on-defect", + "@psalm", + "@psalm:security", + "@psalm:dry-run" + ] } } diff --git a/makesrc.sh b/makesrc.sh new file mode 100755 index 0000000..87a1c0b --- /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 --recursive https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT + +echo "Getting commit..." +pushd $PROJECT-$COMMIT +git checkout $COMMIT +cp composer.json ../composer.json +popd + +echo "Archiving..." +tar czf $NAME-$VERSION-$SHORT.tgz --exclude-vcs $PROJECT-$COMMIT + +echo "Cleaning..." +rm -rf $PROJECT-$COMMIT + +echo "Done." + diff --git a/php-mockery.spec b/php-mockery.spec index 2adae20..28db6fc 100644 --- a/php-mockery.spec +++ b/php-mockery.spec @@ -7,61 +7,61 @@ # # Please preserve changelog entries # -%global gh_commit 4eff936d83eb809bde2c57a3cea0ee9643769031 +%bcond_without tests + +%global gh_commit 81a161d0b135df89951abd52296adf97deb0723d %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner mockery %global gh_project mockery %global ns_project Mockery %global major 1 -%global with_tests 0%{!?_without_tests:1} Name: php-mockery -Version: 1.2.3 +Version: 1.6.11 Release: 1%{?dist} Summary: Mockery is a simple but flexible PHP mock object framework -License: BSD +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 +Source0: %{name}-%{version}-%{gh_short}.tgz +Source1: makesrc.sh # Use our autoloader Patch0: %{gh_project}-tests.patch -# For 7.4 -Patch1: https://patch-diff.githubusercontent.com/raw/mockery/mockery/pull/993.patch BuildArch: noarch -%if %{with_tests} -BuildRequires: php(language) >= 5.6.0 +%if %{with tests} +BuildRequires: php(language) >= 7.3 # From composer.json, "require-dev": { -# "phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0" +# "phpunit/phpunit": "^8.5 || ^9.6.17", +# "symplify/easy-coding-standard": "^12.1.4" +%global phpunit %{_bindir}/phpunit9 +BuildRequires: phpunit9 >= 9.6.17 # remirepo:1 %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 -%global phpunit %{_bindir}/phpunit7 -BuildRequires: phpunit7 -BuildRequires: (php-composer(hamcrest/hamcrest-php) >= 2.0 with php-composer(hamcrest/hamcrest-php) < 3) -# remirepo:5 +BuildRequires: (php-composer(hamcrest/hamcrest-php) >= 2.0.1 with php-composer(hamcrest/hamcrest-php) < 3) +# remirepo:3 %else -%global phpunit %{_bindir}/phpunit -BuildRequires: php-phpunit-PHPUnit >= 5.7.10 -BuildRequires: php-hamcrest2 +BuildRequires: php-hamcrest2 >= 2.0.1 %endif +BuildRequires: php-pdo # Autoloader %endif BuildRequires: php-fedora-autoloader-devel # From composer.json, "require": { -# "php": ">=5.6.0", +# "php": ">=7.3", # "lib-pcre": ">=7.0", # "hamcrest/hamcrest-php": "~2.0" -Requires: php(language) >= 5.6.0 +Requires: php(language) >= 7.3 # remirepo:1 %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 -Requires: (php-composer(hamcrest/hamcrest-php) >= 2.0 with php-composer(hamcrest/hamcrest-php) < 3) +Requires: (php-composer(hamcrest/hamcrest-php) >= 2.0.1 with php-composer(hamcrest/hamcrest-php) < 3) # remirepo:3 %else -Requires: php-hamcrest2 +Requires: php-hamcrest2 >= 2.0.1 %endif -# From phpcompatinfo report for version 1.0 +# From phpcompatinfo report for version 1.4.2 Requires: php-pcre Requires: php-spl Requires: php-reflection @@ -89,11 +89,11 @@ cat << 'EOF' | tee -a library/%{ns_project}/autoload.php \Fedora\Autoloader\Dependencies::required([ '/usr/share/php/Hamcrest2/autoload.php', + __DIR__ . '/helpers.php', ]); EOF -%patch0 -p0 -b .rpm -%patch1 -p1 +%patch -P0 -p0 -b .rpm rm -f docs/.gitignore @@ -108,26 +108,23 @@ cp -rp library/%{ns_project} %{buildroot}/%{_datadir}/php/%{ns_project}%{major} %check -%if %{with_tests} +%if %{with tests} : Use installed tree and our autoloader export COMPOSER_VENDOR_DIR=%{buildroot}%{_datadir}/php/%{ns_project}%{major} -phpab --output tests/classmap.php --exclude */SemiReservedWordsAsMethods.php tests/Mockery +phpab --output tests/classmap.php --exclude */SemiReservedWordsAsMethods.php tests/Mockery tests/Fixture -# TODO 7.4 Function is_real() is deprecated : Run upstream test suite ret=0 -for cmd in "php %{phpunit}" "php71 %{_bindir}/phpunit7" php72 php73 php74; do + +# need investigation +rm tests/Mockery/MockeryCanMockClassesWithSemiReservedWordsTest.php + +for cmd in php php81 php82 php83; do if which $cmd; then - set $cmd - # see .travis.yml - if [ $($1 -r 'echo PHP_MAJOR_VERSION;') -lt 7 ] - then SUITE="Mockery Test Suite PHP56" - else SUITE="Mockery Test Suite" - fi - $1 ${2:-%{_bindir}/phpunit8} \ + $cmd %{_bindir}/phpunit9 \ --no-coverage \ - --verbose --testsuite="$SUITE" || ret=1 + --verbose || ret=1 fi done exit $ret @@ -144,6 +141,74 @@ exit $ret %changelog +* Fri Mar 22 2024 Remi Collet <remi@remirepo.net> - 1.6.11-1 +- update to 1.6.11 + +* Wed Mar 20 2024 Remi Collet <remi@remirepo.net> - 1.6.10-1 +- update to 1.6.10 + +* Wed Mar 13 2024 Remi Collet <remi@remirepo.net> - 1.6.9-1 +- update to 1.6.9 (revert to 1.6.7 code) + +* Tue Mar 12 2024 Remi Collet <remi@remirepo.net> - 1.6.8-1 +- update to 1.6.8 + +* Mon Dec 11 2023 Remi Collet <remi@remirepo.net> - 1.6.7-1 +- update to 1.6.7 + +* Thu Aug 24 2023 Remi Collet <remi@remirepo.net> - 1.6.6-1 +- update to 1.6.6 + +* Thu Jul 20 2023 Remi Collet <remi@remirepo.net> - 1.6.4-1 +- update to 1.6.4 + +* Wed Jul 19 2023 Remi Collet <remi@remirepo.net> - 1.6.3-1 +- update to 1.6.3 + +* Thu Jun 8 2023 Remi Collet <remi@remirepo.net> - 1.6.2-1 +- update to 1.6.2 + +* Tue Jun 6 2023 Remi Collet <remi@remirepo.net> - 1.6.1-1 +- update to 1.6.1 + +* Mon Sep 12 2022 Remi Collet <remi@remirepo.net> - 1.5.1-1 +- update to 1.5.1 + +* Fri Jan 21 2022 Remi Collet <remi@remirepo.net> - 1.5.0-1 +- update to 1.5.0 + +* Tue Sep 14 2021 Remi Collet <remi@remirepo.net> - 1.4.4-1 +- update to 1.4.4 + +* Wed Feb 24 2021 Remi Collet <remi@remirepo.net> - 1.4.3-1 +- update to 1.4.3 + +* Mon Oct 12 2020 Remi Collet <remi@remirepo.net> - 1.4.2-1 +- update to 1.4.2 +- raise dependency on PHP 7.3 +- drop compatibility with old phpunit 5, 6 and 7 +- run test suite with both phpunit 8 and 9 + +* Mon Aug 17 2020 Remi Collet <remi@remirepo.net> - 1.3.3-1 +- update to 1.3.3 + +* Tue Jul 21 2020 Remi Collet <remi@remirepo.net> - 1.3.2-1 +- update to 1.3.2 +- switch to phpunit9 +- raise dependency on hamcrest/hamcrest-php 2.0.1 +- sources from git snapshot + +* Fri Jan 3 2020 Remi Collet <remi@remirepo.net> - 1.3.1-1 +- update to 1.3.1 + +* Mon Nov 25 2019 Remi Collet <remi@remirepo.net> - 1.3.0-1 +- update to 1.3.0 +- use phpunit8 + +* Mon Sep 30 2019 Remi Collet <remi@remirepo.net> - 1.2.4-1 +- update to 1.2.4 +- drop patch merged upstream + * Mon Aug 19 2019 Remi Collet <remi@remirepo.net> - 1.2.3-1 - update to 1.2.3 - add patch for PHP 7.4 from |