Created
July 27, 2011 16:07
-
-
Save ChrisJStone/1109703 to your computer and use it in GitHub Desktop.
assertTrue fails to output message
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once(dirname(__FILE__) . '/simpletest/autorun.php'); | |
require_once('../classes/log.php'); | |
class TestOfLogging extends UnitTestCase { | |
function __construct() { | |
parent::__construct('Log test'); | |
} | |
function testCreatingNewFile() { | |
unlink(dirname(__FILE__) . '/../temp/test.log'); | |
$log = new Log(dirname(__FILE__) . '/../temp/test.log'); | |
$this->assertFalse(file_exists(dirname(__FILE__) . '/../temp/test.log'), 'Created before message'); | |
$log->message('Should write this to a file'); | |
$this->assertTrue(file_exists(dirname(__FILE__) . '/../temp/test.log'), 'File created'); | |
} | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Commenting out unlink .... in log_test.php causes assertFalse to output message as expected | |
log_test.php | |
1) Created before message at [/var/www/html/tutorial/tests/log_test.php line 13] | |
in testCreatingNewFile | |
in Log test | |
FAILURES!!! | |
Test cases run: 1/1, Passes: 1, Failures: 1, Exceptions: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$this->assertTrue(file_exists(dirname(__FILE__) . '/../temp/test.log'), 'File created'); does not output File created | |
log_test.php | |
OK | |
Test cases run: 1/1, Passes: 2, Failures: 0, Exceptions: 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment