diff options
-rw-r--r-- | 0001-skip-tests-requiring-git-repository.patch | 41 | ||||
-rw-r--r-- | composer.json | 33 | ||||
-rw-r--r-- | php-pear-PHP-CodeSniffer.spec | 17 |
3 files changed, 72 insertions, 19 deletions
diff --git a/0001-skip-tests-requiring-git-repository.patch b/0001-skip-tests-requiring-git-repository.patch new file mode 100644 index 0000000..d79dbd5 --- /dev/null +++ b/0001-skip-tests-requiring-git-repository.patch @@ -0,0 +1,41 @@ +From 472b4f7c56dd95ca4469ed5aad6d6620aa13e03e Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Fri, 12 Jan 2024 08:25:58 +0100 +Subject: [PATCH] skip tests requiring git repository + +--- + tests/Core/Filters/GitModifiedTest.php | 3 +++ + tests/Core/Filters/GitStagedTest.php | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/tests/Core/Filters/GitModifiedTest.php b/tests/Core/Filters/GitModifiedTest.php +index 626fb6531..ca068e144 100644 +--- a/tests/Core/Filters/GitModifiedTest.php ++++ b/tests/Core/Filters/GitModifiedTest.php +@@ -211,6 +211,9 @@ final class GitModifiedTest extends AbstractFilterTestCase + */ + public function testExecAlwaysReturnsArray($cmd, $expected) + { ++ if (!is_dir(__DIR__ . '/../../../.git')) { ++ $this->markTestSkipped('Not a git repository'); ++ } + $fakeDI = new RecursiveArrayIterator(self::getFakeFileList()); + $filter = new GitModified($fakeDI, '/', self::$config, self::$ruleset); + +diff --git a/tests/Core/Filters/GitStagedTest.php b/tests/Core/Filters/GitStagedTest.php +index 0009aefa7..cf5f69765 100644 +--- a/tests/Core/Filters/GitStagedTest.php ++++ b/tests/Core/Filters/GitStagedTest.php +@@ -211,6 +211,9 @@ final class GitStagedTest extends AbstractFilterTestCase + */ + public function testExecAlwaysReturnsArray($cmd, $expected) + { ++ if (!is_dir(__DIR__ . '/../../../.git')) { ++ $this->markTestSkipped('Not a git repository'); ++ } + $fakeDI = new RecursiveArrayIterator(self::getFakeFileList()); + $filter = new GitStaged($fakeDI, '/', self::$config, self::$ruleset); + +-- +2.43.0 + diff --git a/composer.json b/composer.json index a477d20..ae7c760 100644 --- a/composer.json +++ b/composer.json @@ -1,14 +1,13 @@ { "name": "squizlabs/php_codesniffer", "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "license": "BSD-3-Clause", "type": "library", "keywords": [ "phpcs", "standards", "static analysis" ], - "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", - "license": "BSD-3-Clause", "authors": [ { "name": "Greg Sherwood", @@ -19,34 +18,35 @@ "role": "Current lead" }, { - "name" : "Contributors", - "homepage" : "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "support": { "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki", "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy" }, - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, "require": { "php": ">=5.4.0", + "ext-simplexml": "*", "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "ext-simplexml": "*" + "ext-xmlwriter": "*" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, "scripts": { "cs": [ "@php ./bin/phpcs" @@ -62,6 +62,10 @@ "Composer\\Config::disableProcessTimeout", "@php ./vendor/phpunit/phpunit/phpunit tests/AllTests.php -d max_execution_time=0" ], + "coverage-local": [ + "Composer\\Config::disableProcessTimeout", + "@php ./vendor/phpunit/phpunit/phpunit tests/AllTests.php --coverage-html ./build/coverage-html -d max_execution_time=0" + ], "build": [ "Composer\\Config::disableProcessTimeout", "@php -d phar.readonly=0 -f ./scripts/build-phar.php" @@ -76,6 +80,7 @@ "cbf": "Fix code style violations.", "test": "Run the unit tests without code coverage.", "coverage": "Run the unit tests with code coverage.", + "coverage-local": "Run the unit tests with code coverage and generate an HTML report in a 'build' directory.", "build": "Create PHAR files for PHPCS and PHPCBF.", "check-all": "Run all checks (phpcs, tests)." } diff --git a/php-pear-PHP-CodeSniffer.spec b/php-pear-PHP-CodeSniffer.spec index e0a5407..9bc34b0 100644 --- a/php-pear-PHP-CodeSniffer.spec +++ b/php-pear-PHP-CodeSniffer.spec @@ -1,6 +1,6 @@ # spec file for php-pear-PHP-CodeSniffer # -# Copyright (c) 2013-2023 Remi Collet +# Copyright (c) 2013-2024 Remi Collet # Copyright (c) 2009-2013 Christof Damian # Copyright (c) 2006-2009 Konstantin Ryabitsev # @@ -16,7 +16,7 @@ %bcond_without tests -%global gh_commit 5805f7a4e4958dbb5e944ef1e6edae0a303765e7 +%global gh_commit 14f5fff1e64118595db5408e946f3a22c75807f7 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner PHPCSStandards %global gh_project PHP_CodeSniffer @@ -25,7 +25,7 @@ Name: php-pear-PHP-CodeSniffer -Version: 3.8.0 +Version: 3.8.1 Release: 1%{?dist} Summary: PHP coding standards enforcement tool @@ -37,6 +37,7 @@ Source1: makesrc.sh # RPM installation path Patch0: %{name}-rpm.patch +Patch1: 0001-skip-tests-requiring-git-repository.patch BuildArch: noarch BuildRequires: php(language) >= 5.4 @@ -48,9 +49,9 @@ BuildRequires: php-iconv BuildRequires: php-intl %if %{with tests} # to run test suite, from composer.json "require-dev" -# "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" +# "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" %global phpunit %{_bindir}/phpunit9 -BuildRequires: %{phpunit} +BuildRequires: phpunit9 >= 9.3.4 %endif # from composer.json "require": { @@ -81,6 +82,7 @@ certain standards, such as PEAR, or user-defined. %prep %setup -q -n %{gh_project}-%{gh_commit} %patch -P0 -p1 -b .rpm +%patch -P1 -p1 -b .nogit %build @@ -143,6 +145,11 @@ fi %changelog +* Fri Jan 12 2024 Remi Collet <remi@remirepo.net> - 3.8.1-1 +- update to 3.8.1 +- add patch for test suite from + https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/256 + * Mon Dec 11 2023 Remi Collet <remi@remirepo.net> - 3.8.0-1 - update to 3.8.0 - sources from github instead or pear channel |