Skip to content

Commit

Permalink
Laravel 11
Browse files Browse the repository at this point in the history
Close #15
  • Loading branch information
hedii committed Mar 22, 2024
1 parent acc5961 commit d41ffac
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [8.1]
php-versions: [8.2]
name: Testing on PHP ${{ matrix.php-versions }}
steps:
- name: Checkout
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
"source": "https://github.com/hedii/artisan-log-cleaner"
},
"require": {
"php": "^8.1",
"illuminate/console": "^10.0",
"illuminate/filesystem": "^10.0",
"illuminate/support": "^10.0"
"php": "^8.2",
"illuminate/console": "^11.0",
"illuminate/filesystem": "^11.0",
"illuminate/support": "^11.0"
},
"require-dev": {
"orchestra/testbench": "^8.0"
"orchestra/testbench": "^9.0"
},
"autoload": {
"psr-4": {
Expand Down
22 changes: 12 additions & 10 deletions tests/ClearLogsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

namespace Hedii\ArtisanLogCleaner\Tests;

use PHPUnit\Framework\Attributes\Test;

class ClearLogsTest extends TestCase
{
/** @test */
#[Test]
public function it_should_delete_all_files_in_log_directory(): void
{
$this->createLogFile(['file1.log', 'file2.log']);
Expand All @@ -18,7 +20,7 @@ public function it_should_delete_all_files_in_log_directory(): void
$this->assertFileDoesNotExist($this->logDirectory . '/file2.log');
}

/** @test */
#[Test]
public function it_should_not_delete_dot_files_in_log_directory(): void
{
$this->createLogFile(['file1.log', 'file2.log']);
Expand All @@ -33,7 +35,7 @@ public function it_should_not_delete_dot_files_in_log_directory(): void
$this->assertFileDoesNotExist($this->logDirectory . '/file2.log');
}

/** @test */
#[Test]
public function it_should_keep_the_last_log_file_if_the_option_is_provided(): void
{
touch($this->logDirectory . '/file1.log', time() - 3600);
Expand All @@ -51,7 +53,7 @@ public function it_should_keep_the_last_log_file_if_the_option_is_provided(): vo
$this->assertFileDoesNotExist($this->logDirectory . '/file3.log');
}

/** @test */
#[Test]
public function it_should_keep_the_last_log_file_if_the_option_is_with_only_one_file(): void
{
touch($this->logDirectory . '/file1.log', time() - 3600);
Expand All @@ -63,7 +65,7 @@ public function it_should_keep_the_last_log_file_if_the_option_is_with_only_one_
$this->assertFileExists($this->logDirectory . '/file1.log');
}

/** @test */
#[Test]
public function it_should_keep_the_specified_log_file_if_the_option_is_keep_specified_files(): void
{
touch($this->logDirectory . '/file1.log', time() - 3600);
Expand All @@ -78,23 +80,23 @@ public function it_should_keep_the_specified_log_file_if_the_option_is_keep_spec
$this->assertFileExists($this->logDirectory . '/file2.log');
}

/** @test */
#[Test]
public function it_should_return_zero_even_if_there_is_no_log_file(): void
{
$this
->artisan('log:clear')
->assertExitCode(0);
}

/** @test */
#[Test]
public function it_should_return_zero_with_the_keep_last_option_even_if_there_is_no_log_file(): void
{
$this
->artisan('log:clear', ['--keep-last' => true])
->assertExitCode(0);
}

/** @test */
#[Test]
public function it_should_display_the_correct_message_when_no_log_file_has_been_deleted(): void
{
$this
Expand All @@ -103,7 +105,7 @@ public function it_should_display_the_correct_message_when_no_log_file_has_been_
->assertExitCode(0);
}

/** @test */
#[Test]
public function it_should_display_the_correct_message_when_one_log_file_has_been_deleted(): void
{
$this->createLogFile(['file1.log', 'file2.log']);
Expand All @@ -117,7 +119,7 @@ public function it_should_display_the_correct_message_when_one_log_file_has_been
->assertExitCode(0);
}

/** @test */
#[Test]
public function it_should_display_the_correct_message_when_more_than_one_log_file_has_been_deleted(): void
{
$this->createLogFile(['file1.log', 'file2.log', 'file3.log']);
Expand Down

0 comments on commit d41ffac

Please sign in to comment.