aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/unit/includes/editpage/Constraint/SpamRegexConstraintTest.php
Commit message (Collapse)AuthorAgeFilesLines
* Update tests for PHPUnit 9.6 (part 2)Daimona Eaytoy2024-01-171-5/+4
| | | | | | | - Avoid withConsecutive() Bug: T342110 Change-Id: Iedda49765cbceeb10ccd72d0248f3cda9241da1e
* 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
* EditPage: Disentangle edit summary and section titleBartosz Dziewoński2022-07-191-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, `$this->summary` was used for two different purposes. Usually it was just the summary. But when `$this->section` was 'new', then it was actually the section title most of the time – unless `$this->sectiontitle` was also set (in which case it took priority), and until it was replaced by the real edit summary (near the end of the processing, after copying the section title to the page content and before saving changes). Unsurprisingly some of the code didn't handle this duality correctly, causing T191722 and T311533. Now `$this->summary` is always the summary, and when `$this->section` is 'new', then `$this->sectiontitle` is always the new section title. The only place where this duality remains is in the input attributes and query parameters, where 'wpSummary' is still used for both the summary and the section title inputs (only one of them can appear, depending on whether `$this->section` is 'new'). It would be an unreasonable backwards-compatibility break to change this, and the code handling this is somewhat isolated from the rest of the logic. Bug: T191722 Bug: T311533 Change-Id: I5313ca9a045d112ece390b011a34192220e2abc1
* Remove unnecessary ->equalTo() from testsThiemo Kreuz2021-04-231-4/+4
| | | | | | | | | | | | | This is the default anyway when using ->with(). The test code becomes so much more readable without this, I would like to argue. Let it just say "with these values". Because of the way I split my changes into multiple patches there are a few other changes in this patch I could not split, e.g. removing unnecessary ->any(). This is the default anyway and doesn't make the test more specific. Change-Id: I34990799fa9258ba8dc64c7e78ec43f7903b7681
* Bring SpamRegexConstraint test coverage to 100%DannyS7122020-12-261-1/+1
| | | | | Bug: T157658 Change-Id: I89d08059937d2a84de0cbc53fd4ac56153018e40
* EditPage: Move $sectionHeadingToCheck handling to SpamRegexConstraintDannyS7122020-11-111-0/+2
| | | | | | | | Cleaner and simpler if the constraint takes care of determining how to handle the section title Bug: T157658 Change-Id: I45de1aca77fe1ddcd3d94b6ca964328d9911b440
* Minor tweaks to edit constraintsDannyS7122020-11-031-1/+1
| | | | | | | | | | - EditConstraintRunner debug logging uses `info` for the failed constraint - Differentiate between the two PageSizeConstraints in debug logs - Add or tweak some comments - Normalize SpamRegexConstraint logs Bug: T157658 Change-Id: I9d0e8d48a104320f29831357b45a4003942b04fd
* EditPage: Migrate more checks to constraintDannyS7122020-10-261-18/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add - ContentModelChangeConstraint - EditRightConstraint - ImageRedirectConstraint - ReadOnlyConstraint - UserBlockConstraint - UserRateLimitConstraint Additionally: - Split EditPageTest into a separate file for all of the constraints being tested - Add a helper EditConstraintTestTrait - Add debug logging for EditConstraintRunner for the result of each constraint - Changed the order of some of the checks, which may result in a different failure code if multiple checks were going to fail, but shouldn't change the overall result of whether an edit fails or not. Bug: T157658 Change-Id: Ib8f8b62b9928544e5559c96d82bf850dd8cf9b05
* EditPage: Move spam checks to SpamRegexConstraintDannyS7122020-10-211-0/+133
Bug: T157658 Change-Id: I06ef5796f9da7b0e8555768ec6fd128b4f778294