Skip to content

Commit 3e793a3

Browse files
authored
Merge pull request #16 from ivinteractive/main
Add PHP 8.3 & Laravel 11 support; Use PHP attributes in tests
2 parents 7a7e41a + d22fbc9 commit 3e793a3

File tree

6 files changed

+60
-48
lines changed

6 files changed

+60
-48
lines changed

.github/workflows/phpstan.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,40 @@ on:
77
jobs:
88
phpstan:
99
runs-on: ubuntu-latest
10+
11+
strategy:
12+
fail-fast: true
13+
matrix:
14+
php: [8.3]
15+
1016
steps:
11-
- uses: actions/checkout@v3
17+
- name: Checkout code
18+
uses: actions/checkout@v4
1219

1320
- name: Setup PHP
1421
uses: shivammathur/setup-php@v2
1522
with:
16-
php-version: 8.2
23+
php-version: ${{ matrix.php }}
1724
tools: composer:v2
1825
coverage: none
1926

27+
- name: Cache Composer dependencies
28+
uses: actions/cache@v4
29+
with:
30+
path: /tmp/composer-cache
31+
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('composer.lock', '*/composer.lock') }}
32+
2033
- name: Install dependencies
21-
run: composer update --prefer-source --no-interaction --no-progress
34+
uses: php-actions/composer@v6
35+
with:
36+
php_version: ${{ matrix.php }}
37+
php_extensions: gd
38+
command: update
2239

2340
- name: PHPStan Static Analysis
2441
uses: php-actions/phpstan@v3
2542
with:
2643
path: src/
2744
configuration: phpstan.neon
28-
php_version: 8.2
45+
php_version: ${{ matrix.php }}
2946
php_extensions: gd

.github/workflows/tests.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
strategy:
1111
fail-fast: true
1212
matrix:
13-
php: [8.0, 8.1, 8.2]
13+
php: [8.1, 8.2, 8.3]
1414

1515
name: Tests on PHP ${{ matrix.php }} - ${{ matrix.stability }}
1616

1717
steps:
1818
- name: Checkout code
19-
uses: actions/checkout@v2
19+
uses: actions/checkout@v4
2020

2121
- name: Setup PHP
2222
uses: shivammathur/setup-php@v2
@@ -25,8 +25,21 @@ jobs:
2525
tools: composer:v2
2626
coverage: none
2727

28+
- name: Cache Composer dependencies
29+
uses: actions/cache@v4
30+
with:
31+
path: /tmp/composer-cache
32+
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('composer.lock', '*/composer.lock') }}
33+
2834
- name: Install dependencies
29-
run: composer update --prefer-source --no-interaction --no-progress
35+
uses: php-actions/composer@v6
36+
with:
37+
php_version: ${{ matrix.php }}
38+
php_extensions: gd
39+
command: update
40+
41+
- name: Set ownership of vendor directory
42+
run: sudo chown -R $(id -u):$(id -g) ./vendor
3043

3144
- name: Execute tests
3245
run: vendor/bin/phpunit --no-coverage

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
}
1313
],
1414
"require": {
15-
"php": "^8.0",
16-
"illuminate/notifications": "^9.0|^10.0",
17-
"illuminate/support": "^9.0|^10.0",
15+
"php": "^8.1",
16+
"illuminate/notifications": "^10.0|^11.0",
17+
"illuminate/support": "^10.0|^11.0",
1818
"interfax/interfax": "^2.0",
1919
"psr/log": "^2.0"
2020
},
2121
"require-dev": {
2222
"mockery/mockery": "^1.0",
2323
"mpdf/mpdf": "^8.0",
24-
"orchestra/testbench": "^7.0|^8.0",
24+
"orchestra/testbench": "^8.0|^9.0",
2525
"phpstan/phpstan": "^1.9",
26-
"phpunit/phpunit": "^9.5.10|^10.0"
26+
"phpunit/phpunit": "^10.0|^11.0"
2727
},
2828
"autoload": {
2929
"psr-4": {

tests/CouldNotSendNotificationExceptionTest.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ public function setUp(): void
1919
->file('test-file.pdf');
2020
}
2121

22-
/** @test */
23-
public function it_can_get_the_exception_user()
22+
public function test_get_the_exception_user()
2423
{
2524
$exception = CouldNotSendNotification::serviceRespondedWithAnError($this->message, [
2625
'status' => 500,
@@ -30,8 +29,7 @@ public function it_can_get_the_exception_user()
3029
$this->assertInstanceOf(TestNotifiable::class, $exception->getUser());
3130
}
3231

33-
/** @test */
34-
public function it_can_get_the_exception_metadata()
32+
public function test_get_the_exception_metadata()
3533
{
3634
$exception = CouldNotSendNotification::serviceRespondedWithAnError($this->message, [
3735
'status' => 500,
@@ -41,8 +39,7 @@ public function it_can_get_the_exception_metadata()
4139
$this->assertSame('Some sample metadata.', $exception->getMetadata()['key']);
4240
}
4341

44-
/** @test */
45-
public function it_can_get_the_default_exception_message()
42+
public function test_get_the_default_exception_message()
4643
{
4744
$exception = CouldNotSendNotification::serviceRespondedWithAnError($this->message, [
4845
'status' => 500,
@@ -52,8 +49,7 @@ public function it_can_get_the_default_exception_message()
5249
$this->assertSame('The fax failed to send via InterFAX.', $exception->getMessage());
5350
}
5451

55-
/** @test */
56-
public function it_can_get_a_custom_exception_message()
52+
public function test_get_a_custom_exception_message()
5753
{
5854
$exceptionMessage = 'This is a test.';
5955

@@ -65,8 +61,7 @@ public function it_can_get_a_custom_exception_message()
6561
$this->assertSame($exceptionMessage, $exception->getMessage());
6662
}
6763

68-
/** @test */
69-
public function it_can_get_the_exception_attributes()
64+
public function test_get_the_exception_attributes()
7065
{
7166
$exception = CouldNotSendNotification::serviceRespondedWithAnError($this->message, [
7267
'status' => 500,

tests/InterfaxChannelTest.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ public function setUp(): void
3535
$this->channel = new InterfaxChannel($this->interfax);
3636
}
3737

38-
/** @test */
39-
public function it_can_send_notification_with_a_single_file()
38+
public function test_send_notification_with_a_single_file()
4039
{
4140
$this->interfax->expects('deliver')
4241
->once()
@@ -55,8 +54,7 @@ public function it_can_send_notification_with_a_single_file()
5554
$this->channel->send(new TestNotifiable, new TestNotificationWithSingleFile);
5655
}
5756

58-
/** @test */
59-
public function it_can_send_notification_with_files()
57+
public function test_send_notification_with_files()
6058
{
6159
$this->interfax->expects('deliver')
6260
->once()
@@ -81,8 +79,7 @@ public function it_can_send_notification_with_files()
8179
$this->channel->send(new TestNotifiable, new TestNotificationWithFiles);
8280
}
8381

84-
/** @test */
85-
public function it_can_send_notification_pdf_as_stream()
82+
public function test_send_notification_pdf_as_stream()
8683
{
8784
$this->interfax->expects('deliver')
8885
->with(Mockery::on(function ($output) {
@@ -110,8 +107,7 @@ public function it_can_send_notification_pdf_as_stream()
110107
$this->channel->send(new TestNotifiable, new TestNotificationAsStreamPdf);
111108
}
112109

113-
/** @test */
114-
public function it_can_send_notification_html_as_stream()
110+
public function test_send_notification_html_as_stream()
115111
{
116112
$filename = 'test-file.html';
117113
$this->addFile($filename);
@@ -144,14 +140,12 @@ public function it_can_send_notification_html_as_stream()
144140
$this->channel->send(new TestNotifiable, new TestNotificationAsStreamHtml);
145141
}
146142

147-
/** @test */
148-
public function it_can_return_early_when_no_fax_number_provided()
143+
public function test_return_early_when_no_fax_number_provided()
149144
{
150145
$this->assertNull($this->channel->send(new TestNotifiableNotSendable, new TestNotificationWithFiles));
151146
}
152147

153-
/** @test */
154-
public function it_can_refresh_the_file_response()
148+
public function test_refresh_the_file_response()
155149
{
156150
$this->resource
157151
->expects('refresh')
@@ -169,8 +163,7 @@ public function it_can_refresh_the_file_response()
169163
$this->channel->send(new TestNotifiable, new TestNotificationWithRefresh);
170164
}
171165

172-
/** @test */
173-
public function it_can_throw_the_exception()
166+
public function test_throw_the_exception()
174167
{
175168
$this->expectException(CouldNotSendNotification::class);
176169

tests/InterfaxMessageTest.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
class InterfaxMessageTest extends TestCase
88
{
9-
/** @test */
10-
public function it_should_check_the_status_via_refresh()
9+
public function test_check_the_status_via_refresh()
1110
{
1211
$message = (new InterfaxMessage)
1312
->checkStatus()
@@ -17,8 +16,7 @@ public function it_should_check_the_status_via_refresh()
1716
$this->assertTrue($message->shouldCheckStatus());
1817
}
1918

20-
/** @test */
21-
public function it_should_not_check_the_status_via_refresh_manual()
19+
public function test_not_check_the_status_via_refresh_manual()
2220
{
2321
$message = (new InterfaxMessage)
2422
->checkStatus(false)
@@ -28,8 +26,7 @@ public function it_should_not_check_the_status_via_refresh_manual()
2826
$this->assertFalse($message->shouldCheckStatus());
2927
}
3028

31-
/** @test */
32-
public function it_should_not_check_the_status_via_refresh_default()
29+
public function test_not_check_the_status_via_refresh_default()
3330
{
3431
$message = (new InterfaxMessage)
3532
->user(new TestNotifiable)
@@ -38,8 +35,7 @@ public function it_should_not_check_the_status_via_refresh_default()
3835
$this->assertFalse($message->shouldCheckStatus());
3936
}
4037

41-
/** @test */
42-
public function it_should_set_the_file_chunk_size_filename()
38+
public function test_set_the_file_chunk_size_filename()
4339
{
4440
$this->increaseChunkSize();
4541

@@ -53,8 +49,7 @@ public function it_should_set_the_file_chunk_size_filename()
5349
$this->assertSame($this->chunkSize, $this->getChunkSize($delivery));
5450
}
5551

56-
/** @test */
57-
public function it_should_set_the_file_chunk_size_file_array()
52+
public function test_set_the_file_chunk_size_file_array()
5853
{
5954
$this->increaseChunkSize();
6055

@@ -68,8 +63,7 @@ public function it_should_set_the_file_chunk_size_file_array()
6863
$this->assertSame($this->chunkSize, $this->getChunkSize($delivery));
6964
}
7065

71-
/** @test */
72-
public function it_should_set_the_file_chunk_size_file_object()
66+
public function test_set_the_file_chunk_size_file_object()
7367
{
7468
$this->increaseChunkSize();
7569
$client = new \Interfax\Client;

0 commit comments

Comments
 (0)