Browse Source

Added Target test of the following methods: (#12294)

- getLevels()
- setLevels()
tags/2.0.10
Dmitriy Makarov 8 years ago committed by Alexander Makarov
parent
commit
d4536fe645
  1. 18
      tests/framework/log/TargetTest.php

18
tests/framework/log/TargetTest.php

@ -123,6 +123,24 @@ class TargetTest extends TestCase
$this->assertNotContains('E_b', $context);
$this->assertNotContains('E_c', $context);
}
/**
* @covers \yii\log\Target::setLevels()
* @covers \yii\log\Target::getLevels()
*/
public function testSetupLevels()
{
$target = $this->getMockForAbstractClass('yii\\log\\Target');
$target->setLevels(['info', 'error']);
$this->assertEquals(Logger::LEVEL_INFO | Logger::LEVEL_ERROR, $target->getLevels());
$target->setLevels(Logger::LEVEL_TRACE);
$this->assertEquals(Logger::LEVEL_TRACE, $target->getLevels());
$this->setExpectedException('yii\\base\\InvalidConfigException', 'Unrecognized level: unknown level');
$target->setLevels(['info', 'unknown level']);
}
}
class TestTarget extends Target

Loading…
Cancel
Save