Fixed test of logger.

This commit is contained in:
李铭昕 2019-06-24 15:58:44 +08:00
parent c3b3823967
commit c62a0a006b

View File

@ -16,6 +16,7 @@ use Hyperf\Config\Config;
use Hyperf\Contract\ConfigInterface;
use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Logger\LoggerFactory;
use Hyperf\Utils\ApplicationContext;
use Mockery;
use Monolog\Logger;
use PHPUnit\Framework\TestCase;
@ -28,6 +29,11 @@ use Psr\Log\LoggerInterface;
*/
class LoggerFactoryTest extends TestCase
{
public function tearDown()
{
Mockery::close();
}
public function testInvokeLoggerFactory()
{
$container = $this->mockContainer();
@ -38,6 +44,8 @@ class LoggerFactoryTest extends TestCase
public function testInvokeLoggerFromFactory()
{
$container = $this->mockContainer();
// $container->shouldReceive('make')->once()->with(LoggerFactory::class)->andReturn(new LoggerFactory($container));
ApplicationContext::setContainer($container);
$factory = $container->get(LoggerFactory::class);
$logger = $factory->get('hyperf');