Skip to content

Commit 8731f89

Browse files
committed
Laravel 11 support
1 parent bd06660 commit 8731f89

File tree

12 files changed

+101
-100
lines changed

12 files changed

+101
-100
lines changed

.github/workflows/tests.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
php: [8.1, 8.2]
20+
php: [8.2, 8.3, 8.4]
2121
stability: [prefer-lowest, prefer-stable]
2222

2323
name: PHP ${{ matrix.php }} / ${{ matrix.stability }}
2424

2525
steps:
2626
- name: Checkout code
27-
uses: actions/checkout@v2
27+
uses: actions/checkout@v4
2828

2929
- name: Setup PHP
3030
uses: shivammathur/setup-php@v2
@@ -54,6 +54,8 @@ jobs:
5454
DB_DATABASE: forge
5555

5656
- name: Code coverage
57-
uses: codecov/codecov-action@v1
57+
uses: codecov/codecov-action@v3
5858
with:
59-
file: ./build/logs/clover.xml
59+
token: ${{ secrets.CODECOV_TOKEN }}
60+
files: ./build/logs/clover.xml
61+
fail_ci_if_error: true

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Logging and Notifications for Laravel Console Commands.
1717

1818
| Laravel | Console Logger |
1919
|---------|---------------------------------------------------------------------------|
20-
| 11.x | _[Support](https://buymeacoffee.com/dmitry.ivanov)_ |
20+
| 11.x | [11.x](https://github.com/dmitry-ivanov/laravel-console-logger/tree/11.x) |
2121
| 10.x | [10.x](https://github.com/dmitry-ivanov/laravel-console-logger/tree/10.x) |
2222
| 9.x | [9.x](https://github.com/dmitry-ivanov/laravel-console-logger/tree/9.x) |
2323
| 8.x | [8.x](https://github.com/dmitry-ivanov/laravel-console-logger/tree/8.x) |

composer.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212
"email": "[email protected]"
1313
}],
1414
"require": {
15-
"php": "^8.1",
16-
"illuminate/console": "^10.0",
17-
"illuminate/support": "^10.0",
18-
"illuminated/helper-functions": "^10.0",
15+
"php": "^8.2",
16+
"illuminate/console": "^11.0",
17+
"illuminate/support": "^11.0",
18+
"illuminated/helper-functions": "^11.0",
1919
"monolog/monolog": "^3.0",
2020
"psr/http-message": "^1.0",
2121
"psr/log": "^1.0|^2.0|^3.0",
22-
"symfony/finder": "^6.2"
22+
"symfony/finder": "^7.0.3"
2323
},
2424
"require-dev": {
25-
"phpunit/phpunit": "^10.5",
26-
"mockery/mockery": "^1.5.1",
27-
"guzzlehttp/guzzle": "^7.5",
28-
"orchestra/testbench": "^8.0",
29-
"illuminated/testing-tools": "^10.0"
25+
"phpunit/phpunit": "^11.3.6",
26+
"mockery/mockery": "^1.6.10",
27+
"guzzlehttp/guzzle": "^7.8.2",
28+
"orchestra/testbench": "^9.11.2",
29+
"illuminated/testing-tools": "^11.0"
3030
},
3131
"autoload": {
3232
"files": [

phpunit.xml.dist

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
3-
backupGlobals="false"
4-
backupStaticProperties="false"
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.3/phpunit.xsd"
53
beStrictAboutTestsThatDoNotTestAnything="false"
64
beStrictAboutOutputDuringTests="true"
75
bootstrap="vendor/autoload.php"
8-
cacheDirectory=".phpunit.cache"
96
colors="true"
10-
processIsolation="false"
11-
stopOnError="false"
12-
stopOnFailure="false"
7+
displayDetailsOnPhpunitDeprecations="true"
8+
displayDetailsOnTestsThatTriggerErrors="true"
9+
displayDetailsOnTestsThatTriggerNotices="true"
10+
displayDetailsOnTestsThatTriggerWarnings="true"
1311
>
1412
<testsuites>
1513
<testsuite name="Laravel Console Logger Test Suite">
16-
<directory suffix="Test.php">./tests</directory>
14+
<directory>./tests</directory>
1715
</testsuite>
1816
</testsuites>
1917

2018
<source>
2119
<include>
22-
<directory suffix=".php">./src</directory>
20+
<directory>./src</directory>
2321
</include>
2422
</source>
2523
</phpunit>

tests/Exceptions/ExceptionHandlerTest.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
use Illuminated\Console\Tests\TestCase;
99
use Mockery;
1010
use Monolog\Logger;
11+
use PHPUnit\Framework\Attributes\Test;
1112

1213
class ExceptionHandlerTest extends TestCase
1314
{
14-
/** @test */
15-
public function it_logs_an_error_for_all_occurred_application_notices_warnings_errors_and_exceptions()
15+
#[Test]
16+
public function it_logs_an_error_for_all_occurred_application_notices_warnings_errors_and_exceptions(): void
1617
{
1718
$logger = spy(Logger::class);
1819

@@ -30,8 +31,8 @@ public function it_logs_an_error_for_all_occurred_application_notices_warnings_e
3031
]);
3132
}
3233

33-
/** @test */
34-
public function it_supports_sentry()
34+
#[Test]
35+
public function it_supports_sentry(): void
3536
{
3637
app()->instance('sentry', $sentry = spy());
3738
$exception = new Exception('Test exception', 111);
@@ -43,8 +44,8 @@ public function it_supports_sentry()
4344
$sentry->shouldHaveReceived('captureException', [$exception]);
4445
}
4546

46-
/** @test */
47-
public function it_supports_custom_runtime_exception_which_has_ability_to_set_optional_context()
47+
#[Test]
48+
public function it_supports_custom_runtime_exception_which_has_ability_to_set_optional_context(): void
4849
{
4950
$logger = spy(Logger::class);
5051

tests/Loggable/FileChannel/FileChannelTest.php

+9-8
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,28 @@
77
use Illuminated\Console\Tests\App\Console\Commands\GenericCommand;
88
use Illuminated\Console\Tests\TestCase;
99
use Monolog\Handler\NullHandler;
10+
use PHPUnit\Framework\Attributes\Test;
1011

1112
class FileChannelTest extends TestCase
1213
{
13-
/** @test */
14-
public function it_creates_log_file_according_to_the_command_name_and_current_date()
14+
#[Test]
15+
public function it_creates_log_file_according_to_the_command_name_and_current_date(): void
1516
{
1617
$this->artisan('generic');
1718

1819
$this->seeLogFile("generic/{$this->date}.log");
1920
}
2021

21-
/** @test */
22-
public function it_creates_log_file_in_subfolder_if_command_is_namespaced()
22+
#[Test]
23+
public function it_creates_log_file_in_subfolder_if_command_is_namespaced(): void
2324
{
2425
$this->artisan('namespaced:command');
2526

2627
$this->seeLogFile("namespaced/command/{$this->date}.log");
2728
}
2829

29-
/** @test */
30-
public function it_provides_automatic_file_rotation_and_only_30_latest_files_are_stored()
30+
#[Test]
31+
public function it_provides_automatic_file_rotation_and_only_30_latest_files_are_stored(): void
3132
{
3233
$path = storage_path('logs/generic');
3334
$this->createLogFiles($path, 45);
@@ -39,8 +40,8 @@ public function it_provides_automatic_file_rotation_and_only_30_latest_files_are
3940
$this->assertFilesCount($path, 30);
4041
}
4142

42-
/** @test */
43-
public function it_supports_separator_in_psr3_methods_which_is_transformed_to_11_blank_lines()
43+
#[Test]
44+
public function it_supports_separator_in_psr3_methods_which_is_transformed_to_11_blank_lines(): void
4445
{
4546
$this->artisan('separator-logging-command');
4647

tests/Loggable/Notifications/DatabaseChannel/DatabaseChannelTest.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@
66
use Illuminate\Support\Facades\Schema;
77
use Illuminated\Console\Tests\TestCase;
88
use Monolog\Level;
9+
use PHPUnit\Framework\Attributes\Test;
910

1011
class DatabaseChannelTest extends TestCase
1112
{
12-
/** @test */
13-
public function it_is_not_storing_notifications_to_database_if_it_is_disabled()
13+
#[Test]
14+
public function it_is_not_storing_notifications_to_database_if_it_is_disabled(): void
1415
{
1516
$this->artisan('database-notifications-disabled-command');
1617

1718
$this->assertDatabaseMissingTable('iclogger_notifications');
1819
}
1920

20-
/** @test */
21-
public function it_stores_notifications_to_database_if_it_is_enabled_and_also_according_to_notifications_level()
21+
#[Test]
22+
public function it_stores_notifications_to_database_if_it_is_enabled_and_also_according_to_notifications_level(): void
2223
{
2324
$this->artisan('database-notifications-command');
2425

@@ -61,8 +62,8 @@ public function it_stores_notifications_to_database_if_it_is_enabled_and_also_ac
6162
]);
6263
}
6364

64-
/** @test */
65-
public function it_provides_an_ability_to_use_custom_database_table_and_callback_for_database_notifications()
65+
#[Test]
66+
public function it_provides_an_ability_to_use_custom_database_table_and_callback_for_database_notifications(): void
6667
{
6768
Schema::create('custom_notifications', function (Blueprint $table) {
6869
$table->increments('id');

tests/Loggable/Notifications/EmailChannel/EmailChannelTest.php

+11-10
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@
1212
use Monolog\Handler\Handler;
1313
use Monolog\Handler\SymfonyMailerHandler;
1414
use Monolog\Level;
15+
use PHPUnit\Framework\Attributes\Test;
1516
use Symfony\Component\Mime\Email;
1617

1718
class EmailChannelTest extends TestCase
1819
{
19-
/** @test */
20-
public function it_validates_and_filters_notification_recipients()
20+
#[Test]
21+
public function it_validates_and_filters_notification_recipients(): void
2122
{
2223
$this->artisan(EmailNotificationsInvalidRecipientsCommand::class);
2324
$this->assertNotInstanceOf(SymfonyMailerHandler::class, $this->emailChannelHandler());
2425
}
2526

26-
/** @test */
27-
public function it_uses_configured_monolog_symfony_mailer_handler_on_mail_driver()
27+
#[Test]
28+
public function it_uses_configured_monolog_symfony_mailer_handler_on_mail_driver(): void
2829
{
2930
config(['mail.driver' => 'mail']);
3031

@@ -33,8 +34,8 @@ public function it_uses_configured_monolog_symfony_mailer_handler_on_mail_driver
3334
$this->assertMailerHandlersEqual($this->composeSymfonyMailerHandler(), $this->emailChannelHandler());
3435
}
3536

36-
/** @test */
37-
public function it_uses_configured_monolog_symfony_mailer_handler_on_smtp_driver()
37+
#[Test]
38+
public function it_uses_configured_monolog_symfony_mailer_handler_on_smtp_driver(): void
3839
{
3940
config([
4041
'mail.driver' => 'smtp',
@@ -47,8 +48,8 @@ public function it_uses_configured_monolog_symfony_mailer_handler_on_smtp_driver
4748
$this->assertMailerHandlersEqual($this->composeSymfonyMailerHandler(), $this->emailChannelHandler());
4849
}
4950

50-
/** @test */
51-
public function it_uses_configured_monolog_symfony_mailer_handler_on_sendmail_driver()
51+
#[Test]
52+
public function it_uses_configured_monolog_symfony_mailer_handler_on_sendmail_driver(): void
5253
{
5354
config(['mail.driver' => 'sendmail']);
5455

@@ -57,8 +58,8 @@ public function it_uses_configured_monolog_symfony_mailer_handler_on_sendmail_dr
5758
$this->assertMailerHandlersEqual($this->composeSymfonyMailerHandler(), $this->emailChannelHandler());
5859
}
5960

60-
/** @test */
61-
public function it_uses_configured_monolog_deduplication_handler_if_deduplication_enabled()
61+
#[Test]
62+
public function it_uses_configured_monolog_deduplication_handler_if_deduplication_enabled(): void
6263
{
6364
config(['mail.driver' => 'sendmail']);
6465

tests/Loggable/Notifications/EmailChannel/MonologHtmlFormatterTest.php

+21-20
Original file line numberDiff line numberDiff line change
@@ -7,75 +7,76 @@
77
use Illuminated\Console\Tests\TestCase;
88
use Monolog\Level;
99
use Monolog\LogRecord;
10+
use PHPUnit\Framework\Attributes\Test;
1011

1112
class MonologHtmlFormatterTest extends TestCase
1213
{
13-
/** @test */
14-
public function it_properly_formats_debug_records()
14+
#[Test]
15+
public function it_properly_formats_debug_records(): void
1516
{
1617
$record = $this->generateRecord('Debug!', Level::Debug);
1718

1819
$this->assertFormatterGeneratesExpectedOutput($record);
1920
}
2021

21-
/** @test */
22-
public function it_properly_formats_info_records()
22+
#[Test]
23+
public function it_properly_formats_info_records(): void
2324
{
2425
$record = $this->generateRecord('Info!', Level::Info);
2526

2627
$this->assertFormatterGeneratesExpectedOutput($record);
2728
}
2829

29-
/** @test */
30-
public function it_properly_formats_notice_records()
30+
#[Test]
31+
public function it_properly_formats_notice_records(): void
3132
{
3233
$record = $this->generateRecord('Notice!', Level::Notice);
3334

3435
$this->assertFormatterGeneratesExpectedOutput($record);
3536
}
3637

37-
/** @test */
38-
public function it_properly_formats_warning_records()
38+
#[Test]
39+
public function it_properly_formats_warning_records(): void
3940
{
4041
$record = $this->generateRecord('Warning!', Level::Warning);
4142

4243
$this->assertFormatterGeneratesExpectedOutput($record);
4344
}
4445

45-
/** @test */
46-
public function it_properly_formats_error_records()
46+
#[Test]
47+
public function it_properly_formats_error_records(): void
4748
{
4849
$record = $this->generateRecord('Error!', Level::Error);
4950

5051
$this->assertFormatterGeneratesExpectedOutput($record);
5152
}
5253

53-
/** @test */
54-
public function it_properly_formats_critical_records()
54+
#[Test]
55+
public function it_properly_formats_critical_records(): void
5556
{
5657
$record = $this->generateRecord('Critical!', Level::Critical);
5758

5859
$this->assertFormatterGeneratesExpectedOutput($record);
5960
}
6061

61-
/** @test */
62-
public function it_properly_formats_alert_records()
62+
#[Test]
63+
public function it_properly_formats_alert_records(): void
6364
{
6465
$record = $this->generateRecord('Alert!', Level::Alert);
6566

6667
$this->assertFormatterGeneratesExpectedOutput($record);
6768
}
6869

69-
/** @test */
70-
public function it_properly_formats_emergency_records()
70+
#[Test]
71+
public function it_properly_formats_emergency_records(): void
7172
{
7273
$record = $this->generateRecord('Emergency!', Level::Emergency);
7374

7475
$this->assertFormatterGeneratesExpectedOutput($record);
7576
}
7677

77-
/** @test */
78-
public function it_properly_formats_records_with_array_context()
78+
#[Test]
79+
public function it_properly_formats_records_with_array_context(): void
7980
{
8081
$record = $this->generateRecord('Record with array context!', Level::Warning, [
8182
'foo' => 'bar',
@@ -87,8 +88,8 @@ public function it_properly_formats_records_with_array_context()
8788
$this->assertFormatterGeneratesExpectedOutput($record);
8889
}
8990

90-
/** @test */
91-
public function it_has_no_environment_subtitle_for_production()
91+
#[Test]
92+
public function it_has_no_environment_subtitle_for_production(): void
9293
{
9394
$this->emulateProduction();
9495
$record = $this->generateRecord('Notice!', Level::Notice);

0 commit comments

Comments
 (0)