aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/unit/includes/filebackend
Commit message (Collapse)AuthorAgeFilesLines
* tests: Use type declaration on undocumented private functionsUmherirrender2025-03-301-2/+2
| | | | Change-Id: I56b31870ce9be46d15fcd9095f9a12e0f2488ed9
* Fix uses of TempFSFileFactory's old class aliasJames D. Forrester2025-03-172-2/+2
| | | | | | | Follow-up to 0fe5cc829ecfc7b0476d69821c446516483d24fe. Bug: T382910 Change-Id: I8bd2e5d5815f37944ec4bfc5f586701a1116069b
* filebackend: Remove dependencies on MediaWiki codedaniel2025-01-081-0/+4
| | | | | | | | | | | | Why: - code under include/libs must not depend on MediaWiki code What: - replaced DeferredUpdates with a callback - replaced MWTimestamp with ConvertibleTimestamp Bug: T382910 Change-Id: I85bc06364af65bdd5a4e16474ad8a6f644d4f940
* tests: Use MediaWikiCoversValidator when extends PHPUnit's TestCaseUmherirrender2024-11-191-0/+1
| | | | | | | | | | | Validate the @covers annotation to be valid on CI runs. This is done for mosts tests via MediaWikiCoversValidator in base class MediaWikiIntegrationTestCase or MediaWikiUnitTestCase Only omitted when @coversNothing is used. This is already used in other library-related test cases. Change-Id: Ib31db02b4c623e80049a5f4645c77824244b6d6d
* Use namespaced classesUmherirrender2024-10-211-0/+1
| | | | | | | Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: I73fb416573f5af600e529d224b5beb5d2e3d27d3
* tests: Use namespaced classesUmherirrender2024-10-211-1/+2
| | | | | | | | Changes to the use statements and some additions are done automatically via script This also updates @covers tag for the namespaced classes Change-Id: I859ba6d05018c99710b744e2becab432410d3bca
* Add namespace to remaining parts of Wikimedia\Mime and Wikimedia\StatsJames D. Forrester2024-09-272-0/+2
| | | | | Bug: T353458 Change-Id: If0137003ab625017d322d57870448a02569668c3
* Add namespace to remaining parts of Wikimedia\ObjectCacheJames D. Forrester2024-09-272-0/+2
| | | | | Bug: T353458 Change-Id: I3b736346550953e3b2977c14dc3eb10edc07cf97
* libs: Add missing documentation to class propertiesUmherirrender2024-09-131-0/+1
| | | | | | | | | | Add doc-typehints to class properties found by the PropertyDocumentation sniff to improve the documentation. Once the sniff is enabled it avoids that new code is missing type declarations. This is focused on documentation and does not change code. Change-Id: I46f46f1855ca32c89a276b06f4e2051ff541886e
* Add namespace to the root classes of ObjectCacheEbrahim Byagowi2024-07-102-0/+4
| | | | | | | | | And deprecated aliases for the the no namespaced classes. ReplicatedBagOStuff that already is deprecated isn't moved. Bug: T353458 Change-Id: Ie01962517e5b53e59b9721e9996d4f1ea95abb51
* tests: Use namespaced classes (2)Umherirrender2024-06-131-0/+1
| | | | | | | Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: I4ff4d0c10820dc2a3b8419b4115fadf81a76f7a2
* Add namespace and deprecation alias to FileBackendGroupEbrahim Byagowi2024-05-202-1/+3
| | | | | | | | | This patch introduces a namespace declaration for the MediaWiki\FileBackend to FileBackendGroup and establishes a class alias marked as deprecated since version 1.43. Bug: T353458 Change-Id: Id33b6bfa56131978900199786b0082481c6c54a5
* Make HTTPFileStreamer testabledaniel2024-04-261-1/+302
| | | | | | | This also improves ThumbnailEntryPointTest by allowing it to assert which headers got sent. Change-Id: I33911775bce1b3cc7a53a03c2be50d53a28fabd1
* tests: Fix @covers and @coversDefaultClass to have leading \Reedy2024-02-164-4/+4
| | | | Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
* Deprecate ConfiguredReadOnlyMode serviceAmir Sarabadani2023-09-122-7/+5
| | | | | | | | | | | | | | | | Currently, we have two services: ReadOnlyMode and ConfiguredReadOnlyMode. The former takes the latter and can easily support every functionality of CRO. I added methods to support that functionality (the current class is quite small so it's not adding a lot more to a monster class) and basically fully deprecate the service itself to improve developer experience. It is only called in two extensions in production with straightforward fix so I directly went with hard-deprecation. Bug: T343917 Depends-On: Icec0ad3f30c471b428efe80dfb9129f55a351194 Change-Id: I421fd5c8fee7af41c059419c2bbc85b8dccc04ed
* Reorg: Move three output related classes to includes/Output/Amir Sarabadani2023-09-051-0/+1
| | | | | | | | | | And namesapce them: - StreamFile - OutputHandler - OutputPage Bug: T321882 Change-Id: Iedf8d88c595e580f2d8f0734c92aa5c45618ba33
* Reorg: Move Status to MediaWiki\Status\Amir Sarabadani2023-08-251-0/+1
| | | | | | | | | | This class is used heavily basically everywhere, moving it to Utils wouldn't make much sense. Also with this change, we can move StatusValue to MediaWiki\Status as well. Bug: T321882 Depends-On: I5f89ecf27ce1471a74f31c6018806461781213c3 Change-Id: I04c1dcf5129df437589149f0f3e284974d7c98fa
* mark various anonymous functions as staticReedy2023-08-221-1/+1
| | | | Change-Id: Iefe896769359f0d32e52bf20aa03e1c3715d5074
* Drop LockManagerGroup::getDefault() and getAny(), deprecated since 1.35James D. Forrester2023-08-161-25/+0
| | | | Change-Id: I18cb4da74369703aead42df689b54d43d70f094f
* rdbms: Move ReadOnlyMode and ConfiguredReadOnlyMode to rdbms libraryAmir Sarabadani2023-05-042-2/+2
| | | | | | | | | | | | The db/ directory does not have an owner and it's a mess in general. These classes don't depend on anything in core except the rdbms library. Let's simply move it there. In other words, Krinkle made me do it. Since the class was moved in I6202e52ba73 merged less than a week ago, no need to alias anything. Bug: T321882 Change-Id: I24ceeb8bf765a50f441270136acd612359d50aa2
* Reorg: Move ReadOnlyMode classes to db/Amir Sarabadani2023-04-282-0/+2
| | | | | | | | They are not suitable to go to rdbms library as they depend on mediawiki pieces, the second best place is the db/ directory. Bug: T321882 Change-Id: I6202e52ba7306d74261206c2ba7930c5f1a0a18e
* tests: Make some PHPUnit data providers staticTim Starling2023-03-241-1/+1
| | | | | | | | | | | | | Just methods where adding "static" to the declaration was enough, I didn't do anything with providers that used $this. Initially by search and replace. There were many mistakes which I found mostly by running the PHPStorm inspection which searches for $this usage in a static method. Later I used the PHPStorm "make static" action which avoids the more obvious mistakes. Bug: T332865 Change-Id: I47ed6692945607dfa5c139d42edbd934fa4f3a36
* Tests: add ObjectFactory to DummyServicesTraitDannyS7122023-01-231-2/+3
| | | | | | | | Mocks a ContainerInterface to support a specific list of services, with has() and get() working correctly, and uses that for a real ObjectFactory object. Change-Id: Ie49b5a34e0f449cc4b9f6b31d6cc1bc943d04b43
* Use short array destructuring instead of list()Tim Starling2022-10-211-1/+1
| | | | | | | | Introduced in PHP 7.1. Because it's shorter and looks nice. I used regex replacement. Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
* lockmanager: remove MysqlLockManager and DBLockManagerAaron Schulz2022-10-141-332/+0
| | | | | | | | | | This obscure class could only be used by running file_locks.sql and customizing $wgLockManagers. It was not worth the overhead of having to maintain it. Remove DBLockManager since there are no subclasses now. Change-Id: Id7e3fde02dfca02271bcec039be5c079de9de830
* tests: Replace assertRegExp with assertMatchesRegularExpressionDaimona Eaytoy2022-10-071-1/+1
| | | | | | | | | | | | | | | | | | And also assertNotRegExp -> assertDoesNotMatchRegularExpression. The methods were renamed in PHPUnit 9. Done automatically with: grep -rl assertRegExp tests/ | xargs sed -r -i "s/>assertRegExp\(/>assertMatchesRegularExpression\(/" grep -rl assertNotRegExp tests/ | xargs sed -r -i "s/>assertNotRegExp\(/>assertDoesNotMatchRegularExpression\(/" Split out from Ifdba0f9e98eb6bce4590b7eb73170c51a697d7c6 so that it remains smaller and easier to review. Also make a test use MediaWikiUnitTestCase (it's already in the unit/ dir) so that it can access the forward-compat method. Bug: T243600 Change-Id: Ifa279d5f201d7abeebece292141ebface8278046
* unit tests: Use MainConfigNames constant to refer configsUmherirrender2022-08-171-11/+12
| | | | | | | When creating ServiceOptions objects or fake HashConfigs use the constant to refer the config name Change-Id: I59a29f25b76e896c07e82156c6cc4494f98e64cc
* Tests: Use createNoOpMock() shortcut in a few more placesThiemo Kreuz2022-07-184-38/+17
| | | | | | … instead of doing the same manually with anythingBut() and such. Change-Id: Idb66040d1560a82df9a5bfa2a6c7e20a0649e49c
* Ensure that strlen() does not get passed a (valid) nullMark A. Hershberger2022-07-121-1/+1
| | | | | | | Seen in FileBackendGroupIntegrationTest::testGuessMimeInternal(). Bug: T289926 Change-Id: I8bf50d0fc026b2880427d3d75d57e38d4e2989d3
* Tests: Cleanup some unnecessary nested function callsReedy2022-06-061-8/+8
| | | | | | Replace ->will( ->return with ->willReturn( Change-Id: Ia2dfafa03cac8169d86d6fa5a30b73bfad1fe9fa
* Docs: remove references to DefaultSettings.phpdaniel2022-05-301-1/+1
| | | | | Bug: T300129 Change-Id: I1e83a0dde6235bed91d28d7d43691c6a5d979f2f
* tests: Use namespaced IDatabase classUmherirrender2022-05-281-0/+2
| | | | Change-Id: I7171ff26faee00d9eaabc33c2f3d91049ea0b40d
* Add convenience methods for asserting status.daniel2022-03-161-1/+1
| | | | | | | This ensures that assertions work in a uniform way, and provides meaningful messages in cause of failure. Change-Id: Ic01715b9a55444d3df6b5d4097e78cb8ac082b3e
* Use updated ObjectFactory namespaceAlexander Vorwerk2022-03-091-1/+1
| | | | | | | Depends-On: I99c5e5664d2401c36a9890f148eba7c25e6e8324 Depends-On: I48ab818b2965da14af15ef370aa83ad9455badd9 Depends-On: I018371e4b77911e56152ca7b2df734afc73f58a5 Change-Id: I04ebdb52102f6191d49a9cc70b1f98308299e72f
* Replace usages of deprecated wfWikiID()Alexander Vorwerk2021-12-211-1/+1
| | | | | | | | The global function wfWikiID() is deprecated since 1.35 and it's usages should be replaced with WikiMap::getCurrentWikiId(). Bug: T298059 Change-Id: I22d96b7aec17323d15a9bc401d4511ad2ee14165
* LockManager: distinguish conflicts from other kinds of lock errorsTim Starling2021-11-091-7/+5
| | | | | | | | | With a user-friendly error message which uses both technical and non-technical language, without the irrelevant detail of filebackend URLs. Bug: T283045 Change-Id: I8704f405d38acdffae7bd4ea5b91f3f591fc2ebc
* Drop experimental FileJournal system without deprecationJames D. Forrester2021-11-011-22/+0
| | | | | | | The feature was introduced in 2012 with d19f54602f (just before the gerrit migration). Change-Id: Ia3f59ad0ddeb1f610947b14e22b0694ff4c6ed84
* Cleanup mixed space/tab line indentUmherirrender2021-09-041-7/+7
| | | | Change-Id: I833052a656b1ce419c0929f6f0514f2a33c2c4cc
* build: Updating dependencieslibraryupgrader2021-07-222-9/+8
| | | | | | | | | | | | | | composer: * mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0 The following sniffs now pass and were enabled: * Generic.ControlStructures.InlineControlStructure * MediaWiki.PHPUnit.AssertCount.NotUsed npm: * svgo: 2.3.0 → 2.3.1 * https://npmjs.com/advisories/1754 (CVE-2021-33587) Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
* Tests: Mark more more closures as staticUmherirrender2021-02-092-4/+4
| | | | | | | Result of a new sniff I25a17fb22b6b669e817317a0f45051ae9c608208 Bug: T274036 Change-Id: I695873737167a75f0d94901fa40383a33984ca55
* Add missing @param and @return to documentation in testsUmherirrender2021-01-221-0/+2
| | | | Change-Id: Ic663e81cca0bf007804a70772250914a85f1fef4
* More misc test cleanupDannyS7122020-12-241-0/+36
| | | | | | | | | * parent::setUp() should be first, and ::tearDown() should be last * Move tests that directly extend PHPUnit\Framework\TestCase to /unit Change-Id: I1172855c58f4f52a8f624e6d596ec43beb8c93ff
* Add missing @return to FileBackendGroupTestTraitUmherirrender2020-12-181-0/+2
| | | | Change-Id: Ifb9eef6594a9520cd687adc287fcab389c3c977c
* mime: Update usage of MimeAnalyzer methodsOri Livneh2020-05-281-3/+3
| | | | | | | Follow-up to I93bd71ec1. Bug: T252228 Change-Id: I45c9fc592c9e41e0868e7d965206d4c04f4f92e1
* Fix a plethora of class and function call case mismatchesReedy2020-05-261-3/+3
| | | | | Bug: T231412 Change-Id: I597a25de3294a6673424f30475760280ef209a8a
* Merge "phpunit: Change optional params before required params to also be ↵jenkins-bot2020-03-301-1/+1
|\ | | | | | | required"
| * phpunit: Change optional params before required params to also be requiredMax Semenik2020-03-291-1/+1
| | | | | | | | | | Bug: T248078 Change-Id: I7e1d4229d84f5960fd496f281084dbec4739da4c
* | filebackend: Fix undefined wgProfiler in FileBackendGroupTestTimo Tijhof2020-03-161-0/+11
|/ | | | | | | | | | | | | | | | This currently passed CI without it, because: 1. Profiler::instance() uses 'global' instead of Config::get(), which means there is no warning for it being undefined. (When you run a stament like 'global $foo' it implicitly auto-creates the variable and assign it the null value). 2. Profiler::instance() uses array_merge() which silently tolerates non-array values like null in the list of arguments. This is changing in I638d9a219df7. Bug: T247777 Change-Id: Ic77d6023ef88ad928fe5bf9807e6e8dfb7bc4e9c
* Replace all `new stdClass()` with identical `(object)[]`Thiemo Kreuz2020-03-041-1/+1
| | | | | | | | | | | | This should be the exact same. Its more a style change than anything. So why do it then? * I believe this is much less confusing than code mentioning a weird "standard class". Barely anybody knows what this is, and what the difference between "object" and "stdClass" is. * The code is shorter. * It's even faster. In my micro benchmark it's twice as fast. Change-Id: I7ee0e8ae6d9264a89b6cd1dd861f0466ae620ccc
* Deprecate FileJournal::factoryAryeh Gregor2019-11-042-3/+4
| | | | | | | | | Instead, the constructors for FileJournal and NullFileJournal should be treated as stable. I would have added @stable, but our linting doesn't recognize it yet and doesn't let. Bug: T235066 Change-Id: I7741055b4f00197d1346ebbfebc14f20238a06f3