Adding log file creation test

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6103 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2007-12-02 22:40:23 +00:00
parent 738449ee50
commit 73d4844b22

View file

@ -35,8 +35,19 @@ uses('cake_log');
*/ */
class CakeLogTest extends UnitTestCase { class CakeLogTest extends UnitTestCase {
function skip() { function testLogFileWriting() {
$this->skipif (true, 'CakeLogTest not implemented'); @unlink(LOGS . 'error.log');
CakeLog::write(LOG_WARNING, 'Test warning');
$this->assertTrue(file_exists(LOGS . 'error.log'));
unlink(LOGS . 'error.log');
CakeLog::write(LOG_WARNING, 'Test warning 1');
CakeLog::write(LOG_WARNING, 'Test warning 2');
$result = file_get_contents(LOGS . 'error.log');
$this->assertPattern('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 1/', $result);
$this->assertPattern('/2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 2$/', $result);
unlink(LOGS . 'error.log');
} }
} }
?> ?>