mardi 30 juin 2020

Logging test gives always the same result regardless of the channels that are defined in the **config** file in Laravel

My test functions are below. I don't have a channel in my config/logging.php file like asdasd but I do have a channel called slack_General. The problem about the test functions is that it gives me the success all the time for the both channel name. But It should give me the error for the first function as it supposed to because I don't have a channel called asdasd. How can I test the logs are asserted succesfully for the specific channels.

https://github.com/timacdonald/log-fake This is the package I downloaded for the logging testing.

public function testSll() {
    Log::swap(new LogFake);
    Log::channel('asdasd')->alert('message');
    Log::channel('asdasd')->assertLogged('alert');
}

public function testSll() {
    Log::swap(new LogFake);
    Log::channel('slack_General')->alert('message');
    Log::channel('slack_General')->assertLogged('alert');
}

That is one data from my collection.

'slack_General' => [
        'driver' => 'slack',
        'url' => env('NOTIF_GENERAL_SLACK_WEBHOOK_URL'),
        'username' => 'xx server',
        'emoji' => ':boom:',
        'level' => 'debug',
    ],

Aucun commentaire:

Enregistrer un commentaire