mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Adding test case for CakeLog stream autoconfiguration.
This commit is contained in:
parent
055b5c66aa
commit
ceb7826db0
1 changed files with 20 additions and 0 deletions
|
@ -30,6 +30,26 @@ App::import('Core', 'Log');
|
||||||
*/
|
*/
|
||||||
class CakeLogTest extends CakeTestCase {
|
class CakeLogTest extends CakeTestCase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that CakeLog autoconfigures itself to use a FileLogger with the LOGS dir.
|
||||||
|
* When no streams are there.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
function testAutoConfig() {
|
||||||
|
$streams = CakeLog::streams();
|
||||||
|
foreach ($streams as $stream) {
|
||||||
|
CakeLog::removeStream($stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
@unlink(LOGS . 'error.log');
|
||||||
|
CakeLog::write(LOG_WARNING, 'Test warning');
|
||||||
|
$this->assertTrue(file_exists(LOGS . 'error.log'));
|
||||||
|
|
||||||
|
$result = CakeLog::streams();
|
||||||
|
$this->assertEqual($result, array('default'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testLogFileWriting method
|
* testLogFileWriting method
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue