diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
index 8ebd26f9..1bd1079c 100644
--- a/.github/workflows/run-tests.yml
+++ b/.github/workflows/run-tests.yml
@@ -13,8 +13,8 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
- php: [8.2, 8.1, 8.0]
- laravel: [9.*, 10.*, 11.*, 12.*]
+ php: [8.4, 8.3, 8.2, 8.1, 8.0]
+ laravel: [9.*, 10.*, 11.*, 12.*, 13.*]
stability: [prefer-lowest, prefer-stable]
exclude:
- php: 8.0
@@ -23,11 +23,21 @@ jobs:
laravel: 11.*
- php: 8.0
laravel: 12.*
+ - php: 8.0
+ laravel: 13.*
- php: 8.1
laravel: 11.*
- php: 8.1
laravel: 12.*
+ - php: 8.1
+ laravel: 13.*
+ - php: 8.2
+ laravel: 9.*
- php: 8.2
+ laravel: 13.*
+ - php: 8.3
+ laravel: 9.*
+ - php: 8.4
laravel: 9.*
include:
- laravel: 9.*
@@ -46,6 +56,10 @@ jobs:
testbench: 10.*
pest: 3.*
collision: 8.*
+ - laravel: 13.*
+ testbench: 11.*
+ pest: 4.*
+ collision: 8.*
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
@@ -71,4 +85,4 @@ jobs:
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
- run: vendor/bin/pest
+ run: vendor/bin/pest --no-coverage
diff --git a/composer.json b/composer.json
index 07b72f98..4fdce121 100644
--- a/composer.json
+++ b/composer.json
@@ -20,7 +20,7 @@
],
"require": {
"php": "^8.0",
- "illuminate/contracts": "^8.0|^9.0|^10.0|^11.0|^12.0",
+ "illuminate/contracts": "^8.0|^9.0|^10.0|^11.0|^12.0|^13.0",
"opcodesio/mail-parser": "^0.2.3"
},
"require-dev": {
@@ -28,9 +28,9 @@
"itsgoingd/clockwork": "^5.1",
"laravel/pint": "^1.0",
"nunomaduro/collision": "^7.0|^8.0",
- "orchestra/testbench": "^7.6|^8.0|^9.5|^10.0",
- "pestphp/pest": "^2.0|^3.7",
- "pestphp/pest-plugin-laravel": "^2.0|^3.1",
+ "orchestra/testbench": "^7.6|^8.0|^9.5|^10.0|^11.0",
+ "pestphp/pest": "^2.0|^3.7|^4.4",
+ "pestphp/pest-plugin-laravel": "^2.0|^3.1|^4.1",
"spatie/test-time": "^1.3"
},
"suggest": {
diff --git a/config/log-viewer.php b/config/log-viewer.php
index 5c9179b9..9dd73205 100644
--- a/config/log-viewer.php
+++ b/config/log-viewer.php
@@ -3,6 +3,8 @@
use Opcodes\LogViewer\Enums\SortingMethod;
use Opcodes\LogViewer\Enums\SortingOrder;
use Opcodes\LogViewer\Enums\Theme;
+use Opcodes\LogViewer\Http\Middleware\AuthorizeLogViewer;
+use Opcodes\LogViewer\Http\Middleware\EnsureFrontendRequestsAreStateful;
return [
@@ -102,7 +104,7 @@
'middleware' => [
'web',
- \Opcodes\LogViewer\Http\Middleware\AuthorizeLogViewer::class,
+ AuthorizeLogViewer::class,
],
/*
@@ -115,8 +117,8 @@
*/
'api_middleware' => [
- \Opcodes\LogViewer\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
- \Opcodes\LogViewer\Http\Middleware\AuthorizeLogViewer::class,
+ EnsureFrontendRequestsAreStateful::class,
+ AuthorizeLogViewer::class,
],
'api_stateful_domains' => env('LOG_VIEWER_API_STATEFUL_DOMAINS') ? explode(',', env('LOG_VIEWER_API_STATEFUL_DOMAINS')) : null,
diff --git a/src/Facades/Cache.php b/src/Facades/Cache.php
index 417bba7b..6b2f3513 100644
--- a/src/Facades/Cache.php
+++ b/src/Facades/Cache.php
@@ -2,12 +2,13 @@
namespace Opcodes\LogViewer\Facades;
+use Illuminate\Cache\Repository;
use Illuminate\Support\Facades\Facade;
/**
* @mixin \Illuminate\Contracts\Cache\Repository
*
- * @see \Illuminate\Cache\Repository
+ * @see Repository
*/
class Cache extends Facade
{
diff --git a/src/Facades/LogViewer.php b/src/Facades/LogViewer.php
index 9b9a3478..118b388d 100644
--- a/src/Facades/LogViewer.php
+++ b/src/Facades/LogViewer.php
@@ -10,10 +10,11 @@
use Opcodes\LogViewer\LogFileCollection;
use Opcodes\LogViewer\LogFolder;
use Opcodes\LogViewer\LogFolderCollection;
+use Opcodes\LogViewer\LogViewerService;
use Opcodes\LogViewer\Readers\LogReaderInterface;
/**
- * @see \Opcodes\LogViewer\LogViewerService
+ * @see LogViewerService
*
* @method static string version()
* @method static string timezone()
diff --git a/src/Http/Middleware/EnsureFrontendRequestsAreStateful.php b/src/Http/Middleware/EnsureFrontendRequestsAreStateful.php
index 50f6723f..460a7ee9 100644
--- a/src/Http/Middleware/EnsureFrontendRequestsAreStateful.php
+++ b/src/Http/Middleware/EnsureFrontendRequestsAreStateful.php
@@ -2,7 +2,13 @@
namespace Opcodes\LogViewer\Http\Middleware;
+use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
+use Illuminate\Cookie\Middleware\EncryptCookies;
+use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
+use Illuminate\Http\Request;
+use Illuminate\Http\Response;
use Illuminate\Routing\Pipeline;
+use Illuminate\Session\Middleware\StartSession;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
@@ -16,9 +22,9 @@ class EnsureFrontendRequestsAreStateful
/**
* Handle the incoming requests.
*
- * @param \Illuminate\Http\Request $request
+ * @param Request $request
* @param callable $next
- * @return \Illuminate\Http\Response
+ * @return Response
*/
public function handle($request, $next)
{
@@ -30,10 +36,10 @@ function ($request, $next) {
return $next($request);
},
- static::resolveMiddleware('sanctum.middleware.encrypt_cookies', \Illuminate\Cookie\Middleware\EncryptCookies::class),
- \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
- \Illuminate\Session\Middleware\StartSession::class,
- static::resolveMiddleware('sanctum.middleware.verify_csrf_token', \Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class),
+ static::resolveMiddleware('sanctum.middleware.encrypt_cookies', EncryptCookies::class),
+ AddQueuedCookiesToResponse::class,
+ StartSession::class,
+ static::resolveMiddleware('sanctum.middleware.verify_csrf_token', VerifyCsrfToken::class),
] : [])->then(function ($request) use ($next) {
return $next($request);
});
@@ -55,7 +61,7 @@ protected function configureSecureCookieSessions()
/**
* Determine if the given request is from the first-party application frontend.
*
- * @param \Illuminate\Http\Request $request
+ * @param Request $request
* @return bool
*/
public static function fromFrontend($request)
@@ -91,7 +97,7 @@ public static function fromFrontend($request)
/**
* Check if the referer/origin domain matches the current request's domain.
*
- * @param \Illuminate\Http\Request $request
+ * @param Request $request
* @param string $refererDomain
* @return bool
*/
diff --git a/src/Http/Resources/LogResource.php b/src/Http/Resources/LogResource.php
index 2661df9c..71c14d2b 100644
--- a/src/Http/Resources/LogResource.php
+++ b/src/Http/Resources/LogResource.php
@@ -3,9 +3,10 @@
namespace Opcodes\LogViewer\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
+use Opcodes\LogViewer\Logs\Log;
/**
- * @mixin \Opcodes\LogViewer\Logs\Log
+ * @mixin Log
*/
class LogResource extends JsonResource
{
diff --git a/src/LogViewerService.php b/src/LogViewerService.php
index 5ff6c412..bd320953 100755
--- a/src/LogViewerService.php
+++ b/src/LogViewerService.php
@@ -3,6 +3,7 @@
namespace Opcodes\LogViewer;
use Composer\InstalledVersions;
+use GuzzleHttp\Client;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\File;
@@ -202,7 +203,7 @@ public function getFolder(?string $folderIdentifier): ?LogFolder
public function supportsHostsFeature(): bool
{
- return class_exists(\GuzzleHttp\Client::class);
+ return class_exists(Client::class);
}
public function resolveHostsUsing(callable $callback): void
diff --git a/src/Logs/Log.php b/src/Logs/Log.php
index 684c195c..b4092f70 100644
--- a/src/Logs/Log.php
+++ b/src/Logs/Log.php
@@ -28,7 +28,7 @@ class Log
/** @var string The regular expression group key, which contains the message */
public static string $regexMessageKey = 'message';
- /** @var array|\string[][] The columns displayed on the frontend, and which data they should display */
+ /** @var array|string[][] The columns displayed on the frontend, and which data they should display */
public static array $columns = [
['label' => 'Datetime', 'data_path' => 'datetime'],
['label' => 'Severity', 'data_path' => 'level'],
diff --git a/tests/Feature/Authorization/CanViewLogViewerTest.php b/tests/Feature/Authorization/CanViewLogViewerTest.php
index 27f7d064..aa678108 100644
--- a/tests/Feature/Authorization/CanViewLogViewerTest.php
+++ b/tests/Feature/Authorization/CanViewLogViewerTest.php
@@ -1,7 +1,9 @@
toBeInstanceOf(\Illuminate\Http\Request::class);
+ expect($request)->toBeInstanceOf(Request::class);
return true;
});
@@ -61,7 +63,7 @@
app()->detectEnvironment(fn () => 'production');
expect(app()->isProduction())->toBeTrue();
// need to reload the routes in order for the new middleware to take place.
- (new \Opcodes\LogViewer\LogViewerServiceProvider(app()))->boot();
+ (new LogViewerServiceProvider(app()))->boot();
get(route('log-viewer.index'))->assertOk();
});
diff --git a/tests/Feature/ForwardRequestToHostTest.php b/tests/Feature/ForwardRequestToHostTest.php
index bf1c8be0..46439f5b 100644
--- a/tests/Feature/ForwardRequestToHostTest.php
+++ b/tests/Feature/ForwardRequestToHostTest.php
@@ -1,8 +1,10 @@
[
@@ -14,7 +16,7 @@
$this->remoteHost = LogViewer::getHosts()->remote()->first();
});
-function expectedNewUrl($originalUrl, Opcodes\LogViewer\Host $host): string
+function expectedNewUrl($originalUrl, Host $host): string
{
$newUrl = Str::replaceFirst(
route('log-viewer.index'), // http://localhost/log-viewer
@@ -47,7 +49,7 @@ function expectedNewUrl($originalUrl, Opcodes\LogViewer\Host $host): string
->assertOk()
->assertJson($proxiedResponseBody);
- Http::assertSent(function (Illuminate\Http\Client\Request $request) use ($newUrl, $method) {
+ Http::assertSent(function (Request $request) use ($newUrl, $method) {
return $request->url() === expectedNewUrl($newUrl, $this->remoteHost)
&& $request->method() === strtoupper($method)
&& collect($this->remoteHost->headers)->every(fn ($value, $key) => $request->hasHeader($key, $value));
diff --git a/tests/Feature/LogsControllerTest.php b/tests/Feature/LogsControllerTest.php
index cd7f23a3..97652118 100644
--- a/tests/Feature/LogsControllerTest.php
+++ b/tests/Feature/LogsControllerTest.php
@@ -1,5 +1,7 @@
json('logs'))->toHaveCount(count($logEntries));
// now, with the query. Re-instantiate the log reader to make sure we don't have anything cached.
- \Opcodes\LogViewer\Readers\IndexedLogReader::clearInstance($file);
+ IndexedLogReader::clearInstance($file);
$response = getJson(route('log-viewer.logs', [
'file' => $file->identifier,
'query' => 'error',
@@ -54,7 +56,7 @@
expect($response->json('logs'))->toHaveCount(count($logEntries));
// now, with the query. Re-instantiate the log reader to make sure we don't have anything cached.
- \Opcodes\LogViewer\Readers\IndexedLogReader::clearInstance($file);
+ IndexedLogReader::clearInstance($file);
$response = getJson(route('log-viewer.logs', [
'file' => $file->identifier,
'query' => 'ошибка',
diff --git a/tests/Feature/RoutesTest.php b/tests/Feature/RoutesTest.php
index a8eb10cb..44ed1ed3 100644
--- a/tests/Feature/RoutesTest.php
+++ b/tests/Feature/RoutesTest.php
@@ -1,5 +1,8 @@
setRoutes(new \Illuminate\Routing\RouteCollection);
+ app('router')->setRoutes(new RouteCollection);
// boot the service provider to register the routes again
- (new \Opcodes\LogViewer\LogViewerServiceProvider(app()))->boot();
+ (new LogViewerServiceProvider(app()))->boot();
}
diff --git a/tests/Pest.php b/tests/Pest.php
index 3664fe4d..39fcbd52 100644
--- a/tests/Pest.php
+++ b/tests/Pest.php
@@ -3,6 +3,8 @@
use Carbon\CarbonInterface;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\File;
+use Illuminate\Support\Str;
+use Opcodes\LogViewer\Facades\LogViewer;
use Opcodes\LogViewer\LogFile;
use Opcodes\LogViewer\LogIndex;
use Opcodes\LogViewer\Logs\LogType;
@@ -36,7 +38,7 @@ function generateLogFiles(array $files, ?string $content = null, bool $randomCon
function generateLogFile(?string $fileName = null, ?string $content = null, bool $randomContent = false, $type = LogType::LARAVEL): LogFile
{
if (is_null($fileName)) {
- $fileName = \Illuminate\Support\Str::random().'.log';
+ $fileName = Str::random().'.log';
}
$fileName = str_replace('/', DIRECTORY_SEPARATOR, $fileName);
@@ -79,7 +81,7 @@ function dummyLogData(?int $lines = null, string $type = LogType::LARAVEL): stri
function clearGeneratedLogFiles(): void
{
- $logReaderClass = \Opcodes\LogViewer\Facades\LogViewer::logReaderClass();
+ $logReaderClass = LogViewer::logReaderClass();
$logReaderClass::clearInstances();
File::cleanDirectory(storage_path('logs'));
diff --git a/tests/Unit/AccessLogs/HttpNginxErrorLogTest.php b/tests/Unit/AccessLogs/HttpNginxErrorLogTest.php
index da1e1f53..3e19cc3f 100644
--- a/tests/Unit/AccessLogs/HttpNginxErrorLogTest.php
+++ b/tests/Unit/AccessLogs/HttpNginxErrorLogTest.php
@@ -1,5 +1,6 @@
logs()->scan();
$logs = $file->logs()->get();
diff --git a/tests/Unit/AccessLogs/LogReaderTest.php b/tests/Unit/AccessLogs/LogReaderTest.php
index 9dad308e..0e055c03 100644
--- a/tests/Unit/AccessLogs/LogReaderTest.php
+++ b/tests/Unit/AccessLogs/LogReaderTest.php
@@ -1,19 +1,25 @@
logs()->scan();
$logs = $file->logs()->get();
expect($logs)->toHaveCount(10);
- /** @var \Opcodes\LogViewer\Logs\HttpAccessLog $firstLog */
+ /** @var HttpAccessLog $firstLog */
$firstLog = $logs[0];
// 205.123.147.41 - - [18/Jan/2023:05:21:57 +0000] "GET /tag HTTP/1.1" 500 2519 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
expect($firstLog->index)->toBe(0)
- ->and($firstLog)->toBeInstanceOf(\Opcodes\LogViewer\Logs\HttpAccessLog::class)
+ ->and($firstLog)->toBeInstanceOf(HttpAccessLog::class)
->and($firstLog->context['ip'])->toBe('205.123.147.41')
->and($firstLog->datetime->toDateTimeString())->toBe('2023-01-18 05:21:57')
->and($firstLog->context['status_code'])->toBe(500)
@@ -27,19 +33,19 @@
});
it('can read nginx error logs with the default LogReader', function () {
- $file = new Opcodes\LogViewer\LogFile(__DIR__.'/Fixtures/errors_nginx_dummy.log');
+ $file = new LogFile(__DIR__.'/Fixtures/errors_nginx_dummy.log');
$file->logs()->scan();
$logs = $file->logs()->get();
expect($logs)->toHaveCount(9);
- /** @var \Opcodes\LogViewer\Logs\HttpNginxErrorLog $firstLog */
+ /** @var HttpNginxErrorLog $firstLog */
$firstLog = $logs[0];
// 2023/01/04 11:18:33 [alert] 95160#0: *1473 setsockopt(TCP_NODELAY) failed (22: Invalid argument) while keepalive, client: 127.0.0.1, server: 127.0.0.1:80
expect($firstLog->index)->toBe(0)
- ->and($firstLog)->toBeInstanceOf(\Opcodes\LogViewer\Logs\HttpNginxErrorLog::class)
+ ->and($firstLog)->toBeInstanceOf(HttpNginxErrorLog::class)
->and($firstLog->datetime->toDateTimeString())->toBe('2023-01-04 11:18:33')
->and($firstLog->level)->toBe('alert')
->and($firstLog->message)->toBe('*1473 setsockopt(TCP_NODELAY) failed (22: Invalid argument) while keepalive')
@@ -48,19 +54,19 @@
});
it('can read apache error logs with the default LogReader', function () {
- $file = new Opcodes\LogViewer\LogFile(__DIR__.'/Fixtures/errors_dummy.log');
+ $file = new LogFile(__DIR__.'/Fixtures/errors_dummy.log');
$file->logs()->scan();
$logs = $file->logs()->get();
expect($logs)->toHaveCount(40);
- /** @var \Opcodes\LogViewer\Logs\HttpApacheErrorLog $firstLog */
+ /** @var HttpApacheErrorLog $firstLog */
$firstLog = $logs[0];
// [Sun Jul 09 06:10:51.190799 2023] [ssl:error] [pid 44570] AH02032: Hostname test.example.com provided via SNI and hostname system.test provided via HTTP are different
expect($firstLog->index)->toBe(0)
- ->and($firstLog)->toBeInstanceOf(\Opcodes\LogViewer\Logs\HttpApacheErrorLog::class)
+ ->and($firstLog)->toBeInstanceOf(HttpApacheErrorLog::class)
->and($firstLog->datetime->toDateTimeString())->toBe('2023-07-09 06:10:51')
->and($firstLog->context['pid'])->toBe(44570)
->and($firstLog->context['module'])->toBe('ssl')
@@ -69,13 +75,13 @@
});
it('can get access log level counts', function () {
- $file = new \Opcodes\LogViewer\LogFile(__DIR__.'/Fixtures/access_dummy.log');
+ $file = new LogFile(__DIR__.'/Fixtures/access_dummy.log');
$file->logs()->scan();
$levels = $file->logs()->getLevelCounts();
expect($levels['500']->count)->toBe(3)
- ->and($levels['500']->level)->toBeInstanceOf(\Opcodes\LogViewer\LogLevels\HttpStatusCodeLevel::class)
+ ->and($levels['500']->level)->toBeInstanceOf(HttpStatusCodeLevel::class)
->and($levels['200']->count)->toBe(4)
->and($levels['404']->count)->toBe(3);
});
diff --git a/tests/Unit/AssetsAreCurrentTest.php b/tests/Unit/AssetsAreCurrentTest.php
index 94589b65..e94c308b 100644
--- a/tests/Unit/AssetsAreCurrentTest.php
+++ b/tests/Unit/AssetsAreCurrentTest.php
@@ -1,6 +1,7 @@
toBeInstanceOf(\Illuminate\Support\HtmlString::class);
+ expect($result)->toBeInstanceOf(HtmlString::class);
expect((string) $result)->toStartWith('');
expect(strlen((string) $result))->toBeGreaterThan(100);
@@ -106,7 +107,7 @@
test('js() returns an HtmlString containing a script tag', function () {
$result = LogViewer::js();
- expect($result)->toBeInstanceOf(\Illuminate\Support\HtmlString::class);
+ expect($result)->toBeInstanceOf(HtmlString::class);
expect((string) $result)->toStartWith('');
expect(strlen((string) $result))->toBeGreaterThan(100);
@@ -115,7 +116,7 @@
test('favicon() returns an HtmlString containing a base64 data URI', function () {
$result = LogViewer::favicon();
- expect($result)->toBeInstanceOf(\Illuminate\Support\HtmlString::class);
+ expect($result)->toBeInstanceOf(HtmlString::class);
expect((string) $result)->toContain('data:image/png;base64,');
expect((string) $result)->toStartWith('toEndWith('">');
diff --git a/tests/Unit/CustomLogs/ExtendableLogReaderTest.php b/tests/Unit/CustomLogs/ExtendableLogReaderTest.php
index 1200b158..97412ef5 100644
--- a/tests/Unit/CustomLogs/ExtendableLogReaderTest.php
+++ b/tests/Unit/CustomLogs/ExtendableLogReaderTest.php
@@ -1,6 +1,7 @@
throws(InvalidArgumentException::class);
it('overrides an existing class with the same type', function () {
- expect($this->logRegistrar->getClass(LogType::LARAVEL))->toBe(\Opcodes\LogViewer\Logs\LaravelLog::class);
+ expect($this->logRegistrar->getClass(LogType::LARAVEL))->toBe(LaravelLog::class);
LogViewer::extend('laravel', CustomAccessLog::class);
diff --git a/tests/Unit/LogFolderCollectionTest.php b/tests/Unit/LogFolderCollectionTest.php
index 9f1d91b9..3ee2e2bf 100644
--- a/tests/Unit/LogFolderCollectionTest.php
+++ b/tests/Unit/LogFolderCollectionTest.php
@@ -21,7 +21,7 @@
$logFileCollection = new LogFileCollection([
$debugFile1 = new LogFile($debugFolder.'/debug1.log'),
$infoFile1 = new LogFile($infoFolder.'/info1.log'),
- $debugFile2 = new Logfile($debugFolder.'/debug2.log'),
+ $debugFile2 = new LogFile($debugFolder.'/debug2.log'),
$infoFile2 = new LogFile($infoFolder.'/info2.log'),
]);
diff --git a/tests/Unit/LogIndex/SkippingIndexResultsTest.php b/tests/Unit/LogIndex/SkippingIndexResultsTest.php
index db0af9e4..998ca2d7 100644
--- a/tests/Unit/LogIndex/SkippingIndexResultsTest.php
+++ b/tests/Unit/LogIndex/SkippingIndexResultsTest.php
@@ -1,6 +1,7 @@
subHour()->timestamp;
@@ -64,7 +65,7 @@
test('get() skips unnecessary chunks by not loading them into memory', function () {
$timestamp = now()->subHour()->timestamp;
$logIndex = Mockery::mock('Opcodes\LogViewer\LogIndex[getChunk]', [
- new \Opcodes\LogViewer\LogFile('laravel.log', 'laravel.log'),
+ new LogFile('laravel.log', 'laravel.log'),
])->makePartial();
$logIndex->setMaxChunkSize(2);
$idx1 = $logIndex->addToIndex($pos1 = 0, $timestamp, 'info');
@@ -94,7 +95,7 @@
test('getFlatIndex() skips unnecessary chunks by not loading them into memory', function () {
$timestamp = now()->subHour()->timestamp;
$logIndex = Mockery::mock('Opcodes\LogViewer\LogIndex[getChunk]', [
- new \Opcodes\LogViewer\LogFile('laravel.log', 'laravel.log'),
+ new LogFile('laravel.log', 'laravel.log'),
])->makePartial();
$logIndex->setMaxChunkSize(2);
$idx1 = $logIndex->addToIndex($pos1 = 0, $timestamp, 'info');
diff --git a/tests/Unit/LogReaderTest.php b/tests/Unit/LogReaderTest.php
index f0b4fdb7..82d4e19f 100644
--- a/tests/Unit/LogReaderTest.php
+++ b/tests/Unit/LogReaderTest.php
@@ -3,6 +3,7 @@
use Illuminate\Support\Facades\File;
use Opcodes\LogViewer\Exceptions\CannotOpenFileException;
use Opcodes\LogViewer\Readers\IndexedLogReader;
+use Spatie\TestTime\TestTime;
beforeEach(function () {
$this->file = generateLogFile();
@@ -25,7 +26,7 @@
$logReader = $this->file->logs();
$logReader->scan();
- \Spatie\TestTime\TestTime::addMinute();
+ TestTime::addMinute();
File::append($this->file->path, PHP_EOL.makeLaravelLogEntry());
diff --git a/tests/Unit/LogTest.php b/tests/Unit/LogTest.php
index ef69a2ce..47ab6a0b 100644
--- a/tests/Unit/LogTest.php
+++ b/tests/Unit/LogTest.php
@@ -1,5 +1,6 @@
datetime->timezoneName);
- $expectedTime = \Carbon\Carbon::parse('2022-11-07 17:51:33', 'UTC')->setTimezone($tz)->toDateTimeString();
+ $expectedTime = Carbon::parse('2022-11-07 17:51:33', 'UTC')->setTimezone($tz)->toDateTimeString();
assertEquals($expectedTime, $log->datetime->toDateTimeString());
});
diff --git a/tests/Unit/LogViewerCacheTest.php b/tests/Unit/LogViewerCacheTest.php
index c33791d6..663b5609 100644
--- a/tests/Unit/LogViewerCacheTest.php
+++ b/tests/Unit/LogViewerCacheTest.php
@@ -2,6 +2,7 @@
use Illuminate\Cache\FileStore;
use Illuminate\Cache\RedisStore;
+use Opcodes\LogViewer\Facades\Cache;
beforeEach(function () {
config(['log-viewer.cache_driver' => null]);
@@ -10,7 +11,7 @@
it('it defaults to the app\'s default cache driver', function ($cacheType, $cacheStoreClass) {
config(['cache.default' => $cacheType]);
- expect(\Opcodes\LogViewer\Facades\Cache::getStore())
+ expect(Cache::getStore())
->toBeInstanceOf($cacheStoreClass);
})->with([
['file', FileStore::class],
@@ -21,6 +22,6 @@
config(['cache.default' => 'redis']);
config(['log-viewer.cache_driver' => 'file']);
- expect(\Opcodes\LogViewer\Facades\Cache::getStore())
+ expect(Cache::getStore())
->toBeInstanceOf(FileStore::class);
});
diff --git a/tests/Unit/MultipleLogReaderTest.php b/tests/Unit/MultipleLogReaderTest.php
index dfe8fae1..fde810d6 100644
--- a/tests/Unit/MultipleLogReaderTest.php
+++ b/tests/Unit/MultipleLogReaderTest.php
@@ -22,7 +22,7 @@
$filesFound->logs()->scan();
$this->assertTrue(true);
- } catch (\Exception $exception) {
+ } catch (Exception $exception) {
$this->fail('Exception thrown: '.$exception->getMessage());
}
});