Skip to content

Commit 451adf8

Browse files
authored
Merge pull request #50 from jesperbeisner/feature/make-laravel-11-ready
WIP - feature: make laravel 11 ready
2 parents 90c80b7 + cc0664c commit 451adf8

File tree

8 files changed

+37
-33
lines changed

8 files changed

+37
-33
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
runs-on: ubuntu-latest
66
strategy:
77
matrix:
8-
php-versions: [ '8.1', '8.2' ]
8+
php-versions: [ '8.2' ]
99
name: Testing on PHP ${{ matrix.php-versions }}
1010
steps:
1111
- name: Checkout

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
| 8.0 | ^6.0 (with php 8) |
1616
| 9.0 | ^7.0 |
1717
| 10.0 | ^8.0 |
18+
| 11.0 | ^9.0 |
1819

1920
A package to send [gelf](http://docs.graylog.org/en/2.1/pages/gelf.html) logs to a gelf compatible backend like graylog. It is a Laravel wrapper for [bzikarsky/gelf-php](https://github.com/bzikarsky/gelf-php) package.
2021

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
"source": "https://github.com/hedii/laravel-gelf-logger"
2727
},
2828
"require": {
29-
"php": "^8.1",
29+
"php": "^8.2",
3030
"graylog2/gelf-php": "^2.0",
31-
"illuminate/log": "^10.0"
31+
"illuminate/log": "^11.0"
3232
},
3333
"require-dev": {
34-
"orchestra/testbench": "^8.0"
34+
"orchestra/testbench": "^9.0"
3535
},
3636
"autoload": {
3737
"psr-4": {

tests/GelfLoggerTest.php

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
use Monolog\Handler\GelfHandler;
1616
use Monolog\Level;
1717
use Monolog\Logger;
18+
use PHPUnit\Framework\Attributes\Test;
1819

1920
class GelfLoggerTest extends TestCase
2021
{
21-
/** @test */
22+
#[Test]
2223
public function it_should_have_a_gelf_log_channel(): void
2324
{
2425
$logger = Log::channel('gelf');
@@ -40,7 +41,7 @@ public function it_should_have_a_gelf_log_channel(): void
4041
$this->assertInstanceOf(UdpTransport::class, $transport);
4142
}
4243

43-
/** @test */
44+
#[Test]
4445
public function it_should_not_have_any_processor_if_the_config_does_not_have_processors(): void
4546
{
4647
$this->expectException(LogicException::class);
@@ -52,7 +53,7 @@ public function it_should_not_have_any_processor_if_the_config_does_not_have_pro
5253
$handler->popProcessor();
5354
}
5455

55-
/** @test */
56+
#[Test]
5657
public function it_should_set_system_name_to_current_hostname_if_system_name_is_null(): void
5758
{
5859
$this->mergeConfig('logging.channels.gelf', [
@@ -69,7 +70,7 @@ public function it_should_set_system_name_to_current_hostname_if_system_name_is_
6970
);
7071
}
7172

72-
/** @test */
73+
#[Test]
7374
public function it_should_set_system_name_to_custom_value_if_system_name_config_is_provided(): void
7475
{
7576
$this->mergeConfig('logging.channels.gelf', [
@@ -86,7 +87,7 @@ public function it_should_set_system_name_to_custom_value_if_system_name_config_
8687
);
8788
}
8889

89-
/** @test */
90+
#[Test]
9091
public function it_should_call_the_tcp_transport_method_when_provided(): void
9192
{
9293
$this->mergeConfig('logging.channels.gelf', [
@@ -102,7 +103,7 @@ public function it_should_call_the_tcp_transport_method_when_provided(): void
102103
$this->assertInstanceOf(TcpTransport::class, $transport);
103104
}
104105

105-
/** @test */
106+
#[Test]
106107
public function it_should_call_the_udp_transport_method_when_nothing_is_provided(): void
107108
{
108109
$this->mergeConfig('logging.channels.gelf', [
@@ -117,7 +118,7 @@ public function it_should_call_the_udp_transport_method_when_nothing_is_provided
117118
$this->assertInstanceOf(UdpTransport::class, $transport);
118119
}
119120

120-
/** @test */
121+
#[Test]
121122
public function it_should_set_max_length_if_max_length_is_provided(): void
122123
{
123124
$this->mergeConfig('logging.channels.gelf', [
@@ -134,7 +135,7 @@ public function it_should_set_max_length_if_max_length_is_provided(): void
134135
);
135136
}
136137

137-
/** @test */
138+
#[Test]
138139
public function it_should_use_default_max_length_when_max_length_is_not_provided(): void
139140
{
140141
$this->mergeConfig('logging.channels.gelf', [
@@ -150,7 +151,7 @@ public function it_should_use_default_max_length_when_max_length_is_not_provided
150151
);
151152
}
152153

153-
/** @test */
154+
#[Test]
154155
public function it_should_use_default_max_length_when_max_length_is_null(): void
155156
{
156157
$this->mergeConfig('logging.channels.gelf', [
@@ -167,7 +168,7 @@ public function it_should_use_default_max_length_when_max_length_is_null(): void
167168
);
168169
}
169170

170-
/** @test */
171+
#[Test]
171172
public function it_should_call_the_http_transport_method_when_provided(): void
172173
{
173174
$this->mergeConfig('logging.channels.gelf', [
@@ -183,7 +184,7 @@ public function it_should_call_the_http_transport_method_when_provided(): void
183184
$this->assertInstanceOf(HttpTransport::class, $transport);
184185
}
185186

186-
/** @test */
187+
#[Test]
187188
public function it_should_set_path_if_path_is_provided(): void
188189
{
189190
$this->mergeConfig('logging.channels.gelf', [
@@ -201,7 +202,7 @@ public function it_should_set_path_if_path_is_provided(): void
201202
$this->assertSame('/custom-path', $this->getAttribute($transport, 'path'));
202203
}
203204

204-
/** @test */
205+
#[Test]
205206
public function it_should_set_path_to_default_path_if_path_is_null(): void
206207
{
207208
$this->mergeConfig('logging.channels.gelf', [
@@ -222,7 +223,7 @@ public function it_should_set_path_to_default_path_if_path_is_null(): void
222223
);
223224
}
224225

225-
/** @test */
226+
#[Test]
226227
public function it_should_set_path_to_default_path_if_path_is_not_provided(): void
227228
{
228229
$this->mergeConfig('logging.channels.gelf', [
@@ -242,7 +243,7 @@ public function it_should_set_path_to_default_path_if_path_is_not_provided(): vo
242243
);
243244
}
244245

245-
/** @test */
246+
#[Test]
246247
public function it_should_set_the_ssl_options_for_tcp_transport(): void
247248
{
248249
$this->mergeConfig('logging.channels.gelf', [
@@ -272,7 +273,7 @@ public function it_should_set_the_ssl_options_for_tcp_transport(): void
272273
$this->assertEquals('TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256', $sslOptions->getCiphers());
273274
}
274275

275-
/** @test */
276+
#[Test]
276277
public function it_should_set_the_ssl_options_for_http_transport(): void
277278
{
278279
$this->mergeConfig('logging.channels.gelf', [
@@ -303,7 +304,7 @@ public function it_should_set_the_ssl_options_for_http_transport(): void
303304
}
304305

305306

306-
/** @test */
307+
#[Test]
307308
public function it_should_not_add_ssl_on_tcp_transport_when_the_ssl_config_is_missing_or_set_to_false(): void
308309
{
309310
$this->mergeConfig('logging.channels.gelf', [
@@ -346,7 +347,7 @@ public function it_should_not_add_ssl_on_tcp_transport_when_the_ssl_config_is_mi
346347
$this->assertNull($this->getAttribute($transport, 'sslOptions'));
347348
}
348349

349-
/** @test */
350+
#[Test]
350351
public function it_should_not_add_ssl_on_http_transport_when_the_ssl_config_is_missing_or_set_to_false(): void
351352
{
352353
$this->mergeConfig('logging.channels.gelf', [
@@ -387,7 +388,7 @@ public function it_should_not_add_ssl_on_http_transport_when_the_ssl_config_is_m
387388
$this->assertNull($this->getAttribute($transport, 'sslOptions'));
388389
}
389390

390-
/** @test */
391+
#[Test]
391392
public function it_should_use_the_default_ssl_options_when_ssl_options_is_missing(): void
392393
{
393394
$this->mergeConfig('logging.channels.gelf', [
@@ -431,7 +432,7 @@ public function it_should_use_the_default_ssl_options_when_ssl_options_is_missin
431432
$this->assertNull($sslOptions->getCiphers());
432433
}
433434

434-
/** @test */
435+
#[Test]
435436
public function it_should_ignore_errors_when_the_ignore_error_config_is_missing_or_set_to_false(): void
436437
{
437438
$this->app['config']->set('logging.default', 'gelf');

tests/GelfMessageTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
use Illuminate\Support\Facades\Log;
88
use Monolog\Level;
99
use Monolog\LogRecord;
10+
use PHPUnit\Framework\Attributes\Test;
1011

1112
class GelfMessageTest extends TestCase
1213
{
13-
/** @test */
14+
#[Test]
1415
public function it_should_append_prefixes(): void
1516
{
1617
$this->mergeConfig('logging.channels.gelf', [
@@ -36,7 +37,7 @@ public function it_should_append_prefixes(): void
3637
$this->assertArrayHasKey('ctxt_message', $formattedMessage->getAllAdditionals());
3738
}
3839

39-
/** @test */
40+
#[Test]
4041
public function it_should_not_append_prefixes(): void
4142
{
4243
$this->mergeConfig('logging.channels.gelf', [
@@ -58,7 +59,7 @@ public function it_should_not_append_prefixes(): void
5859
$this->assertArrayHasKey('id', $formattedMessage->getAllAdditionals());
5960
}
6061

61-
/** @test */
62+
#[Test]
6263
public function null_config_variables_should_not_add_prefixes(): void
6364
{
6465
$this->mergeConfig('logging.channels.gelf', [

tests/ProcessorTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
use Hedii\LaravelGelfLogger\Tests\Fake\AnotherTestProcessor;
66
use Hedii\LaravelGelfLogger\Tests\Fake\TestProcessor;
77
use Illuminate\Support\Facades\Log;
8+
use PHPUnit\Framework\Attributes\Test;
89

910
class ProcessorTest extends TestCase
1011
{
11-
/** @test */
12+
#[Test]
1213
public function it_should_have_the_configured_processors(): void
1314
{
1415
$this->mergeConfig('logging.channels.gelf', [

tests/Processors/NullStringProcessorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
namespace Hedii\LaravelGelfLogger\Tests\Processors;
44

5-
use Carbon\Carbon;
65
use DateTimeImmutable;
76
use Hedii\LaravelGelfLogger\Processors\NullStringProcessor;
87
use Monolog\Level;
98
use Monolog\LogRecord;
9+
use PHPUnit\Framework\Attributes\Test;
1010
use PHPUnit\Framework\TestCase;
1111

1212
class NullStringProcessorTest extends TestCase
1313
{
14-
/** @test */
14+
#[Test]
1515
public function it_should_transform_null_string_to_null(): void
1616
{
1717
$payload = new LogRecord(

tests/Processors/RenameIdFieldProcessorTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
use Hedii\LaravelGelfLogger\Processors\RenameIdFieldProcessor;
77
use Monolog\Level;
88
use Monolog\LogRecord;
9+
use PHPUnit\Framework\Attributes\DataProvider;
10+
use PHPUnit\Framework\Attributes\Test;
911
use PHPUnit\Framework\TestCase;
1012

1113
class RenameIdFieldProcessorTest extends TestCase
1214
{
13-
/**
14-
* @test
15-
* @dataProvider dataProvider
16-
*/
15+
#[Test]
16+
#[DataProvider('dataProvider')]
1717
public function it_should_rename_id_field(array $payloadContext, array $expected): void
1818
{
1919
$payload = new LogRecord(

0 commit comments

Comments
 (0)