Skip to content

Commit c3e032c

Browse files
Merge pull request #3 from code16/php85-support
Fix tests depreciations
2 parents f96b240 + 292f16f commit c3e032c

File tree

5 files changed

+24
-13
lines changed

5 files changed

+24
-13
lines changed

.github/workflows/run-tests.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ jobs:
1212
strategy:
1313
matrix:
1414
include:
15+
- php: 8.5
16+
env:
17+
laravel: 12.*
18+
testbench: 10.*
1519
- php: 8.4
1620
env:
1721
laravel: 10.*
@@ -51,6 +55,9 @@ jobs:
5155
composer require "laravel/framework:${laravel}" "orchestra/testbench:${testbench}" --no-interaction --no-update --prefer-dist
5256
composer update --prefer-stable --prefer-dist --no-interaction
5357
58+
- name: Run Security Audit
59+
run: composer audit
60+
5461
- name: List Installed Dependencies
5562
run: composer show -D
5663

tests/Feature/AuthenticationTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Code16\Machina\Tests\Feature;
44

55
use Code16\Machina\Tests\MachinaTestCase;
6+
use PHPUnit\Framework\Attributes\Test;
67

78
class AuthenticationTest extends MachinaTestCase
89
{
@@ -15,7 +16,7 @@ public function setUp(): void
1516
})->middleware('auth:machina');
1617
}
1718

18-
/** @test */
19+
#[Test]
1920
function client_can_access_a_protected_route_with_a_valid_token_in_header()
2021
{
2122
$client = $this->createClient("1234");
@@ -34,7 +35,7 @@ function client_can_access_a_protected_route_with_a_valid_token_in_header()
3435
$response->assertStatus(200);
3536
}
3637

37-
/** @test */
38+
#[Test]
3839
function client_can_access_a_protected_route_with_a_valid_token_in_url()
3940
{
4041
$client = $this->createClient("1234");
@@ -50,14 +51,14 @@ function client_can_access_a_protected_route_with_a_valid_token_in_url()
5051
$response->assertStatus(200);
5152
}
5253

53-
/** @test */
54+
#[Test]
5455
function accessing_a_protected_route_without_a_token_returns_400()
5556
{
5657
$response = $this->json('get', '/protected');
5758
$response->assertStatus(400);
5859
}
5960

60-
/** @test */
61+
#[Test]
6162
function accessing_a_protected_route_with_an_invalid_token_returns_401()
6263
{
6364
$headers = [
@@ -67,7 +68,7 @@ function accessing_a_protected_route_with_an_invalid_token_returns_401()
6768
$response->assertStatus(400);
6869
}
6970

70-
/** @test */
71+
#[Test]
7172
function user_is_authenticated_when_a_protected_route_is_accessed()
7273
{
7374
$client = $this->createClient("1234");
@@ -88,7 +89,7 @@ function user_is_authenticated_when_a_protected_route_is_accessed()
8889
$this->assertEquals($client->id, auth()->user()->id);
8990
}
9091

91-
/** @test */
92+
#[Test]
9293
function token_is_not_returned_inside_response_headers_when_not_refreshed_by_middleware()
9394
{
9495
$client = $this->createClient("1234");
@@ -108,7 +109,7 @@ function token_is_not_returned_inside_response_headers_when_not_refreshed_by_mid
108109
$this->assertFalse(array_key_exists("authorization", $response->headers->all()));
109110
}
110111

111-
/** @test */
112+
#[Test]
112113
function user_is_set_after_a_successful_authentication()
113114
{
114115
$this->app->make('router')->get('user', function() {

tests/Feature/GenerateKeyTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
use Artisan;
66
use Code16\Machina\Tests\MachinaTestCase;
7+
use PHPUnit\Framework\Attributes\Test;
78

89
class GenerateKeyTest extends MachinaTestCase
910
{
1011

11-
/** @test */
12+
#[Test]
1213
function we_can_call_the_artisan_command_to_generate_keys()
1314
{
1415
Artisan::call('machina:keys');

tests/Feature/LoginTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
namespace Code16\Machina\Tests\Feature;
44

55
use Code16\Machina\Tests\MachinaTestCase;
6+
use PHPUnit\Framework\Attributes\Test;
67

78
class LoginTest extends MachinaTestCase
89
{
9-
/** @test */
10+
#[Test]
1011
function login_with_valid_credentials_returns_a_jwt_token()
1112
{
1213
$client = $this->createClient("1234");
@@ -18,7 +19,7 @@ function login_with_valid_credentials_returns_a_jwt_token()
1819
$response->assertStatus(200);
1920
}
2021

21-
/** @test */
22+
#[Test]
2223
function login_with_invalid_credentials_returns_a_401()
2324
{
2425
$client = $this->createClient("1234");
@@ -28,9 +29,9 @@ function login_with_invalid_credentials_returns_a_401()
2829
];
2930
$response = $this->json('post', '/auth/login', $data);
3031
$response->assertStatus(401);
31-
}
32+
}
3233

33-
/** @test */
34+
#[Test]
3435
function login_with_no_credentials_parameters_returns_a_401()
3536
{
3637
$client = $this->createClient("1234");

tests/Feature/RefreshTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
use Code16\Machina\Middleware\RefreshToken;
66
use Code16\Machina\Tests\MachinaTestCase;
7+
use PHPUnit\Framework\Attributes\Test;
78

89
class RefreshTest extends MachinaTestCase
910
{
1011

11-
/** @test */
12+
#[Test]
1213
function we_can_refresh_the_token_using_middleware()
1314
{
1415
$this->app

0 commit comments

Comments
 (0)