Skip to content

Commit

Permalink
Only run SudoFilePutTest if allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
asgrim committed Feb 26, 2025
1 parent 12eb5fd commit caa25c3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/unit/File/SudoFilePutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Php\PieUnitTest\File;

use Php\Pie\File\Sudo;
use Php\Pie\File\SudoFilePut;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
Expand All @@ -21,6 +22,10 @@ final class SudoFilePutTest extends TestCase
{
public function testSudoFilePutContents(): void
{
if (! Sudo::exists()) {
self::markTestSkipped('Cannot test sudo file_put_contents without sudo');
}

$file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('pie_test_sudo_file_put_contents_', true);
touch($file);
chmod($file, 0000);
Expand Down

0 comments on commit caa25c3

Please sign in to comment.