|
|
@@ -507,9 +507,7 @@ class FileTest extends TestCase
|
|
|
*/
|
|
|
public function testWrite()
|
|
|
{
|
|
|
- if (!$tmpFile = $this->_getTmpFile()) {
|
|
|
- return false;
|
|
|
- }
|
|
|
+ $tmpFile = $this->_getTmpFile();
|
|
|
if (file_exists($tmpFile)) {
|
|
|
unlink($tmpFile);
|
|
|
}
|
|
|
@@ -533,13 +531,11 @@ class FileTest extends TestCase
|
|
|
/**
|
|
|
* testAppend method
|
|
|
*
|
|
|
- * @return boolean|void
|
|
|
+ * @return void
|
|
|
*/
|
|
|
public function testAppend()
|
|
|
{
|
|
|
- if (!$tmpFile = $this->_getTmpFile()) {
|
|
|
- return false;
|
|
|
- }
|
|
|
+ $tmpFile = $this->_getTmpFile();
|
|
|
if (file_exists($tmpFile)) {
|
|
|
unlink($tmpFile);
|
|
|
}
|
|
|
@@ -574,10 +570,7 @@ class FileTest extends TestCase
|
|
|
*/
|
|
|
public function testDelete()
|
|
|
{
|
|
|
- if (!$tmpFile = $this->_getTmpFile()) {
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
+ $tmpFile = $this->_getTmpFile();
|
|
|
if (!file_exists($tmpFile)) {
|
|
|
touch($tmpFile);
|
|
|
}
|
|
|
@@ -600,9 +593,7 @@ class FileTest extends TestCase
|
|
|
*/
|
|
|
public function testDeleteAfterRead()
|
|
|
{
|
|
|
- if (!$tmpFile = $this->_getTmpFile()) {
|
|
|
- return false;
|
|
|
- }
|
|
|
+ $tmpFile = $this->_getTmpFile();
|
|
|
if (!file_exists($tmpFile)) {
|
|
|
touch($tmpFile);
|
|
|
}
|
|
|
@@ -663,23 +654,19 @@ class FileTest extends TestCase
|
|
|
* @param bool $paintSkip
|
|
|
* @return void
|
|
|
*/
|
|
|
- protected function _getTmpFile($paintSkip = true)
|
|
|
+ protected function _getTmpFile()
|
|
|
{
|
|
|
$tmpFile = TMP . 'tests/cakephp.file.test.tmp';
|
|
|
if (is_writable(dirname($tmpFile)) && (!file_exists($tmpFile) || is_writable($tmpFile))) {
|
|
|
return $tmpFile;
|
|
|
}
|
|
|
|
|
|
- if ($paintSkip) {
|
|
|
- $trace = debug_backtrace();
|
|
|
- $caller = $trace[0]['function'];
|
|
|
- $shortPath = dirname($tmpFile);
|
|
|
-
|
|
|
- $message = sprintf('[FileTest] Skipping %s because "%s" not writeable!', $caller, $shortPath);
|
|
|
- $this->markTestSkipped($message);
|
|
|
- }
|
|
|
+ $trace = debug_backtrace();
|
|
|
+ $caller = $trace[0]['function'];
|
|
|
+ $shortPath = dirname($tmpFile);
|
|
|
|
|
|
- return false;
|
|
|
+ $message = sprintf('[FileTest] Skipping %s because "%s" not writeable!', $caller, $shortPath);
|
|
|
+ $this->markTestSkipped($message);
|
|
|
}
|
|
|
|
|
|
/**
|