frankperez87 / laravel-log-fake
Enables you to test the Laravel Logger.
0.2.2
2022-07-22 04:02 UTC
Requires
- php: ^8.0|^8.1
- psr/log: ^2.0
- spatie/laravel-package-tools: ^1.9.2
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^5.0|^6.0
- nunomaduro/larastan: ^1.0|^2.0.1
- orchestra/testbench: ^6.0|^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-12-09 21:16:06 UTC
README
This package allows you to easily test the Laravel Log functionality.
Supported Versions
We currently support the following Laravel versions.
Installation
You can install the package via composer:
composer require frankperez87/laravel-log-fake
Usage
use frankperez87\LaravelLogFake\Facades\Log; Log::fake(); logger()->withContext([ 'yay' => 'it works', ]); logger()->info('this is a info log'); # You can use the helpers via the Facade Log::assertContext(function ($context) { return $context == ['yay' => 'it works']; }); Log::assertLogged(function ($log) { return $log['level'] == 'emergency' && $log['message'] == 'this is a emergency log'; }); # You can also use the helper instead logger()->assertContext(function ($context) { return $context == ['yay' => 'it works']; }); logger()->assertLogged(function ($log) { return $log['level'] == 'emergency' && $log['message'] == 'this is a emergency log'; });
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.