From c2c9dd5dd05e6cbb846dda2e317e492e9522a217 Mon Sep 17 00:00:00 2001 From: Christopher Ryan Date: Tue, 13 Jun 2023 08:15:43 -0400 Subject: [PATCH 1/3] Remove Travis/Coveralls usage. --- .coveralls.yml | 3 --- .travis.yml | 19 ------------------- README.md | 3 --- composer.json | 1 - 4 files changed, 26 deletions(-) delete mode 100644 .coveralls.yml delete mode 100644 .travis.yml diff --git a/.coveralls.yml b/.coveralls.yml deleted file mode 100644 index 4eecff5..0000000 --- a/.coveralls.yml +++ /dev/null @@ -1,3 +0,0 @@ -service_name: travis-ci -coverage_clover: clover.xml -json_path: coveralls-upload.json diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 552da5d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: php -php: - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - nightly -env: - - PREFER_LOWEST="--prefer-lowest --prefer-stable" - - PREFER_LOWEST="" -matrix: - fast_finish: true - allow_failures: - - php: nightly -before_script: - - composer update $PREFER_LOWEST -script: - - ./vendor/bin/phpunit --coverage-clover clover.xml -after_success: ./vendor/bin/coveralls -v diff --git a/README.md b/README.md index cd53660..05a40d7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,4 @@ # DWS Coding Standard -[![Build Status](https://travis-ci.org/traderinteractive/dws-coding-standard.svg?branch=master)](https://travis-ci.org/traderinteractive/dws-coding-standard) -[![Coverage Status](https://coveralls.io/repos/github/traderinteractive/dws-coding-standard/badge.svg)](https://coveralls.io/github/traderinteractive/dws-coding-standard) - [![Latest Stable Version](https://poser.pugx.org/traderinteractive/coding-standard/v/stable)](https://packagist.org/packages/traderinteractive/coding-standard) [![Latest Unstable Version](https://poser.pugx.org/traderinteractive/coding-standard/v/unstable)](https://packagist.org/packages/traderinteractive/coding-standard) [![License](https://poser.pugx.org/traderinteractive/coding-standard/license)](https://packagist.org/packages/traderinteractive/coding-standard) diff --git a/composer.json b/composer.json index afae0d7..16cff92 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,6 @@ "squizlabs/php_codesniffer": "^2.6" }, "require-dev": { - "php-coveralls/php-coveralls": "^1.0", "phpunit/phpunit": "^5.5" } } From 1938196ac8a09b3b29d049ed12b358e6c31af744 Mon Sep 17 00:00:00 2001 From: Christopher Ryan Date: Tue, 13 Jun 2023 08:52:11 -0400 Subject: [PATCH 2/3] Add Github workflow build support for all php 7 versions. --- .github/workflows/php.yml | 29 +++++++++++++++++++++++++++++ .gitignore | 1 + composer.json | 8 ++++++-- phpcs.xml.dist | 9 +++++++++ tests/AbstractSniffUnitTest.php | 22 +++++++++------------- 5 files changed, 54 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/php.yml create mode 100644 phpcs.xml.dist diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..24897d8 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,29 @@ +name: PHP Composer + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4'] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + - name: Validate composer.json and composer.lock + run: composer validate + - name: Install dependencies + run: composer install --prefer-dist --no-progress + - name: Run PHPCS + run: composer run-script lint + - name: Run PHPUnit + run: composer run-script test diff --git a/.gitignore b/.gitignore index cdaeadc..3386f00 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /vendor/ /clover.xml composer.lock +.phpunit.result.cache diff --git a/composer.json b/composer.json index 16cff92..5288892 100644 --- a/composer.json +++ b/composer.json @@ -24,10 +24,14 @@ "sort-packages": true }, "require": { - "php": "^5.6 || ^7.0", + "php": "^7.0", "squizlabs/php_codesniffer": "^2.6" }, "require-dev": { - "phpunit/phpunit": "^5.5" + "phpunit/phpunit": ">=6" + }, + "scripts": { + "lint": "vendor/bin/phpcs", + "test": "vendor/bin/phpunit" } } diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000..ce6c345 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,9 @@ + + + . + */vendor/* + *.inc + + + + diff --git a/tests/AbstractSniffUnitTest.php b/tests/AbstractSniffUnitTest.php index b6a4718..0a7c00a 100644 --- a/tests/AbstractSniffUnitTest.php +++ b/tests/AbstractSniffUnitTest.php @@ -6,6 +6,8 @@ * @package PHP_CodeSniffer */ +use PHPUnit\Framework\TestCase; + /** * An abstract class that all sniff unit tests must extend. * @@ -16,7 +18,7 @@ * @category PHP * @package PHP_CodeSniffer */ -abstract class AbstractSniffUnitTest extends PHPUnit_Framework_TestCase +abstract class AbstractSniffUnitTest extends TestCase { /** * The PHP_CodeSniffer object used for testing. @@ -26,27 +28,19 @@ abstract class AbstractSniffUnitTest extends PHPUnit_Framework_TestCase protected static $_phpcs = null; /** - * Sets up this unit test. + * Tests the extending classes Sniff class. * * @return void + * @throws PHPUnit_Framework_Error + * @test */ - protected function setUp() + public final function runTest() { if (self::$_phpcs === null) { self::$_phpcs = new PHP_CodeSniffer(); self::$_phpcs->cli->setCommandLineValues(['-s']); } - } - /** - * Tests the extending classes Sniff class. - * - * @return void - * @throws PHPUnit_Framework_Error - * @test - */ - public final function runTest() - { self::$_phpcs->process([], 'DWS', [$this->_getSniffName()]); self::$_phpcs->setIgnorePatterns([]); @@ -72,6 +66,8 @@ public final function runTest() if (count($failureMessages) > 0) { $this->fail(implode("\n", $failureMessages)); } + + $this->assertEmpty($failureMessages); } /** From 0aca3eb84d6e76e2f316d978982750b49313ade7 Mon Sep 17 00:00:00 2001 From: Christopher Ryan Date: Tue, 13 Jun 2023 08:57:42 -0400 Subject: [PATCH 3/3] Update README to point to correct repository. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 05a40d7..5762349 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,8 @@ Then to use it, you can run the following (or add to your build process): Developers may be contacted at: - * [Pull Requests](https://github.com/traderinteractive/dws-coding-standard/pulls) - * [Issues](https://github.com/traderinteractive/dws-coding-standard/issues) + * [Pull Requests](https://github.com/traderinteractive/coding-standard-php/pulls) + * [Issues](https://github.com/traderinteractive/coding-standard-php/issues) ## Tests