Commit graph

4 commits

Author SHA1 Message Date
Brian Wolff
1c059e5053 Make ReadOnlyModeTest work in php8.
This was calling wfTmpDir(), which depended on the value
of $wgTmpDirectory being not null, but the parent class of the
test sets the entire environment to null.

Bug: T313663
Change-Id: I37f224195a5aacbd69454cc406fbd06f4e71a133
2022-07-23 19:01:58 +00:00
Thiemo Kreuz
61ae7504df Replace trivial usa of mock builder with createMock() shortcut
createMock() does the same, but is much easier to read.

A small difference is that some of the replacements made in this
patch didn't use disableOriginalConstructor() before. In case this
was relevant we should see the respective test fail. If not we can
save some CPU cycles and skip these constructors.

Change-Id: Ib98fb06e0fe753b7a53cb087a47e1159515a8ad5
2022-07-15 16:43:48 +00:00
Timo Tijhof
d87e085706 phpunit: Remove file_exists check from ReadOnlyModeTest
Per [[mw:CC/PHP]], use of file existence check is an anti-pattern
because it is subject to race conditions (e.g. parallel tests), and
needlessly slower than just performing the operation directly.

If code needs to do something in response to the file not existing,
then one can check the return value instead. This matches how other
we do it in tests and other production code.

Follows-up I3b2bac837c.

Change-Id: I4944bead2629e9d1e89cf53fa3e710a617f63726
2021-09-11 18:22:16 +00:00
DannyS712
b93f81b071 Make ReadOnlyModeTest a pure unit test
Only needed MediaWikiIntegrationTestCase for the handling
of temporary files, but its acceptable to create and manipulate
files in unit tests too.

Change-Id: I3b2bac837c943f1210cc1b804f1afbbb3ecab0f3
2021-08-05 05:43:54 +00:00
Renamed from tests/phpunit/includes/ReadOnlyModeTest.php (Browse further)