Skip to content

Commit 1e8d596

Browse files
committed
Check if file modes got applied before proceeding with the test
Signed-off-by: Bernd Stellwag <burned@zerties.org>
1 parent f9917f1 commit 1e8d596

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/lib/ConfigTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ public function testConfigMerge() {
163163
public function testExceptionOnConfigDirNotWritable() {
164164
$notWritableDir = $this->randomTmpDir.'not_writable/';
165165
mkdir($notWritableDir, 0500);
166+
if (is_writable($notWritableDir)) {
167+
$this->markTestSkipped("Couldn't ensure that the test directory is not writable");
168+
}
169+
166170
$config = new \OC\Config($notWritableDir, 'testconfig.php');
167171

168172
$this->expectException(\OC\HintException::class);
@@ -174,6 +178,10 @@ public function testExceptionOnConfigFileNotWritable() {
174178
$configFile = $this->randomTmpDir.'not_writable_config.php';
175179
touch($configFile);
176180
chmod($configFile, 0400);
181+
if (is_writable($configFile)) {
182+
$this->markTestSkipped("Couldn't ensure that the test file is not writable");
183+
}
184+
177185
$config = new \OC\Config($this->randomTmpDir, 'not_writable_config.php');
178186

179187
$this->expectException(\OC\HintException::class);
@@ -188,8 +196,14 @@ public function testNoExceptionOnConfigDirNotWritableButConfigFileWritable() {
188196
$configFile = $notWritableDir.'writable_config.php';
189197
touch($configFile);
190198
chmod($configFile, 0600);
199+
if (!is_writable($configFile)) {
200+
$this->markTestSkipped("Couldn't ensure that the test file is writable");
201+
}
191202

192203
chmod($notWritableDir, 0500);
204+
if (is_writable($notWritableDir)) {
205+
$this->markTestSkipped('Ensure that the test directory is not writable');
206+
}
193207

194208
$config = new \OC\Config($notWritableDir, 'writable_config.php');
195209
$config->setValue('foobar', 'baz');

0 commit comments

Comments
 (0)