Page MenuHomePhabricator

UploadedFileStreamTest fails when run as root
Closed, DuplicatePublicBUG REPORT

Description

UploadedFileStreamTest::testConstruct_notReadable fails when run as root because it tests whether a file with 000 permissions is readable.

$ sudo ./vendor/bin/phpunit tests/phpunit/unit/includes/libs/ParamValidator/Util/UploadedFileStreamTest.php --filter testConstruct_notReadable
Using PHP 8.3.6
Running without MediaWiki settings because there are no integration tests
PHPUnit 9.6.21 by Sebastian Bergmann and contributors.

F                                                                   1 / 1 (100%)

Time: 00:00.029, Memory: 16.00 MB

There was 1 failure:

1) Wikimedia\Tests\ParamValidator\Util\UploadedFileStreamTest::testConstruct_notReadable
Failed asserting that exception of type "RuntimeException" is thrown.

FAILURES!
Tests: 1, Assertions: 2, Failures: 1.

Instead of failing it should be skipped.

Event Timeline

Change #1183219 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/core@master] Skip UploadedFileStreamTest::testConstruct_notReadable when run as root

https://gerrit.wikimedia.org/r/1183219