diff --git a/.travis.yml b/.travis.yml index 22d1077..a1f594f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,9 +7,6 @@ php: - '7.1' - '7.2' before_script: - - composer install --no-interaction - - vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs + - composer install script: - - vendor/bin/phpunit ./test/statifyblacklist-test.php - - vendor/bin/phpcs statify-blacklist.php --standard=phpcs.xml - - vendor/bin/phpcs ./inc/ --standard=phpcs.xml --extensions=php + - composer test-all diff --git a/Gulpfile.js b/Gulpfile.js index cb6a502..70288ea 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -30,11 +30,15 @@ gulp.task('test', ['compose'], function () { // Execute PHP Code Sniffer. gulp.task('test-cs', function (cb) { - return exec('./vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs', function (err, stdout, stderr) { + return exec('./vendor/bin/phpcs --config-set installed_paths vendor/wimg/php-compatibility,vendor/wp-coding-standards/wpcs', function (err, stdout, stderr) { console.log(stdout); console.log(stderr); if (null === err) { console.log('Running PHP Code Sniffer tests ...'); + // exec('./vendor/bin/phpcs --standard=phpcs.xml', function(err, stdout, stderr) { + // console.log(stdout); + // console.log(stderr); + // }); gulp.src(['statify-blacklist.php', 'inc/**/*.php']) .pipe(phpcs({bin: './vendor/bin/phpcs', standard: 'phpcs.xml'})) .pipe(phpcs.reporter('log')); diff --git a/composer.json b/composer.json index fe1cd2f..4d31da0 100644 --- a/composer.json +++ b/composer.json @@ -22,9 +22,28 @@ "composer/installers": "~1.0" }, "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4", "php": ">=5.5", "phpunit/phpunit": "*", "phpunit/php-code-coverage": "*", - "wp-coding-standards/wpcs": "~0.14.0" + "slowprog/composer-copy-file": "~0.2", + "squizlabs/php_codesniffer": "^3.1", + "wimg/php-compatibility": "^8.0", + "wp-coding-standards/wpcs": "~0.14" + }, + "scripts": { + "test-all": [ + "@test", + "@test-cs" + ], + "test": [ + "phpunit" + ], + "test-cs": [ + "phpcs --standard=phpcs.xml -s" + ], + "fix-cs": [ + "phpcbf --standard=phpcs.xml" + ] } } diff --git a/phpcs.xml b/phpcs.xml index 410eb97..a40b6c5 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -2,10 +2,16 @@ Derived from WordPress Coding Standard - - - + + + + inc + statify-blacklist.php + + + + @@ -14,4 +20,8 @@ + + + +