php__phplib/OSInet/Class_Grapher/Tests/LoggerTest.php
Frederic G. MARAND 1e30ed1687 Class_Grapher: accept multiple paths in demo. Logger improvements.
- debugLevel() method replaces debugLevel property.
- PHPUnit tests for Logger.
2012-05-07 22:39:53 +02:00

68 lines
1.5 KiB
PHP

<?php
namespace OSInet\Class_Grapher;
require_once 'OSInet/Class_Grapher/Logger.php';
require_once 'PHPUnit/Framework/TestCase.php';
/**
* Logger test case.
*/
class LoggerTest extends \PHPUnit_Framework_TestCase {
/**
*
* @var Logger
*/
private $Logger;
/**
* Prepares the environment before running a test.
*/
protected function setUp() {
parent::setUp();
$this->Logger = new Logger();
}
/**
* Cleans up the environment after running a test.
*/
protected function tearDown() {
$this->Logger = null;
parent::tearDown();
}
/**
* Tests Logger->__construct()
*/
public function test__construct() {
$this->Logger->__construct(LOG_DEBUG);
$this->assertEquals($this->Logger->debugLevel(), LOG_DEBUG);
$this->Logger->__construct(LOG_EMERG - 1);
$this->assertEquals($this->Logger->debugLevel(), LOG_EMERG);
$this->Logger->__construct(LOG_DEBUG + 1);
$this->assertEquals($this->Logger->debugLevel(), LOG_DEBUG);
$this->Logger->__construct();
$this->assertEquals($this->Logger->debugLevel(), LOG_WARNING);
}
public function testDebugLevel() {
$this->assertEquals(LOG_WARNING, $this->Logger->debugLevel());
$level = $this->Logger->debugLevel(LOG_EMERG);
$this->assertEquals(LOG_WARNING, $level);
$level = $this->Logger->debugLevel();
$this->assertEquals(LOG_EMERG, $level);
}
/**
* Tests Logger->debug()
*/
public function testDebug() {
$this->markTestSkipped("STDERR capture not available. Cannot test.");
}
}