mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
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:
parent
738449ee50
commit
73d4844b22
1 changed files with 13 additions and 2 deletions
|
@ -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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue