Skip to content

Commit

Permalink
Test the TransportManager creates a log driver with any LoggerInterfa…
Browse files Browse the repository at this point in the history
…ce instance

In addition to laravel#26842, this test asserts that the `TransportManager` can create a log driver when the application has a different implementation of the `Psr\Log\LoggerInterface`, e.g. when the `illuminate/mail` package is used outside of Laravel.
  • Loading branch information
sebdesign committed Dec 14, 2018
1 parent 71a2ded commit f137da9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/Mail/MailLogTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Illuminate\Tests\Mail;

use Monolog\Logger;
use Psr\Log\NullLogger;
use Psr\Log\LoggerInterface;
use Orchestra\Testbench\TestCase;
use Monolog\Handler\StreamHandler;
Expand Down Expand Up @@ -30,4 +31,13 @@ public function testGetLogTransportWithConfiguredChannel()
$this->assertCount(1, $handlers = $monolog->getHandlers());
$this->assertInstanceOf(StreamHandler::class, $handler = $handlers[0]);
}

public function testGetLogTransportWithPsrLogger()
{
$logger = $this->app->instance('log', new NullLogger());

$manager = $this->app['swift.transport'];

$this->assertAttributeEquals($logger, 'logger', $manager->driver('log'));
}
}

0 comments on commit f137da9

Please sign in to comment.