aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/logging/DatabaseLogEntryTest.php
Commit message (Collapse)AuthorAgeFilesLines
* Namespace all remaining files in includes/loggingJames D. Forrester2025-03-191-4/+5
| | | | | Bug: T353458 Change-Id: Ibe1810f1c71316a9124e1dc6ae405097dafd5267
* Use explicit nullable type on parameter argumentsUmherirrender2024-10-161-2/+2
| | | | | | | | | | | Implicitly marking parameter $... as nullable is deprecated in php8.4, the explicit nullable type must be used instead Created with autofix from Ide15839e98a6229c22584d1c1c88c690982e1d7a Break one long line in SpecialPage.php Bug: T376276 Change-Id: I807257b2ba1ab2744ab74d9572c9c3d3ac2a968e
* tests: Remove reset of services in testsUmherirrender2024-09-051-13/+0
| | | | | | | | | | Before a test is started there are no services, there is no need to reset services in setUp(). After a test finished all created services are destroyed by MediaWikiIntegrationTestCase and does not need own teardown. overrideConfigValue() also resets services Change-Id: I41c71866ec6d93cd2b7e3dd45269e0972ed6a273
* tests: Fix @covers and @coversDefaultClass to have leading \Reedy2024-02-161-3/+3
| | | | Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
* Use IReadableDatabase over IDatabase in DatabaseLogEntry::newFromIdDreamy Jazz2023-10-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | Why: * The DatabaseLogEntry::newFromId method only uses the provided DB for SELECT queries (via the DatabaseLogEntry ::newSelectQueryBuilder method). * The DatabaseLogEntry::newSelectQueryBuilder method takes a IReadableDatabase object and this is the only usage of the DB provided to ::newFromId * As such, the ::newFromId type should be IReadableDatabase instead of IDatabase so that callers who only have a readable database connection can still use this method. What: * Change the type of the $db parameter of DatabaseLogEntry ::newFromId to be a IReadableDatabase instead of an IDatabase. * Update RCDatabaseLogEntry::newFromId to reflect the change in parameter type. * Update the associated tests to use a IReadableDatabase. Change-Id: Idc6c13b147a5ff99d0969c1120eb1deb2d111496
* Introduce LoggingSelectQueryBuilderAmir Sarabadani2023-09-251-2/+2
| | | | | | | | | | To replace DatabaseLogEntry::getSelectQueryData() Many migrations can't happen right now because of use of ChangeTagsStore::modifyDisplayQuery() but I will fix that soon. Bug: T344971 Change-Id: Iafb2bb5ea3a0da49da1dafb69b65dea3c15029ed
* Fix more non-database tests accessing the databaseDaimona Eaytoy2023-08-061-0/+3
| | | | | | | | Mock the needed services, or set fixed values to avoid DB lookups, when possible. Add the test to the Database group otherwise, e.g. for things like Skin and Parser that use global state all over the place. Change-Id: I8d87013d89accaf04d0ac19cb4b7216290383eb5
* tests: Make some PHPUnit data providers staticTim Starling2023-03-241-2/+2
| | | | | | | | | | | | | 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
* logging: Remove user_editcount from DatabaseLogEntry query infoUmherirrender2022-04-061-1/+0
| | | | | | | | The column is now unused. It was used to prefill edit count in User object before 83e1846 by use of User::newFromRow Follow-Up: I1b78bad7e1fa43f5f82908567a7daad9c6cc79b9 Change-Id: Iec5eeaa8729a3add46c11cd62dee8aefe2e5e050
* phpunit: use ->getServiceContainer() in integration testsAlexander Vorwerk2022-01-271-5/+4
| | | | Change-Id: I38299cb65eeaadfdc0eb05db4e8c0b0119cfb37d
* build: Updating dependencieslibraryupgrader2021-07-221-2/+2
| | | | | | | | | | | | | | 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
* Remove hard-deprecated LogEntry::getPerformerPetr Pchelko2021-06-281-0/+37
| | | | Change-Id: Ia2c4819848f5d23d5ceb74aae9c6c5920b8851ba
* Stop using legacy ActorMigration field "log_user"Tim Starling2021-04-281-6/+6
| | | | | Bug: T278917 Change-Id: I1b78bad7e1fa43f5f82908567a7daad9c6cc79b9
* Improve some function documentation in testsUmherirrender2021-01-141-2/+2
| | | | | | Also fix some whitespaces Change-Id: Ibed50a4f07442d3f299cf545c16f5dbb5f27a411
* More misc test cleanupDannyS7122020-12-241-2/+1
| | | | | | | | | * parent::setUp() should be first, and ::tearDown() should be last * Move tests that directly extend PHPUnit\Framework\TestCase to /unit Change-Id: I1172855c58f4f52a8f624e6d596ec43beb8c93ff
* 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
* Fix visibility of setUp/tearDownThiemo Kreuz2020-06-161-2/+2
| | | | Change-Id: I636be48eb9f713680abac35d46091f7b49374696
* tests: Add explicit return type void to setUp() and tearDown()Max Semenik2019-10-301-2/+2
| | | | | | Bug: T192167 Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43 Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
* Clean up most of b/c for phpunit4Amir Sarabadani2019-10-061-1/+1
| | | | | | | We don't support phpunit4 anymore: https://w.wiki/9UT Change-Id: Ia7c932998f1a49af1e322ab9e1dc249b7bd2e8b2
* Mostly drop old pre-actor user schemasBrad Jorsch2019-09-091-45/+6
| | | | | | | | | | | | | | | | | | | | This removes most of the pre-actor user and user_text columns, and the $wgActorTableSchemaMigrationStage setting that used to determine whether the columns were used. rev_user and rev_user_text remain in the code, as on Wikimedia wikis the revision table is too large to alter at this time. A future change will combine that with the removal of rev_comment, rev_content_model, and rev_content_format (and the addition of rev_comment_id and rev_actor). ActorMigration's constructor continues to take a $stage parameter, and continues to have the logic for handling it, for the benefit of extensions that might need their own migration process. Code using ActorMigration for accessing the core fields should be updated to use the new actor fields directly. That will be done for in a followup. Bug: T188327 Change-Id: Id35544b879af1cd708f3efd303fce8d9a1b9eb02
* Mostly drop old comment schemasBrad Jorsch2019-02-071-11/+11
| | | | | | | | | | | | | | | | | | This removes most of the pre-CommentStore text columns, and the $wgCommentTableSchemaMigrationStage setting that used to determine whether the columns were used. rev_comment remains in the code, as on Wikimedia wikis the revision table is too large to alter at this time. A future change will combine that with the removal of rev_user_text, rev_content_model, and rev_content_format (and the addition of rev_comment_id and rev_actor). CommentStore's constructor continues to take a $stage parameter, and continues to have the logic for handling it, for the benefit of extensions that might need their own migration process. Bug: T166733 Change-Id: I1479c73774e01ead1490adf6128f820c09bce9d4
* ActorMigration: Remove possibility of read-bothBrad Jorsch2018-10-111-4/+9
| | | | | | | | | | | | | | | | | | When this was originally written, the plan was to read both the old and new fields during the transition period, while stopping writes to them midway through. It turns out that the WHERE conditions to do read-both correctly are generally not handled well by the database and working around that would require a lot of complicated code (see what's being removed from ApiQueryUserContribs here, for example). We can simplify things greatly by instead having it write both fields during the transition period, reading from the old for the first part and the new for the second part, as is being done for MCR. Bug: T204669 Change-Id: I4764c1c7883dc1003cb12729455c8107319f70b1 Depends-On: I845f6ae462f2539ebd35cbb5f2ca8b5714e2c1fb Depends-On: I88b31b977543fdbdf69f8c1158e77e448df94e11
* Introduce DatabaseLogEntry::newFromIdMax Semenik2018-03-051-0/+162
It's a helper function for when you need just one log entry. Change-Id: Ic5e9db0def857d9dcecbd06bf081c8c83712c1ea