Browse Source

Unskip some tests.

mark_story 14 years ago
parent
commit
71b41ed91c

+ 13 - 3
lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php

@@ -373,7 +373,8 @@ class HtmlHelperTest extends CakeTestCase {
  * @return void
  */
 	public function testImageTagWithTheme() {
-		$this->skipIf(!is_writable(WWW_ROOT . 'theme'), 'Cannot write to webroot/theme.');
+		$this->skipIf(!is_writable(WWW_ROOT), 'Cannot write to webroot.');
+		$themeExists = is_dir(WWW_ROOT . 'theme');
 
 		App::uses('File', 'Utility');
 
@@ -406,6 +407,10 @@ class HtmlHelperTest extends CakeTestCase {
 
 		$dir = new Folder(WWW_ROOT . 'theme' . DS . 'test_theme');
 		$dir->delete();
+		if (!$themeExists) {
+			$dir = new Folder(WWW_ROOT . 'theme');
+			$dir->delete();
+		}
 	}
 
 /**
@@ -682,7 +687,8 @@ class HtmlHelperTest extends CakeTestCase {
  * @return void
  */
 	public function testScriptInTheme() {
-		$this->skipIf(!is_writable(WWW_ROOT . 'theme'), 'Cannot write to webroot/theme.');
+		$this->skipIf(!is_writable(WWW_ROOT), 'Cannot write to webroot.');
+		$themeExists = is_dir(WWW_ROOT . 'theme');
 
 		App::uses('File', 'Utility');
 
@@ -703,7 +709,11 @@ class HtmlHelperTest extends CakeTestCase {
 
 		$Folder = new Folder(WWW_ROOT . 'theme' . DS . 'test_theme');
 		$Folder->delete();
-		App::build();
+
+		if (!$themeExists) {
+			$dir = new Folder(WWW_ROOT . 'theme');
+			$dir->delete();
+		}
 	}
 
 /**

+ 11 - 30
lib/Cake/Test/Case/View/Helper/RssHelperTest.php

@@ -567,13 +567,14 @@ class RssHelperTest extends CakeTestCase {
  * @return void
  */
 	public function testItemEnclosureLength() {
-		$tmpFile = $this->_getWwwTmpFile();
-
-		if (file_exists($tmpFile)) {
-			unlink($tmpFile);
+		if (!is_writable(WWW_ROOT)) {
+			$this->markTestSkipped(__d('cake_dev', 'Webroot is not writable.'));
 		}
+		$testExists = is_dir(WWW_ROOT . 'tests');
+
+		$tmpFile = WWW_ROOT . 'tests' . DS . 'cakephp.file.test.tmp';
+		$File = new File($tmpFile, true);
 
-		$File = new File($tmpFile, true, '0777');
 		$this->assertTrue($File->write('123'), 'Could not write to ' . $tmpFile);
 		clearstatcache(true, $tmpFile);
 
@@ -637,15 +638,12 @@ class RssHelperTest extends CakeTestCase {
 		);
 		$this->assertTags($result, $expected);
 
-		unlink($tmpFile);
-	}
+		$File->delete();
 
-/**
- * testTime method
- *
- * @return void
- */
-	public function testTime() {
+		if (!$testExists) {
+			$Folder = new Folder(WWW_ROOT . 'tests');
+			$Folder->delete();
+		}
 	}
 
 /**
@@ -676,21 +674,4 @@ class RssHelperTest extends CakeTestCase {
 		$this->assertTags($result, $expected);
 	}
 
-/**
- * getWwwTmpFile method
- *
- * @param bool $paintSkip
- * @return void
- */
-	function _getWwwTmpFile() {
-		$path = WWW_ROOT . 'tests' . DS;
-		$tmpFile = $path. 'cakephp.file.test.tmp';
-		if (is_writable(dirname($tmpFile)) && (!file_exists($tmpFile) || is_writable($tmpFile))) {
-			return $tmpFile;
-		};
-
-		$message = __d('cake_dev', '%s is not writeable', $path );
-		$this->markTestSkipped($message);
-		return false;
-	}
 }