Skip to content

Commit

Permalink
Correcting spacing in file test.
Browse files Browse the repository at this point in the history
Correctly constructing a File object, so testRead does not rely on the previous test to leave the object in the correct state.
  • Loading branch information
markstory committed May 29, 2010
1 parent c96d074 commit 25a6a3c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cake/tests/cases/libs/file.test.php
Expand Up @@ -104,6 +104,9 @@ function testBasic() {
* @return void
*/
function testRead() {
$file = __FILE__;
$this->File =& new File($file);

$result = $this->File->read();
$expecting = file_get_contents(__FILE__);
$this->assertEqual($result, $expecting);
Expand Down Expand Up @@ -445,7 +448,7 @@ function testCopy() {
* @return void
*/
function _getTmpFile($paintSkip = true) {
$tmpFile = TMP.'tests'.DS.'cakephp.file.test.tmp';
$tmpFile = TMP . 'tests' . DS . 'cakephp.file.test.tmp';
if (is_writable(dirname($tmpFile)) && (!file_exists($tmpFile) || is_writable($tmpFile))) {
return $tmpFile;
};
Expand All @@ -454,14 +457,14 @@ function _getTmpFile($paintSkip = true) {
$caller = 'test';
if (function_exists('debug_backtrace')) {
$trace = debug_backtrace();
$caller = $trace[1]['function'].'()';
$caller = $trace[1]['function'] . '()';
}
$assertLine = new SimpleStackTrace(array(__FUNCTION__));
$assertLine = $assertLine->traceMethod();
$shortPath = substr($tmpFile, strlen(ROOT));

$message = '[FileTest] Skipping %s because "%s" not writeable!';
$message = sprintf(__($message, true), $caller, $shortPath).$assertLine;
$message = sprintf(__($message, true), $caller, $shortPath) . $assertLine;
$this->_reporter->paintSkip($message);
}
return false;
Expand Down

0 comments on commit 25a6a3c

Please sign in to comment.