First init
This commit is contained in:
53
tests/TestCase.php
Normal file
53
tests/TestCase.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace HerrleinIT\LogHandler\Tests;
|
||||
|
||||
use HerrleinIT\LogHandler\LogHandlerServiceProvider;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Orchestra\Testbench\TestCase as Orchestra;
|
||||
|
||||
abstract class TestCase extends Orchestra
|
||||
{
|
||||
protected function getPackageProviders($app): array
|
||||
{
|
||||
return [LogHandlerServiceProvider::class];
|
||||
}
|
||||
|
||||
protected function defineEnvironment($app): void
|
||||
{
|
||||
$app['config']->set('logging.default', 'stack');
|
||||
$app['config']->set('logging.channels.loghandler', [
|
||||
'driver' => 'loghandler',
|
||||
'level' => 'debug',
|
||||
'bubble' => true,
|
||||
]);
|
||||
$app['config']->set('logging.channels.single', [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => 'debug',
|
||||
'replace_placeholders' => true,
|
||||
]);
|
||||
$app['config']->set('logging.channels.stack', [
|
||||
'driver' => 'stack',
|
||||
'channels' => ['single', 'loghandler'],
|
||||
'ignore_exceptions' => false,
|
||||
]);
|
||||
|
||||
$app['config']->set('loghandler', [
|
||||
'endpoint' => 'http://test.example/api/error/create',
|
||||
'token' => 'test-token',
|
||||
'source' => 'Project Name',
|
||||
'enabled' => true,
|
||||
'timeout_ms' => 3000,
|
||||
'retry_times' => 0,
|
||||
'include_trace' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
Log::forgetChannel('loghandler');
|
||||
Log::forgetChannel('stack');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user