LoggerTest.php 911 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
<?php
/**
 * @author Carsten Brandt <mail@cebe.cc>
 */

namespace yiiunit\framework\log;

use yii\log\Logger;
use yiiunit\TestCase;

11 12 13
/**
 * @group log
 */
14 15 16
class LoggerTest extends TestCase
{

17 18 19
    public function testLog()
    {
        $logger = new Logger();
20

21 22 23 24 25
        $logger->log('test1', Logger::LEVEL_INFO);
        $this->assertEquals(1, count($logger->messages));
        $this->assertEquals('test1', $logger->messages[0][0]);
        $this->assertEquals(Logger::LEVEL_INFO, $logger->messages[0][1]);
        $this->assertEquals('application', $logger->messages[0][2]);
26

27 28 29 30 31 32
        $logger->log('test2', Logger::LEVEL_ERROR, 'category');
        $this->assertEquals(2, count($logger->messages));
        $this->assertEquals('test2', $logger->messages[1][0]);
        $this->assertEquals(Logger::LEVEL_ERROR, $logger->messages[1][1]);
        $this->assertEquals('category', $logger->messages[1][2]);
    }
AlexGx committed
33
}