Skip to content

Commit

Permalink
Unskip some tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Dec 3, 2011
1 parent 457dd73 commit 71b41ed
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 33 deletions.
16 changes: 13 additions & 3 deletions lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
Expand Up @@ -373,7 +373,8 @@ public function testImageWithTimestampping() {
* @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');

Expand Down Expand Up @@ -406,6 +407,10 @@ public function testImageTagWithTheme() {

$dir = new Folder(WWW_ROOT . 'theme' . DS . 'test_theme');
$dir->delete();
if (!$themeExists) {
$dir = new Folder(WWW_ROOT . 'theme');
$dir->delete();
}
}

/**
Expand Down Expand Up @@ -682,7 +687,8 @@ function testScriptAssetFilter() {
* @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');

Expand All @@ -703,7 +709,11 @@ public function testScriptInTheme() {

$Folder = new Folder(WWW_ROOT . 'theme' . DS . 'test_theme');
$Folder->delete();
App::build();

if (!$themeExists) {
$dir = new Folder(WWW_ROOT . 'theme');
$dir->delete();
}
}

/**
Expand Down
41 changes: 11 additions & 30 deletions lib/Cake/Test/Case/View/Helper/RssHelperTest.php
Expand Up @@ -567,13 +567,14 @@ public function testItemCdata() {
* @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);

Expand Down Expand Up @@ -637,15 +638,12 @@ public function testItemEnclosureLength() {
);
$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();
}
}

/**
Expand Down Expand Up @@ -676,21 +674,4 @@ public function testElementAttrNotInParent() {
$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;
}
}

0 comments on commit 71b41ed

Please sign in to comment.