diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..2c94524 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,44 @@ +name: Run tests +on: + push: + branches: + - feature/drop-support-php56 + pull_request: + types: + - opened + - reopened + - ready_for_review + workflow_dispatch: +jobs: + run-tests: + if: ${{ !github.event.pull_request.draft }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Add HTTP basic auth credentials + run: echo '${{ secrets.COMPOSER_AUTH_JSON }}' > $GITHUB_WORKSPACE/auth.json + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "7.4" + extensions: mbstring + tools: composer:v2, phpunit:9.5 + + #TODO test with env github actios + - name: Add config/env.test.php + run: echo '${{ secrets.ENV_PHP }}' > $GITHUB_WORKSPACE/config/env.test.php + + - name: Install dependencies + run: composer update --no-interaction --no-progress --ignore-platform-reqs + + - name: Static analysis + run: composer phpstan + + - name: PHPUnit tests + run: composer phpunit + + - name: Remove temp files + run: rm -f $GITHUB_WORKSPACE/auth.json, $GITHUB_WORKSPACE/config/env.test.php \ No newline at end of file diff --git a/composer.json b/composer.json index b7cf790..3d40e18 100644 --- a/composer.json +++ b/composer.json @@ -25,9 +25,10 @@ }, "scripts":{ "phpstan":"phpstan analyse -c phpstan.neon", + "phpunit":"phpunit --configuration phpunit.xml --testdox", "test":[ "@phpstan", - "phpunit --configuration phpunit.xml --testdox" + "@phpunit" ], "test:unit":"phpunit --configuration phpunit.xml --testdox --exclude e2e", "test:e2e":"phpunit --configuration phpunit.xml --testdox --group e2e", diff --git a/phpstan.neon b/phpstan.neon index edb11ff..86baff6 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,7 +1,8 @@ parameters: level: 5 paths: - - / - excludePaths: - - vendor + - src + - tests + - config + - examples ignoreErrors: \ No newline at end of file diff --git a/src/Getnet/API/TraitEntity.php b/src/Getnet/API/TraitEntity.php index 422c583..372e946 100644 --- a/src/Getnet/API/TraitEntity.php +++ b/src/Getnet/API/TraitEntity.php @@ -6,7 +6,7 @@ trait TraitEntity /** * - * @return array + * @return mixed */ public function jsonSerialize() {