-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fixing issue when log route name in breadcrumbs was ignoring con…
…fig value
- Loading branch information
Showing
18 changed files
with
174 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,8 @@ on: | |
push: | ||
branches: | ||
- master | ||
# paths: | ||
# - "**/*.php" | ||
paths: | ||
- "**/*.php" | ||
pull_request: | ||
|
||
jobs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
# Releases | ||
|
||
## v1.0.1 Jan 11, 2024 | ||
|
||
- Fix: fixing issue when log route name in breadcrumbs was ignoring config value | ||
- Feat: added separate options for menu localization | ||
- Tests: added tests for default log screen | ||
|
||
## v1.0.0 Jan 10, 2024 | ||
|
||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,9 @@ | |
'success_message' => 'File :file was removed', | ||
], | ||
], | ||
|
||
'menu' => [ | ||
'name' => 'Logs', | ||
'title' => 'Logs', | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
|
||
use Czernika\OrchidLogViewer\LogData; | ||
use Czernika\OrchidLogViewer\LogManager; | ||
use Czernika\OrchidLogViewer\Screen\OrchidLogListScreen; | ||
use Illuminate\Testing\TestResponse; | ||
use Tests\App\Screen\TestOrchidLogListScreen; | ||
|
||
uses()->group('feature.screen'); | ||
|
||
beforeEach(function () { | ||
$this->withoutExceptionHandling(); | ||
}); | ||
|
||
afterAll(function () { | ||
// Rollback | ||
LogManager::useScreen(OrchidLogListScreen::class); | ||
}); | ||
|
||
describe('default screen', function () { | ||
it('shows headings', function () { | ||
$this->mockLogsWith(); | ||
|
||
/** @var TestResponse */ | ||
$response = $this->see(); | ||
|
||
$response | ||
->assertSee('<h1 class="m-0 fw-light h3 text-black">Logs</h1>', false) | ||
->assertSee('Manage app storage logs'); | ||
}); | ||
|
||
it('shows empty table if there are no logs', function () { | ||
$this->mockLogsWith(); | ||
|
||
/** @var TestResponse */ | ||
$response = $this->see(); | ||
|
||
$response->assertSee('There are no objects currently displayed'); | ||
}); | ||
|
||
it('shows correct log data if there are some logs', function () { | ||
$this->mockLogsWith([ | ||
new LogData([ | ||
'text' => 'Log message', | ||
'stack' => 'Some really long stack trace', | ||
'date' => '2024-01-01 12:00:00', | ||
'level' => 'error', | ||
'level_img' => 'exclamation-triangle', | ||
]), | ||
]); | ||
|
||
/** @var TestResponse */ | ||
$response = $this->see(); | ||
|
||
$response | ||
->assertSee('Log message') // log message | ||
->assertSee('Error') // log level with capitalized first letter | ||
->assertSee('path="bs.exclamation-triangle"', false) // log level icon | ||
->assertSee('<time class="mb-0 text-capitalize">Jan 1, 2024<span class="text-muted d-block">Mon, 12:00</span></time>', false) // formatted date | ||
->assertSee('data-controller="modal-toggle"', false) // stack trace button | ||
->assertSee('data-modal-toggle-params=\'{"stack":"Some really long stack trace"}\'', false); // stack trace param | ||
}); | ||
|
||
it('will not show stack trace button if there are no log stack trace', function () { | ||
$this->mockLogsWith([ | ||
new LogData([ | ||
'text' => 'Log message', | ||
'stack' => '', // No stack trace | ||
]), | ||
]); | ||
|
||
/** @var TestResponse */ | ||
$response = $this->see(); | ||
|
||
$response->assertDontSee('data-controller="modal-toggle"', false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests; | ||
|
||
use App\Models\User; | ||
use Czernika\OrchidLogViewer\Contracts\LogServiceContract; | ||
use Illuminate\Pagination\LengthAwarePaginator; | ||
use Illuminate\Testing\TestResponse; | ||
use Mockery\MockInterface; | ||
use Orchid\Support\Testing\ScreenTesting; | ||
use Plannr\Laravel\FastRefreshDatabase\Traits\FastRefreshDatabase; | ||
|
||
class TestFeatureCase extends TestCase | ||
{ | ||
use FastRefreshDatabase, ScreenTesting; | ||
|
||
public function see(): TestResponse | ||
{ | ||
return $this->screen('platform.logs') | ||
->actingAs(User::factory()->admin()->create()) | ||
->display(); | ||
} | ||
|
||
public function mockLogsWith(array $logs = [], string $file = 'laravel.log'): void | ||
{ | ||
$this->partialMock(LogServiceContract::class, function (MockInterface $mock) use ($logs, $file) { | ||
$mock->shouldReceive('logs')->once()->andReturn( | ||
new LengthAwarePaginator($logs, count($logs), 15), | ||
); | ||
|
||
$mock->shouldReceive('resolveSelectedFile')->once()->andReturn($file); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests; | ||
|
||
class TestUnitCase extends TestCase | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters