aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/api/ApiUploadTest.php
Commit message (Collapse)AuthorAgeFilesLines
* Namespace all remaining files in includes/filerepoJames D. Forrester2025-03-191-2/+2
| | | | | Bug: T353458 Change-Id: I35864ad9bd48701703c51367d62f8ebde963c52d
* PHPUnit: Use FQCN with leading backslash in @covers annotationFomafix2024-11-191-1/+1
| | | | | | | | | | | https://docs.phpunit.de/en/11.4/annotations.html#covers recommends: > Please note that this annotation requires a fully-qualified class > name (FQCN). To make this more obvious to the reader, it is > recommended to use a leading backslash (even if this not required for > the annotation to work correctly). Change-Id: I7eb4b997346387e5799fa27a61ab317573124fd0
* tests: Use namespaced classesUmherirrender2024-10-211-1/+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
* Add namespace to remaining parts of Wikimedia\Mime and Wikimedia\StatsJames D. Forrester2024-09-271-1/+1
| | | | | Bug: T353458 Change-Id: If0137003ab625017d322d57870448a02569668c3
* Add namespace to includes/api classesJames D. Forrester2024-09-251-1/+1
| | | | | Bug: T353458 Change-Id: I3ea6b08c5018ba03ba45c5766e1f46e12f6b8597
* tests: Namespace api testsReedy2024-02-181-0/+6
| | | | | Bug: T357823 Change-Id: I0d7cc2c9b166d5e5b913c1305f7cee017fe377af
* tests: Fix @covers and @coversDefaultClass to have leading \Reedy2024-02-161-1/+1
| | | | Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
* Follow-up 71ff05267: Stop writing to tablesUsed in tests, now unnecessaryJames D. Forrester2023-11-211-3/+1
| | | | | Bug: T342301 Change-Id: I5ea01f7ee103570165261bde0965c5b65e04c369
* tests: api: Replace Title::newFromText with Title::makeTitleUmherirrender2023-07-301-5/+4
| | | | | | | | | | | | | | Parsing titles is expensive, it happens in the test function itself via Title::newFromText and also the called editPage() needs to parse the title, better to pass the title object there. Title::newFromText has a cache, that share the title object between the api code and the test code. Use independent title objects for testing. This requires some Title::READ_LATEST to ensure the changed database after the api call is used. Change-Id: I00c14e270a5f4078f80d78696ca2e39acf138e95
* Replace usages of ApiTestCase::$usersDaimona Eaytoy2023-07-251-17/+21
| | | | | | | Ideally we'd use Authority, but that doesn't always work, so just call the getTest* methods directly. Change-Id: I7f8393bb754beeb319b5555b5dac05265e376a22
* API tests: Assert error codes, not error messagesBartosz Dziewoński2023-04-261-6/+3
| | | | | | | | | | | | | | | Error messages are not guaranteed to be stable, and these tests prevent us from improving them. Error codes are supposed to be stable, so we should be asserting that they do not change (especially since many of them are dynamically generated by the dodgy code in ApiMessageTrait). Introduce helpers assertApiErrorCode() and expectApiErrorCode() to be used instead of the usual PHPUnit assertions/expectations for this case. Change-Id: I752f82f29bf5f9405ea117ebf9e5cf70335464ad
* Reorg: Namespace the Title classJames D. Forrester2023-03-021-0/+1
| | | | | | | | | | | | | | | | | | | This is moderately messy. Process was principally: * xargs rg --files-with-matches '^use Title;' | grep 'php$' | \ xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1' * rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \ xargs rg --files-with-matches 'Title\b' | \ xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1' * composer fix Then manual fix-ups for a few files that don't have any use statements. Bug: T166010 Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
* Reorg: Migrate WikiMap to WikiMap/ out of includesAmir Sarabadani2023-02-271-0/+1
| | | | | | | And WikiReference Bug: T321882 Change-Id: I60cf4b9ef02b9d58118caa39172677ddfe03d787
* Revert "Reorg: Move some of request related classes to MediaWiki/Request"Zabe2022-10-271-1/+1
| | | | | | | | | This reverts commit 2bdc0b2b7209441a42a784157633a8a01b321922. Reason for revert: T166010#8349431 Bug: T166010 Change-Id: Idcd3025647aec99532f5d69b9c1718c531761283
* Reorg: Move some of request related classes to MediaWiki/RequestAmir Sarabadani2022-10-261-1/+1
| | | | | | | | | | | | | Moving: - DerivativeRequest - FauxRequest - FauxRequestUpload - PathRouter - WebRequest - WebRequestUpload Bug: T166010 Change-Id: I5ea70120d745f2876ae31d039f3f8a51e49e9ad8
* Use short array destructuring instead of list()Tim Starling2022-10-211-10/+10
| | | | | | | | Introduced in PHP 7.1. Because it's shorter and looks nice. I used regex replacement. Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
* tests: Remove resetServiceForTesting after overrideConfigValuesUmherirrender2022-07-271-1/+0
| | | | | | overrideConfigValues is documented to reset services as well Change-Id: Ie13a699f6cd912b912d34adb97704bab3cbdff2d
* tests: Use `overrideConfig(Value|Values)` where neededDerick Alangi2022-07-121-6/+4
| | | | | | | This patch covers: tests/phpunit/includes/actions/ and tests/phpunit/includes/api/. Change-Id: I60d8fb7b8a63b423606db935fa0d24cf859b2512
* 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
* RepoGroup: inject MimeAnalyzerAlexander Vorwerk2021-08-131-1/+2
| | | | Change-Id: Ic3009b368b38d307d00dc3bec5c8d46b2dc97f83
* build: Updating dependencieslibraryupgrader2021-07-221-1/+1
| | | | | | | | | | | | | | 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
* Use IEC prefixes instead of SI prefixes for byte sizes (docs+backend)Fomafix2021-06-281-1/+1
| | | | | | | This change doesn't change any UI messages. Bug: T54687 Change-Id: Ia62899a2a6fe8910618c35cd667291e397ddb055
* Use WatchlistManager in API classesCindy Cicalese2021-04-211-1/+1
| | | | Change-Id: I7b2016162e86b455c0102742751981c44d7e829c
* Add watchlist expiry support to applicable APIsMusikAnimal2020-07-131-2/+12
| | | | | | | | | | | This introduces an ApiWatchlistTrait that refactors out common code across APIs that allow you to watch pages. Some methods have been migrated from ApiBase and changed completely, but codesearch suggests they aren't being used outside the API modules in this patch. Bug: T248512 Bug: T248514 Change-Id: Ia18627b9824dca81f44f0571e8420d89b7626cf6
* Fix visibility of setUp/tearDownThiemo Kreuz2020-06-161-1/+1
| | | | Change-Id: I636be48eb9f713680abac35d46091f7b49374696
* tests: Add explicit return type void to setUp() and tearDown()Max Semenik2019-10-301-1/+1
| | | | | | Bug: T192167 Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43 Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
* Replace setExpectedException with two argsDaimona Eaytoy2019-10-051-12/+6
| | | | | | | | | | | Find: ^(\t*)(\$this->)setExpectedException\(\s+(\\?[a-z\\]+::class),\s+('(?:[^'\\]|\\')+'|"(?:[^"\\]|\\")+")\s+\); Replace: $1$2expectException( $3 );\n$1\$this->expectExceptionMessage( $4 ); +broke long lines manually. Bug: T192167 Change-Id: I5557b4372625def55a53ac637c2f980f51f12933
* Rework ApiUploadTestPetr Pchelko2019-08-301-423/+153
| | | | | Bug: T28169 Change-Id: I923bf82d07db0efce1d0d14cf04e15bb58472f59
* Rename ApiTestCaseUploadUmherirrender2018-03-161-1/+1
| | | | | | | Having *TestCase at end of the class name makes it easier to detect it as TestCase class Change-Id: Ic7ae7328e729c0f2d97afcf7c5be793d6a8df58f
* Update suppressWarning()/restoreWarning() callsReedy2018-02-101-4/+4
| | | | | Bug: T182273 Change-Id: I9e1b628fe5949ca54258424c2e45b2fb6d491d0f
* Add @covers tags API tests without themKunal Mehta2017-12-271-0/+2
| | | | Change-Id: Ida0f954cb0a44719af3a3d0c6bda4587c9ca42b6
* Make `ApiUploadTest` up to date so it passesAleksey Bekh-Ivanov (WMDE)2017-09-221-4/+5
| | | | | | | | Although the test is still might fail from time to time and needs refactoring. Bug: T28169 Change-Id: Ib27a36e0d76495a133eb8941300e4940e5eb670e
* API: i18n for warnings and errorsBrad Jorsch2016-12-061-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | API warnings and error messages are currently hard-coded English strings. This patch changes that. With a few exceptions, this patch should be compatible with non-updated extensions: * The change to ApiBase::$messageMap will blow up anything trying to mess with it. * The changes to the 'ApiCheckCanExecute' hook will cause a wrong (probably unparsed) error message to be emitted for extensions not already using an ApiMessage. Unless they're currently broken like Wikibase. Bug: T37074 Bug: T47843 Depends-On: Ia2b66b57cd4eaddc30b3ffdd7b97d6ca3e02d898 Depends-On: I2e1bb975bb0045476c03ebe6cdec00259bae22ec Depends-On: I53987bf87c48f6c00deec17a8e957d24fcc3eaa6 Depends-On: Ibf93a459eb62d30f7c70d20e91ec9faeb80d10ed Depends-On: I3cf889811f44a15935e454dd42f081164d4a098c Depends-On: Ieae527de86735ddcba34724730e8730fb277b99b Depends-On: I535344c29d51521147c2a26c341dae38cec3e931 Change-Id: Iae0e2ce3bd42dd4776a9779664086119ac188412
* Remove uses of deprecated TestUser propertiesaddshore2016-06-221-4/+6
| | | | Change-Id: Ib44c66492e27516dfe205a5e428ebfd6b0fcdfd9
* Many more function case mismatchesReedy2016-03-191-7/+7
| | | | Change-Id: I5d3a5eb8adea1ecbf136415bb9fd7a162633ccca
* Convert all array() syntax to []Kunal Mehta2016-02-171-30/+30
| | | | | | | | | | 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
* Remove putrid remains of $wgAllowAsyncCopyUploadsBartosz Dziewoński2016-01-221-1/+1
| | | | | | | | | None of this works and it's been long begging for a mercy kill. All it does is waste contributor time on updating deprecations in the dead code. I imagine we wouldn't reuse much of this code if we're ever going to reimplement it. Bug: T119336 Change-Id: Ibd26a4bea621857aac77823017e9be9b7dc52cca
* Some bugzilla.wikimedia.org -> phabricator.wikimedia.org changesumherirrender2015-09-241-1/+1
| | | | | | | | Changed some old bugzilla links to new phabricator links in comments, test data and error message. This reduces the need for redirects from old bugzilla to new phabricator from our source code. Change-Id: Id98278e26ce31656295a23f3cadb536859c4caa5
* Remove use of deprecated TestUser->useraddshore2015-08-071-14/+14
| | | | Change-Id: Iec47ea2609b4d407e827cec5bf2a834b75727005
* Use mediawiki/at-ease library for suppressing warningsKunal Mehta2015-06-111-4/+4
| | | | | | | | | | | | | | | wfSuppressWarnings() and wfRestoreWarnings() were split out into a separate library. All usages in core were replaced with the new functions, and the wf* global functions are marked as deprecated. Additionally, some uses of @ were replaced due to composer's autoloader being loaded even earlier. Ie1234f8c12693408de9b94bf6f84480a90bd4f8e adds the library to mediawiki/vendor. Bug: T100923 Change-Id: I5c35079a0a656180852be0ae6b1262d40f6534c4
* tests: Clean up file headersTimo Tijhof2015-04-011-20/+15
| | | | | | | | | | * Remove redundant @licence/@license from test suite files. They already have full licence headers. And @licence raises a warning in Doxygen. * Fix weird messes of comments inside comments and other things. Change-Id: I38da8ca76330f72b8dc22b0ecf1ea69d5ea55ede
* Use MediaWikiTestCase methods for tempdir in unit testsTimo Tijhof2015-02-111-19/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use MediaWikiTestCase::getNewTempFile and getNewTempDirectory instead of wfTempDir(). The upload api tests wrote a tempnam() file directly (where wfTempDir() is typically shared with other systems and concurrent runs). Use MediaWikiTestCase::getNewTempFile and getNewTempDirectory instead. This also ensures its removal by the teardown handler without needing manual unlink() calls. And it doesn't rely on the test passing. (Many unlink calls where at the bottom of tests, which wouldn't be reached in case of failure). * For the upload test, the presistent storing of 'Oberaargletscher_from_Oberaar.jpg' (downloaded from Commons) was removed. Note that this didn't work for Jenkins builds anyway as Jenkins builds set $wgTmpDirectory to a unique directory in tmpfs associated with an individual build. * For filebackend tests, moved directory creation from the dataProvider to the main test. Implemented addTmpFiles() to allow subclasses to register additional files (created by other means) to be cleaned up also. Removed unused $tmpName and $toPath parameters in data provider for FileBackendTest::testStore. And fixed weird double $op2 variable name to be called $op3. * Skipped parserTest.inc, MockFileBackend.php, and UploadFromUrlTestSuite.php as those don't use MediaWikiTestCase. Change-Id: Ic7feb06ef0c1006eb99485470a1a59419f972545
* Remove require_once from some tests by adding classes to TestsAutoLoaderumherirrender2014-11-121-2/+0
| | | | Change-Id: If6d0a72acb98e0971fcce2facb239b67cbe639a5
* Pass phpcs-strict on some test files (8/11)Siebrand Mazeland2014-04-241-1/+1
| | | | Change-Id: I138c1f9bf2c3c7e9218d5fa29365e78b309fb459
* Pass phpcs-strict on some test files (5/x)Siebrand Mazeland2014-04-241-10/+20
| | | | Change-Id: I690645cd8a9b1165dcc8271b201c695ea9391226
* General Cleanup of some Testsaddshore2013-11-251-0/+4
| | | | | | Style Fixes, Comment fixes Change-Id: I675d3f098e81709d5dfd928af6ca54589d3d5fad
* Add @group medium to ApiUploadTestaude2013-11-231-0/+1
| | | | | | api tests require either @group medium or @group large Change-Id: Iea65c4856579690de234a2a8c01669b282a265f3
* Fixed spacingumherirrender2013-11-211-4/+0
| | | | | | | | - Removed trailing spaces in comments - Removed multiple empty lines - Removed space after object operator Change-Id: I9fd3256ab490c7cd2034de3fd94e6be6e6d6d8f2
* Fix scope on all /phpunit test methodsaddshore2013-10-241-1/+1
| | | | Change-Id: I3ce92463d485a0fb23e464e9a8059330f32d79af
* No spaces within (casts)MatmaRex2013-08-311-2/+2
| | | | | | | | Per the code conventions ([[mw:CC/PHP]]). This file appears to be the only outlier. Change-Id: I634d9927174737ffc99976a97a41ce04c842fc32