aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/filerepo/FileRepoTest.php
Commit message (Collapse)AuthorAgeFilesLines
* tests: Use namespaced classesUmherirrender2024-10-211-0/+1
| | | | | | | | 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
* tests: Fix @covers and @coversDefaultClass to have leading \Reedy2024-02-161-1/+1
| | | | Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
* Replace more instances of deprecated MWExceptionDaimona Eaytoy2024-01-191-4/+4
| | | | | Bug: T328220 Change-Id: Iba90f7f9b5766bccc05380d040138d74d5e9558a
* objectcache,resourceloader,rdbms,jobqueue: Widen @covers annotationsTimo Tijhof2023-04-101-18/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follows-up I4c7d826c7ec654b, I1287f3979aba1bf1. We lose useful coverage and spend valuable time keeping these accurate through refactors (or worse, forget to do so). The theoretically "bad" accidental coverage is almost never actually bad. Having said that, I'm not removing them wholesale (yet). I've audited each of these specific files to confirm it is a general test of the specified subject class, and also kept it limited to those specified classes. That's imho more than 100% of the benefit for less than 1% of the cost (more because `@covers` is more valuable than the fragile and corrosive individual private method tracking in tests that inevitably get out of date with no local incentive to keep them up to date). Cases like structure tests keep `@coversNothing` etc and we still don't count coverage of other classes. There may be a handful of large legacy classes where some methods are effectively class-like in complexity and that's why it's good for PHPUnit to offer the precision instrument but that doesn't meant we have to use that by-default for everything. I think best practice is to write good narrow unit tests, that reflect how the code should be used in practice. Not to write bad tests and hide part of its coverage within the same class or even namespace. Fortunately, that's generally what we do already it's just that we also kept these annotations still in many cases. This wastes time to keep methods in sync, time to realize (and fix) when other people inevitably didn't keep them in sync, time to find uncovered code only to realize it is already covered, time for a less experienced engineer to feel obligate to and do write a low quality test to cover the "missing" branch in an unrealistic way, time wasted in on-boarding by using such "bad" tests as example for how to use the code and then having to unlearn it months/years later, loss of telemetry in knowing what code actually isn't propertly tested due to being masked by a bad test, and lost oppertunities to find actually ununused/unreachable code and to think about how to instead structure the code such that maybe that code can be removed. ------ Especially cases like LBFactoryTest.php were getting out of hand, and in GlobalIdGeneratorTest.php we even resorted to reminding people with inline comments to keep tags in sync. Change-Id: I69b5385868cc6b451e5f2ebec9539694968bf58c
* tests: Migrate `setMwGlobals()` to `overrideConfigValue(s)`Derick Alangi2022-07-271-1/+3
| | | | Change-Id: I13a82dc57a86f74c713a11eff26488bee06903e2
* MediaWikiTestCase to MediaWikiIntegrationTestCaseaddshore2020-06-301-1/+1
| | | | | | | | | | | | | The name change happened some time ago, and I think its about time to start using the name name! (Done with a find and replace) My personal motivation for doing this is that I have started trying out vscode as an IDE for mediawiki development, and right now it doesn't appear to handle php aliases very well or at all. Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
* Hard-deprecate Title::getUserCaseDBKeyAryeh Gregor2019-10-241-0/+16
| | | | | | | | | | | | | | | | | | | The only use-case for this was if the local wiki's File namespace didn't allow initial-lowercase names but a remote repo did. This case is unlikely to be useful and was broken anyway, so it's now prohibited, and getUserCaseDBKey is no longer needed. It's now an alias for getDBkey until we remove it. This includes a breaking change to MediaWikiTitleCodec::splitTitleString, but that was always intended as an internal method and I have now marked it officially as such. There is one caller in code search outside core (JsonConfig), but it looks like it will be unaffected. Bug: T202094 Depends-On: I4b8ceb8a7f4624d6a3763aca6df41bf1a0d7293f Depends-On: I724be15e93421f874fb202f0ec2ca6940e56a20a Change-Id: I4fd64d4b0036b6dabdcfeee18766df18bf538542
* phpcs: Enable ↵James D. Forrester2019-10-141-4/+4
| | | | | | MediaWiki.Commenting.PhpunitAnnotations.ForbiddenExpectedException* and make pass Change-Id: I63f97497714a32236268be6965c5e181dade6c58
* Revert "Separate MediaWiki unit and integration tests"Legoktm2019-06-131-0/+55
| | | | | | | | This reverts commit 0a2b996278e57a8b8c5377cd3a3eaa54f993d4a9. Reason for revert: Broke postgres tests. Change-Id: I27d8e0c807ad5f0748b9611a4f3df84cc213fbe1
* Separate MediaWiki unit and integration testsMáté Szabó2019-06-131-55/+0
| | | | | | | | | | | | | | | | | | | | | This changeset implements T89432 and related tickets and is based on exploration done at the Prague Hackathon. The goal is to identify tests in MediaWiki core that can be run without having to install & configure MediaWiki and its dependencies, and provide a way to execute these tests via the standard phpunit entry point, allowing for faster development and integration with existing tooling like IDEs. The initial set of tests that met these criteria were identified using the work Amir did in I88822667693d9e00ac3d4639c87bc24e5083e5e8. These tests were then moved into a new subdirectory under phpunit/ and organized into a separate test suite. The environment for this suite is set up via a PHPUnit bootstrap file without a custom entry point. You can execute these tests by running: $ vendor/bin/phpunit -d memory_limit=512M -c tests/phpunit/unit-tests.xml Bug: T89432 Bug: T87781 Bug: T84948 Change-Id: Iad01033a0548afd4d2a6f2c1ef6fcc9debf72c0d
* Use ::class to resolve class names in testsUmherirrender2018-01-261-1/+1
| | | | | | | This helps to find renamed or misspelled classes earlier. Phan will check the class names Change-Id: Ie541a7baae10ab6f5c13f95ac2ff6598b8f8950c
* Convert all array() syntax to []Kunal Mehta2016-02-171-10/+10
| | | | | | | | | | Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
* filebackend: cleaned up the FileBackend constructorAaron Schulz2013-12-031-1/+1
| | | | | | * Added some b/c code with deprecation warnings Change-Id: Ifceffbc0a37a223bcd7cd3dc60181fc85765bc46
* Revert "filebackend: cleaned up the FileBackend constructor"Aaron Schulz2013-12-031-1/+1
| | | | | | | | Actually this messes with the implicit backend made for things like Math (when unconfigured), which uses the "new" operator. This reverts commit 1f129a22cbc8546b89dd4b49b2f567c1f758a968. Change-Id: I4c72c4f7c8b82e38df5496cf2b90fc9e19c40334
* filebackend: cleaned up the FileBackend constructorAaron Schulz2013-11-231-1/+1
| | | | | | | | | * Moved some of the graph construction work to FileBackendGroup. This helps the code in not depending on the rest of MW so much. * Updated tests and FileBackendMultiwrite, which are the only things directly constructing FileBackend objects. Change-Id: I188a053c70ce088ce34613d5db40e6708e3ea9b7
* Fix scope on all /phpunit test methodsaddshore2013-10-241-5/+5
| | | | Change-Id: I3ce92463d485a0fb23e464e9a8059330f32d79af
* Add @covers tags for more testsaddshore2013-10-211-0/+8
| | | | Change-Id: Iff3af78e9b41c445b7f066b6c0d0f4a87d2d6c4e
* Remove unused local variables in testsSiebrand Mazeland2013-04-261-5/+4
| | | | Change-Id: I71318eb7d8c00bfc1ce6d2fc636b498f7a695f42
* Update formattingSiebrand Mazeland2013-02-151-3/+6
| | | | | | 5 of n. Change-Id: I811ca957b6588085d67606ebc0cd4033a1e53839
* Tweak testFileRepoConstructionWithRequiredOptions so that it doesn't fail ↵Aaron Schulz2012-03-131-2/+6
| | | | | | | depending on the config of the wiki being tested on. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/113703
* test FileRepo constructorAntoine Musso2012-02-071-0/+7
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/110849
* FileRepo: check constructor parametersAntoine Musso2012-01-231-0/+34
new FileRepo() requires an array of parameters having at least the 'name' and 'backend' key setup. TODO: 'backend' keyword should probably default to FileBackend. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/109824