From 1b1495eee8aeb35fda72b7b0ec03130d8d4ba70f Mon Sep 17 00:00:00 2001 From: wapplay-home-linux Date: Tue, 14 Nov 2017 09:16:11 +0300 Subject: [PATCH] Skipped some tests for a users with root privileges --- tests/PhpZip/ZipFileTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/PhpZip/ZipFileTest.php b/tests/PhpZip/ZipFileTest.php index aa3b5d7..3685db0 100644 --- a/tests/PhpZip/ZipFileTest.php +++ b/tests/PhpZip/ZipFileTest.php @@ -30,6 +30,10 @@ class ZipFileTest extends ZipTestCase */ public function testOpenFileCantOpen() { + if (0 === posix_getuid()){ + $this->markTestSkipped('Skip the test for a user with root privileges'); + } + self::assertNotFalse(file_put_contents($this->outputFilename, 'content')); self::assertTrue(chmod($this->outputFilename, 0222)); @@ -1003,6 +1007,10 @@ class ZipFileTest extends ZipTestCase */ public function testExtractFail3() { + if (0 === posix_getuid()){ + $this->markTestSkipped('Skip the test for a user with root privileges'); + } + $zipFile = new ZipFile(); $zipFile['file'] = 'content'; $zipFile->saveAsFile($this->outputFilename); @@ -1205,6 +1213,10 @@ class ZipFileTest extends ZipTestCase */ public function testAddFileCantOpen() { + if (0 === posix_getuid()){ + $this->markTestSkipped('Skip the test for a user with root privileges'); + } + self::assertNotFalse(file_put_contents($this->outputFilename, '')); self::assertTrue(chmod($this->outputFilename, 0244)); @@ -1489,6 +1501,10 @@ class ZipFileTest extends ZipTestCase */ public function testSaveAsFileNotWritable() { + if (0 === posix_getuid()){ + $this->markTestSkipped('Skip the test for a user with root privileges'); + } + self::assertTrue(mkdir($this->outputDirname, 0444, true)); self::assertTrue(chmod($this->outputDirname, 0444));