Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Github Actions Workflow #229

Merged
merged 5 commits into from
Oct 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Tests

on: [push, pull_request]

jobs:
tests:
name: Tests PHP ${{ matrix.php }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
php: [7.3, 7.4, 8.0]
experimental: [false]
include:
- php: 8.0
analysis: true
- php: 8.1
experimental: true

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: Install dependencies with Composer
uses: ramsey/composer-install@v1

- name: Coding standards
if: matrix.analysis
run: vendor/bin/phpcs

- name: Static analysis
if: matrix.analysis
run: vendor/bin/phpstan

- name: Tests
run: vendor/bin/phpunit --coverage-clover clover.xml

- name: Upload coverage results to Coveralls
if: matrix.analysis
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer require php-coveralls/php-coveralls -n -W
vendor/bin/php-coveralls --coverage_clover=clover.xml -v
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Via [Composer](https://getcomposer.org/)
$ composer require slim/twig-view:^3.0
```

Requires Slim Framework 4 and PHP 7.2 or newer.
Requires Slim Framework 4 and PHP 7.3 or newer.

## Usage

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
}
],
"require": {
"php": "^7.2 || ^8.0",
"php": "^7.3 || ^8.0",
"psr/http-message": "^1.0",
"slim/slim": "^4.8",
"twig/twig": "^3.3"
},
"require-dev": {
"phpunit/phpunit": "^8.5.13 || ^9.3.8",
"phpunit/phpunit": "^9.3.8",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/phpstan": "^0.12.99",
"psr/http-factory": "^1.0",
"squizlabs/php_codesniffer": "^3.6",
"weirdan/prophecy-shim": "^1.0 || ^2.0.2"
"squizlabs/php_codesniffer": "^3.6"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ parameters:
level: max
inferPrivatePropertyTypeFromConstructor: true
checkGenericClassInNonGenericObjectType: false
paths:
- src
12 changes: 0 additions & 12 deletions tests/TwigMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Slim\Interfaces\RouteCollectorInterface;
use Slim\Interfaces\RouteParserInterface;
use Slim\Views\Twig;
use Slim\Views\TwigExtension;
use Slim\Views\TwigMiddleware;
use Slim\Views\TwigRuntimeExtension;
use Slim\Views\TwigRuntimeLoader;
Expand All @@ -42,17 +41,6 @@ private function createTwigProphecy(ObjectProphecy $uriProphecy, string $basePat

$twigProphecy = $this->prophesize(Twig::class);

/** @noinspection PhpUndefinedMethodInspection */
$twigProphecy
->addExtension(Argument::type('object'))
->will(function ($args) use ($self) {
/** @var TwigExtension $extension */
$extension = $args[0];

$self->assertEquals('slim', $extension->getName());
})
->shouldBeCalledOnce();

/** @noinspection PhpUndefinedMethodInspection */
$twigProphecy->
addRuntimeLoader(Argument::type('object'))
Expand Down