Skip to content

Commit

Permalink
add github workflow | use pint
Browse files Browse the repository at this point in the history
  • Loading branch information
mgaber2024 committed Sep 10, 2023
1 parent f0c93d2 commit 5a4b8f5
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 8 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: run-tests

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php: [8.2, 8.1]
dependency-version: [prefer-lowest, prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Install dependencies
run: |
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Code Style 🏭
run: composer test:lint

- name: Pest Tests
run: composer test:unit

- name: PHPStan
run: composer test:static
2 changes: 0 additions & 2 deletions tests/Feature/AuthTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

declare(strict_types=1);

use Tests\Datasets\User;

it('auth token can be generated with expires time from config', function () {
$this->freezeTime();
$authToken = $this->user->createAuthToken('auth');
Expand Down
2 changes: 0 additions & 2 deletions tests/Feature/RefreshTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

declare(strict_types=1);

use Tests\Datasets\User;

it('refresh token can be generated with expires time from config', function () {
$this->freezeTime();
$refreshToken = $this->user->createRefreshToken('refresh');
Expand Down
5 changes: 2 additions & 3 deletions tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@
uses(
Tests\TestCase::class,
RefreshDatabase::class
)->beforeEach(function (){
)->beforeEach(function () {
Route::post('api/refresh-token', fn () => response(['message' => 'success']))->name('api.token.refresh')->middleware('auth:sanctum');
Route::post('api/other-route', fn () => response(['message' => 'success']))->name('api.other-route')->middleware('auth:sanctum');
Route::post('api/refresh-token1', fn () => response(['message' => 'success']))->name('api.token.refresh1')->middleware('auth:sanctum');
Route::post('api/refresh-token2', fn () => response(['message' => 'success']))->name('api.token.refresh2')->middleware('auth:sanctum');
$this->user = User::factory()->create();
$this->user = User::factory()->create();
})->in('Feature');


/*
|--------------------------------------------------------------------------
| Expectations
Expand Down
1 change: 0 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Tests;

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Schema;
use Laravel\Sanctum\SanctumServiceProvider;
use MohamedGaber\SanctumRefreshToken\SanctumRefreshTokenServiceProvider;
Expand Down

0 comments on commit 5a4b8f5

Please sign in to comment.