From 3cb039a166d644894def0776d4fb94d8b920e2dc Mon Sep 17 00:00:00 2001 From: ARCANEDEV Date: Wed, 27 Feb 2019 20:05:04 +0100 Subject: [PATCH] Update to support laravel 5.8 (#259) --- LICENSE.md | 2 +- README.md | 2 +- _docs/0.Home.md | 2 +- _docs/1.Installation-and-Setup.md | 3 +++ composer.json | 8 +++---- tests/Commands/ClearCommandTest.php | 7 ++---- tests/Commands/PublishCommandTest.php | 9 +------ tests/Entities/LogCollectionTest.php | 24 ++++++++----------- tests/Entities/LogEntryCollectionTest.php | 4 ++-- tests/Entities/LogEntryTest.php | 4 ++-- tests/Entities/LogTest.php | 4 ++-- tests/LogViewerServiceProviderTest.php | 4 ++-- tests/LogViewerTest.php | 4 ++-- .../Providers/CommandsServiceProviderTest.php | 4 ++-- .../UtilitiesServiceProviderTest.php | 4 ++-- tests/RoutesTest.php | 8 +++---- tests/Tables/StatsTableTest.php | 4 ++-- tests/TestCase.php | 4 ++-- tests/Utilities/FactoryTest.php | 12 ++++------ tests/Utilities/FilesystemTest.php | 20 +++++++--------- tests/Utilities/LogCheckerTest.php | 4 ++-- tests/Utilities/LogLevelsTest.php | 4 ++-- tests/Utilities/LogMenuTest.php | 4 ++-- tests/Utilities/LogStylerTest.php | 4 ++-- 24 files changed, 66 insertions(+), 83 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index c3c5127d..fedbfbdf 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015-2017 ARCANEDEV - LogViewer +Copyright (c) 2015-2019 ARCANEDEV - LogViewer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 2cfc37d0..1ec4c932 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Feel free to check out the [releases](https://github.com/ARCANEDEV/LogViewer/rel ## Features - A great Log viewer API. - - Laravel `5.0` to `5.7` are supported. + - Laravel `5.0` to `5.8` are supported. - Ready to use (Views, Routes, controllers … Out of the box) [Note: No need to publish assets] - View, paginate, filter, download and delete logs. - Load a custom logs storage path. diff --git a/_docs/0.Home.md b/_docs/0.Home.md index d106288b..f964661e 100644 --- a/_docs/0.Home.md +++ b/_docs/0.Home.md @@ -5,7 +5,7 @@ This package allows you to keep track of each one of your logs stored under `sto ## Features - A great Log viewer API. - - Laravel `5.0` to `5.7` are supported. + - Laravel `5.0` to `5.8` are supported. - Ready to use (Views, Routes, controllers … Out of the box) [Note: No need to publish assets] - View, paginate, filter, download and delete logs. - Load a custom logs storage path. diff --git a/_docs/1.Installation-and-Setup.md b/_docs/1.Installation-and-Setup.md index 6e21955e..46662554 100644 --- a/_docs/1.Installation-and-Setup.md +++ b/_docs/1.Installation-and-Setup.md @@ -28,6 +28,7 @@ Laravel uses the [Monolog PHP logging library](https://github.com/Seldaek/monolo | ![LogViewer v4.4.x][log_viewer_4_4_x] | ![Laravel v5.5][laravel_5_5] | | ![LogViewer v4.5.x][log_viewer_4_5_x] | ![Laravel v5.6][laravel_5_6] | | ![LogViewer v4.6.x][log_viewer_4_6_x] | ![Laravel v5.7][laravel_5_7] | +| ![LogViewer v4.7.x][log_viewer_4_7_x] | ![Laravel v5.8][laravel_5_8] | [laravel_5_0]: https://img.shields.io/badge/v5.0-supported-brightgreen.svg?style=flat-square "Laravel v5.0" [laravel_5_1]: https://img.shields.io/badge/v5.1-supported-brightgreen.svg?style=flat-square "Laravel v5.1" @@ -37,12 +38,14 @@ Laravel uses the [Monolog PHP logging library](https://github.com/Seldaek/monolo [laravel_5_5]: https://img.shields.io/badge/v5.5-supported-brightgreen.svg?style=flat-square "Laravel v5.5" [laravel_5_6]: https://img.shields.io/badge/v5.6-supported-brightgreen.svg?style=flat-square "Laravel v5.6" [laravel_5_7]: https://img.shields.io/badge/v5.7-supported-brightgreen.svg?style=flat-square "Laravel v5.7" +[laravel_5_8]: https://img.shields.io/badge/v5.8-supported-brightgreen.svg?style=flat-square "Laravel v5.8" [log_viewer_4_2_x]: https://img.shields.io/badge/version-4.2.*-blue.svg?style=flat-square "LogViewer v4.2.*" [log_viewer_4_3_x]: https://img.shields.io/badge/version-4.3.*-blue.svg?style=flat-square "LogViewer v4.3.*" [log_viewer_4_4_x]: https://img.shields.io/badge/version-4.4.*-blue.svg?style=flat-square "LogViewer v4.4.*" [log_viewer_4_5_x]: https://img.shields.io/badge/version-4.5.*-blue.svg?style=flat-square "LogViewer v4.5.*" [log_viewer_4_6_x]: https://img.shields.io/badge/version-4.6.*-blue.svg?style=flat-square "LogViewer v4.6.*" +[log_viewer_4_7_x]: https://img.shields.io/badge/version-4.7.*-blue.svg?style=flat-square "LogViewer v4.7.*" ## Composer diff --git a/composer.json b/composer.json index 3ac54a4d..2bd488e4 100644 --- a/composer.json +++ b/composer.json @@ -16,13 +16,13 @@ "require": { "php": ">=7.1.3", "psr/log": "~1.0", - "arcanedev/support": "~4.4.0" + "arcanedev/support": "~4.5.0" }, "require-dev": { - "orchestra/testbench": "~3.7.0", + "orchestra/testbench": "~3.8.0", "mockery/mockery": "~1.0", - "phpunit/phpunit": "~7.0", - "phpunit/phpcov": "~5.0" + "phpunit/phpcov": "~5.0|~6.0", + "phpunit/phpunit": "~7.0|~8.0" }, "autoload": { "psr-4": { diff --git a/tests/Commands/ClearCommandTest.php b/tests/Commands/ClearCommandTest.php index 1fc95104..4f8fa706 100644 --- a/tests/Commands/ClearCommandTest.php +++ b/tests/Commands/ClearCommandTest.php @@ -1,9 +1,6 @@ setupForTests(); } - protected function tearDown() + protected function tearDown(): void { rmdir($this->path); unset($this->path); diff --git a/tests/Commands/PublishCommandTest.php b/tests/Commands/PublishCommandTest.php index 0a34f420..b41ef12b 100644 --- a/tests/Commands/PublishCommandTest.php +++ b/tests/Commands/PublishCommandTest.php @@ -15,14 +15,7 @@ class PublishCommandTest extends TestCase | ----------------------------------------------------------------- */ - protected function setUp() - { - parent::setUp(); - - // - } - - protected function tearDown() + protected function tearDown(): void { $this->deleteConfig(); $this->deleteLocalizations(); diff --git a/tests/Entities/LogCollectionTest.php b/tests/Entities/LogCollectionTest.php index 6cecf5ff..5f8ca295 100644 --- a/tests/Entities/LogCollectionTest.php +++ b/tests/Entities/LogCollectionTest.php @@ -24,14 +24,14 @@ class LogCollectionTest extends TestCase | ----------------------------------------------------------------- */ - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->logs = LogCollection::make(); } - protected function tearDown() + protected function tearDown(): void { unset($this->logs); @@ -166,25 +166,21 @@ public function it_can_get_log_menu() } } - /** - * @test - * - * @expectedException \Arcanedev\LogViewer\Exceptions\LogNotFoundException - * @expectedExceptionMessage Log not found in this date [2222-01-01] - */ + /** @test */ public function it_must_throw_a_log_not_found_on_get_method() { + $this->expectException(\Arcanedev\LogViewer\Exceptions\LogNotFoundException::class); + $this->expectExceptionMessage('Log not found in this date [2222-01-01]'); + $this->logs->get('2222-01-01'); } - /** - * @test - * - * @expectedException \Arcanedev\LogViewer\Exceptions\LogNotFoundException - * @expectedExceptionMessage Log not found in this date [2222-01-01] - */ + /** @test */ public function it_must_throw_a_log_not_found_on_log_method() { + $this->expectException(\Arcanedev\LogViewer\Exceptions\LogNotFoundException::class); + $this->expectExceptionMessage('Log not found in this date [2222-01-01]'); + $this->logs->log('2222-01-01'); } } diff --git a/tests/Entities/LogEntryCollectionTest.php b/tests/Entities/LogEntryCollectionTest.php index e17c5493..432dc46b 100644 --- a/tests/Entities/LogEntryCollectionTest.php +++ b/tests/Entities/LogEntryCollectionTest.php @@ -24,14 +24,14 @@ class LogEntryCollectionTest extends TestCase | ----------------------------------------------------------------- */ - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->entries = new LogEntryCollection; } - protected function tearDown() + protected function tearDown(): void { unset($this->entries); diff --git a/tests/Entities/LogEntryTest.php b/tests/Entities/LogEntryTest.php index e1c335e1..7546b4fe 100644 --- a/tests/Entities/LogEntryTest.php +++ b/tests/Entities/LogEntryTest.php @@ -24,14 +24,14 @@ class LogEntryTest extends TestCase | ----------------------------------------------------------------- */ - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->entry = $this->getRandomLogEntry('2015-01-01'); } - protected function tearDown() + protected function tearDown(): void { unset($this->entry); diff --git a/tests/Entities/LogTest.php b/tests/Entities/LogTest.php index e2661219..c1ebec13 100644 --- a/tests/Entities/LogTest.php +++ b/tests/Entities/LogTest.php @@ -24,14 +24,14 @@ class LogTest extends TestCase | ----------------------------------------------------------------- */ - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->log = $this->getLog('2015-01-01'); } - protected function tearDown() + protected function tearDown(): void { unset($this->log); diff --git a/tests/LogViewerServiceProviderTest.php b/tests/LogViewerServiceProviderTest.php index e67ba549..91f6b140 100644 --- a/tests/LogViewerServiceProviderTest.php +++ b/tests/LogViewerServiceProviderTest.php @@ -23,14 +23,14 @@ class LogViewerServiceProviderTest extends TestCase | ----------------------------------------------------------------- */ - public function setUp() + public function setUp(): void { parent::setUp(); $this->provider = $this->app->getProvider(LogViewerServiceProvider::class); } - public function tearDown() + public function tearDown(): void { unset($this->provider); diff --git a/tests/LogViewerTest.php b/tests/LogViewerTest.php index bf676356..f31a8c28 100644 --- a/tests/LogViewerTest.php +++ b/tests/LogViewerTest.php @@ -24,14 +24,14 @@ class LogViewerTest extends TestCase | ----------------------------------------------------------------- */ - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->logViewer = $this->app->make(\Arcanedev\LogViewer\Contracts\LogViewer::class); } - protected function tearDown() + protected function tearDown(): void { unset($this->logViewer); diff --git a/tests/Providers/CommandsServiceProviderTest.php b/tests/Providers/CommandsServiceProviderTest.php index 60464c50..56cae055 100644 --- a/tests/Providers/CommandsServiceProviderTest.php +++ b/tests/Providers/CommandsServiceProviderTest.php @@ -24,14 +24,14 @@ class CommandsServiceProviderTest extends TestCase | ----------------------------------------------------------------- */ - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->provider = $this->app->getProvider(CommandsServiceProvider::class); } - protected function tearDown() + protected function tearDown(): void { unset($this->provider); diff --git a/tests/Providers/UtilitiesServiceProviderTest.php b/tests/Providers/UtilitiesServiceProviderTest.php index 50212777..16c4fdd7 100644 --- a/tests/Providers/UtilitiesServiceProviderTest.php +++ b/tests/Providers/UtilitiesServiceProviderTest.php @@ -25,14 +25,14 @@ class UtilitiesServiceProviderTest extends TestCase | ----------------------------------------------------------------- */ - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->provider = $this->app->getProvider(UtilitiesServiceProvider::class); } - protected function tearDown() + protected function tearDown(): void { unset($this->provider); diff --git a/tests/RoutesTest.php b/tests/RoutesTest.php index 0293c4f8..d8a1f21c 100644 --- a/tests/RoutesTest.php +++ b/tests/RoutesTest.php @@ -21,7 +21,7 @@ public function it_can_see_dashboard_page() $response = $this->get(route('log-viewer::dashboard')); $response->assertSuccessful(); - static::assertContains( + static::assertStringContainsString( '

Dashboard

', $response->getContent() ); @@ -33,7 +33,7 @@ public function it_can_see_logs_page() $response = $this->get(route('log-viewer::logs.list')); $response->assertSuccessful(); - static::assertContains( + static::assertStringContainsString( '

Logs

', $response->getContent() ); @@ -48,7 +48,7 @@ public function it_can_show_a_log_page() $response = $this->get(route('log-viewer::logs.show', [$date])); $response->assertSuccessful(); - static::assertContains( + static::assertStringContainsString( "

Log [{$date}]

", $response->getContent() ); @@ -64,7 +64,7 @@ public function it_can_see_a_filtered_log_entries_page() $response = $this->get(route('log-viewer::logs.filter', [$date, $level])); $response->assertSuccessful(); - static::assertContains( + static::assertStringContainsString( "

Log [{$date}]

", $response->getContent() ); diff --git a/tests/Tables/StatsTableTest.php b/tests/Tables/StatsTableTest.php index 82841e88..ae754040 100644 --- a/tests/Tables/StatsTableTest.php +++ b/tests/Tables/StatsTableTest.php @@ -28,7 +28,7 @@ class StatsTableTest extends TestCase | ----------------------------------------------------------------- */ - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -38,7 +38,7 @@ protected function setUp() ); } - protected function tearDown() + protected function tearDown(): void { unset($this->table); diff --git a/tests/TestCase.php b/tests/TestCase.php index 62a9b7bd..17494214 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -36,14 +36,14 @@ abstract class TestCase extends BaseTestCase | ----------------------------------------------------------------- */ - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); static::$logLevels = self::getLogLevels(); } - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { parent::tearDownAfterClass(); diff --git a/tests/Utilities/FactoryTest.php b/tests/Utilities/FactoryTest.php index 7af0313e..458cd875 100644 --- a/tests/Utilities/FactoryTest.php +++ b/tests/Utilities/FactoryTest.php @@ -24,14 +24,14 @@ class FactoryTest extends TestCase | ----------------------------------------------------------------- */ - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->logFactory = $this->app->make(\Arcanedev\LogViewer\Contracts\Utilities\Factory::class); } - protected function tearDown() + protected function tearDown(): void { unset($this->logFactory); @@ -225,13 +225,11 @@ public function it_can_check_is_not_empty() static::assertFalse($this->logFactory->isEmpty()); } - /** - * @test - * - * @expectedException \Arcanedev\LogViewer\Exceptions\LogNotFoundException - */ + /** @test */ public function it_must_throw_a_filesystem_exception() { + $this->expectException(\Arcanedev\LogViewer\Exceptions\LogNotFoundException::class); + $this->logFactory->get('2222-11-11'); // Future FTW } diff --git a/tests/Utilities/FilesystemTest.php b/tests/Utilities/FilesystemTest.php index 849123fe..9020ff8f 100644 --- a/tests/Utilities/FilesystemTest.php +++ b/tests/Utilities/FilesystemTest.php @@ -24,14 +24,14 @@ class FilesystemTest extends TestCase | ----------------------------------------------------------------- */ - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->filesystem = $this->filesystem(); } - protected function tearDown() + protected function tearDown(): void { unset($this->filesystem); @@ -170,23 +170,19 @@ public function it_can_get_dates_with_paths_from_log_files() } } - /** - * @test - * - * @expectedException \Arcanedev\LogViewer\Exceptions\FilesystemException - */ + /** @test */ public function it_must_throw_a_filesystem_exception_on_read() { + $this->expectException(\Arcanedev\LogViewer\Exceptions\FilesystemException::class); + $this->filesystem->read('2222-11-11'); // Future FTW } - /** - * @test - * - * @expectedException \Arcanedev\LogViewer\Exceptions\FilesystemException - */ + /** @test */ public function it_must_throw_a_filesystem_exception_on_delete() { + $this->expectException(\Arcanedev\LogViewer\Exceptions\FilesystemException::class); + $this->filesystem->delete('2222-11-11'); // Future FTW } diff --git a/tests/Utilities/LogCheckerTest.php b/tests/Utilities/LogCheckerTest.php index 426491f2..4e2ebbf6 100644 --- a/tests/Utilities/LogCheckerTest.php +++ b/tests/Utilities/LogCheckerTest.php @@ -24,14 +24,14 @@ class LogCheckerTest extends TestCase | ----------------------------------------------------------------- */ - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->checker = $this->app->make(\Arcanedev\LogViewer\Contracts\Utilities\LogChecker::class); } - protected function tearDown() + protected function tearDown(): void { unset($this->checker); diff --git a/tests/Utilities/LogLevelsTest.php b/tests/Utilities/LogLevelsTest.php index bc717ed2..826bf329 100644 --- a/tests/Utilities/LogLevelsTest.php +++ b/tests/Utilities/LogLevelsTest.php @@ -24,14 +24,14 @@ class LogLevelsTest extends TestCase | ----------------------------------------------------------------- */ - public function setUp() + public function setUp(): void { parent::setUp(); $this->levels = $this->app->make(\Arcanedev\LogViewer\Contracts\Utilities\LogLevels::class); } - public function tearDown() + public function tearDown(): void { unset($this->levels); diff --git a/tests/Utilities/LogMenuTest.php b/tests/Utilities/LogMenuTest.php index 00137569..5c80510c 100644 --- a/tests/Utilities/LogMenuTest.php +++ b/tests/Utilities/LogMenuTest.php @@ -24,14 +24,14 @@ class LogMenuTest extends TestCase | ----------------------------------------------------------------- */ - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->menu = $this->app->make(\Arcanedev\LogViewer\Contracts\Utilities\LogMenu::class); } - protected function tearDown() + protected function tearDown(): void { unset($this->menu); diff --git a/tests/Utilities/LogStylerTest.php b/tests/Utilities/LogStylerTest.php index 2b4f172f..ae46a148 100644 --- a/tests/Utilities/LogStylerTest.php +++ b/tests/Utilities/LogStylerTest.php @@ -24,14 +24,14 @@ class LogStylerTest extends TestCase | ----------------------------------------------------------------- */ - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->styler = $this->app->make(\Arcanedev\LogViewer\Contracts\Utilities\LogStyler::class); } - protected function tearDown() + protected function tearDown(): void { unset($this->styler);