Skip to content

Commit

Permalink
Make tests pass on windows.
Browse files Browse the repository at this point in the history
Need to shuffle around log levels to work with the 4 levels on windows
instead of the 8 on *nix systems.

Refs #3055
  • Loading branch information
markstory committed Jul 22, 2012
1 parent a27e171 commit 6286b43
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/Cake/Test/Case/Log/CakeLogTest.php
Expand Up @@ -214,12 +214,12 @@ public function testSelectiveLoggingByLevel() {
}
CakeLog::config('spam', array(
'engine' => 'FileLog',
'types' => 'info',
'types' => 'debug',
'file' => 'spam',
));
CakeLog::config('eggs', array(
'engine' => 'FileLog',
'types' => array('eggs', 'info', 'error', 'warning'),
'types' => array('eggs', 'debug', 'error', 'warning'),
'file' => 'eggs',
));

Expand All @@ -229,13 +229,13 @@ public function testSelectiveLoggingByLevel() {
$this->assertTrue(file_exists(LOGS . 'eggs.log'));
$this->assertFalse(file_exists(LOGS . 'spam.log'));

CakeLog::write(LOG_INFO, $testMessage);
CakeLog::write(LOG_DEBUG, $testMessage);
$this->assertTrue(file_exists(LOGS . 'spam.log'));

$contents = file_get_contents(LOGS . 'spam.log');
$this->assertContains('Info: ' . $testMessage, $contents);
$this->assertContains('Debug: ' . $testMessage, $contents);
$contents = file_get_contents(LOGS . 'eggs.log');
$this->assertContains('Info: ' . $testMessage, $contents);
$this->assertContains('Debug: ' . $testMessage, $contents);

if (file_exists(LOGS . 'spam.log')) {
unlink(LOGS . 'spam.log');
Expand Down Expand Up @@ -491,10 +491,10 @@ public function testConvenienceScopedLogging() {
$this->_resetLogConfig();
CakeLog::config('shops', array(
'engine' => 'FileLog',
'types' => array('info', 'notice', 'warning'),
'types' => array('info', 'debug', 'notice', 'warning'),
'scopes' => array('transactions', 'orders'),
'file' => 'shops',
));
));

CakeLog::info('info message', 'transactions');
$this->assertFalse(file_exists(LOGS . 'error.log'));
Expand Down Expand Up @@ -540,14 +540,14 @@ public function testConvenienceMethods() {
$testMessage = 'emergency message';
CakeLog::emergency($testMessage);
$contents = file_get_contents(LOGS . 'error.log');
$this->assertContains('Emergency: ' . $testMessage, $contents);
$this->assertRegExp('/(Emergency|Critical): ' . $testMessage . '/', $contents);
$this->assertFalse(file_exists(LOGS . 'debug.log'));
$this->_deleteLogs();

$testMessage = 'alert message';
CakeLog::alert($testMessage);
$contents = file_get_contents(LOGS . 'error.log');
$this->assertContains('Alert: ' . $testMessage, $contents);
$this->assertRegExp('/(Alert|Critical): ' . $testMessage . '/', $contents);
$this->assertFalse(file_exists(LOGS . 'debug.log'));
$this->_deleteLogs();

Expand Down Expand Up @@ -575,14 +575,14 @@ public function testConvenienceMethods() {
$testMessage = 'notice message';
CakeLog::notice($testMessage);
$contents = file_get_contents(LOGS . 'debug.log');
$this->assertContains('Notice: ' . $testMessage, $contents);
$this->assertRegExp('/(Notice|Debug): ' . $testMessage . '/', $contents);
$this->assertFalse(file_exists(LOGS . 'error.log'));
$this->_deleteLogs();

$testMessage = 'info message';
CakeLog::info($testMessage);
$contents = file_get_contents(LOGS . 'debug.log');
$this->assertContains('Info: ' . $testMessage, $contents);
$this->assertRegExp('/(Info|Debug): ' . $testMessage . '/', $contents);
$this->assertFalse(file_exists(LOGS . 'error.log'));
$this->_deleteLogs();

Expand Down

0 comments on commit 6286b43

Please sign in to comment.