diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1e714b1..a9812da 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,35 +1,28 @@ -name: Tests +name: tests -on: [push, pull_request] +on: [ push, pull_request ] jobs: - tests: - name: Tests PHP ${{ matrix.php }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - php: [7.4, 8.0, 8.1, 8.2, 8.3] - include: - - php: 8.1 - analysis: true + tests: + name: Tests PHP ${{ matrix.php }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: [ 7.4, 8.0, 8.1, 8.2, 8.3 ] - steps: - - name: Checkout - uses: actions/checkout@v2 + steps: + - name: Checkout + uses: actions/checkout@v2 - - name: Set up PHP ${{ matrix.php }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: xdebug + - name: Set up PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: xdebug - - name: Install dependencies with Composer - uses: ramsey/composer-install@v2 + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest - - name: Coding standards - if: matrix.analysis - run: vendor/bin/phpcs - - - name: Tests - run: vendor/bin/phpunit --coverage-clover clover.xml + - name: Run test suite + run: composer test:all diff --git a/.gitignore b/.gitignore index a3a64a2..78f83f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ .DS_Store composer.lock -phpunit.xml vendor .idea composer.phar diff --git a/composer.json b/composer.json index 364b479..b576a87 100644 --- a/composer.json +++ b/composer.json @@ -1,52 +1,56 @@ { - "name": "slim/php-view", - "type": "library", - "description": "Render PHP view scripts into a PSR-7 Response object.", - "keywords": [ - "slim", - "framework", - "view", - "template", - "php", - "phtml", - "renderer" - ], - "license": "MIT", - "authors": [ - { - "name": "Glenn Eggleton", - "email": "geggleto@gmail.com" - } - ], - "require": { - "php": "^7.4 || ^8.0", - "psr/http-message": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^9.6", - "slim/psr7": "^1.6", - "squizlabs/php_codesniffer": "^3.10" - }, - "autoload": { - "psr-4": { - "Slim\\Views\\": "src" - } - }, - "autoload-dev": { - "psr-4": { - "Slim\\Tests\\": "tests" - } - }, - "scripts": { - "test": [ - "@phpcs", - "@phpunit" - ], - "phpunit": "phpunit", - "phpcs": "phpcs", - "test:coverage": "phpunit --configuration phpunit.xml.dist --coverage-clover build/logs/clover.xml --coverage-html build/coverage" - }, - "config": { - "sort-packages": true + "name": "slim/php-view", + "description": "Render PHP view scripts into a PSR-7 Response object.", + "license": "MIT", + "type": "library", + "keywords": [ + "slim", + "framework", + "view", + "template", + "php", + "phtml", + "renderer" + ], + "authors": [ + { + "name": "Glenn Eggleton", + "email": "geggleto@gmail.com" + } + ], + "require": { + "php": "^7.4 || ^8.0", + "psr/http-message": "^1.1" + }, + "require-dev": { + "phpstan/phpstan": "^1", + "phpunit/phpunit": "^9", + "slim/psr7": "^1.6", + "squizlabs/php_codesniffer": "^3.10" + }, + "autoload": { + "psr-4": { + "Slim\\Views\\": "src" } + }, + "autoload-dev": { + "psr-4": { + "Slim\\Tests\\": "tests" + } + }, + "config": { + "sort-packages": true + }, + "scripts": { + "sniffer:check": "phpcs --standard=phpcs.xml", + "sniffer:fix": "phpcbf --standard=phpcs.xml", + "stan": "phpstan analyse -c phpstan.neon --no-progress --ansi", + "test": "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always", + "test:all": [ + "@sniffer:check", + "@stan", + "@test" + ], + "test:coverage": "php -d xdebug.mode=coverage -r \"require 'vendor/bin/phpunit';\" -- --configuration phpunit.xml --do-not-cache-result --colors=always --coverage-clover build/logs/clover.xml --coverage-html build/coverage" + } } diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..b35f3d4 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,5 @@ +parameters: + level: 5 + paths: + - src + - tests diff --git a/phpunit.xml.dist b/phpunit.xml similarity index 100% rename from phpunit.xml.dist rename to phpunit.xml