mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
2cca0b0a7b
MINOR Moved SSErrorLogTest to SSLogTest MINOR Documentation updates for SSLog and other bits and pieces git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84828 467b73ca-7a2a-4603-9d3b-597d59a354a9
36 lines
1.0 KiB
PHP
36 lines
1.0 KiB
PHP
<?php
|
|
/**
|
|
* @package sapphire
|
|
* @subpackage tests
|
|
*/
|
|
class SSLogTest extends SapphireTest {
|
|
|
|
protected $testEmailWriter;
|
|
|
|
function setUp() {
|
|
parent::setUp();
|
|
SSLog::clear_writers(); // this test will break if existing writers are available!
|
|
$this->testEmailWriter = new SSLogEmailWriter('sean@silverstripe.com');
|
|
$this->testFileWriter = new SSLogFileWriter('../test.log');
|
|
SSLog::add_writer($this->testEmailWriter, SSLog::ERR);
|
|
SSLog::add_writer($this->testFileWriter, SSLog::WARN);
|
|
}
|
|
|
|
function testExistingWriter() {
|
|
$writers = SSLog::get_writers();
|
|
$this->assertType('array', $writers);
|
|
$this->assertEquals(2, count($writers));
|
|
}
|
|
|
|
function testRemoveWriter() {
|
|
SSLog::remove_writer($this->testEmailWriter);
|
|
$writers = SSLog::get_writers();
|
|
$this->assertType('array', $writers);
|
|
$this->assertEquals(1, count($writers));
|
|
SSLog::remove_writer($this->testFileWriter);
|
|
$writers = SSLog::get_writers();
|
|
$this->assertType('array', $writers);
|
|
$this->assertEquals(0, count($writers));
|
|
}
|
|
|
|
} |