Commit graph

9 commits

Author SHA1 Message Date
Reedy
c8276f731a tests: Add more use statements in namespaced classes
Change-Id: I2629cfcb09fde6f18be824779a2c12c013ea0cb5
2024-02-18 21:31:02 +00:00
daniel
6e65c8e2b6 REST: pageContentHelper: fix handling of page "0"
Use strict boolean checks to avoid "0" being interpreted as falsy.

Bug: T353687
Change-Id: If14c7fd1e64f727087ff6e9a491e6e71b6ce79da
2023-12-19 07:31:44 +01:00
James D. Forrester
4ed5ca48b1 Follow-up 71ff05267: Stop writing to tablesUsed in tests, now unnecessary
Bug: T342301
Change-Id: I5ea01f7ee103570165261bde0965c5b65e04c369
2023-11-21 09:02:48 -05:00
daniel
51036da29e Page endpoints should return 404 for bad titles
Asking a page endpoint for an invalid title should generate a 404
response, not a 403.

Change-Id: Ic0e9c5a99a6561cfd10dd3725a059cda476e6563
2023-11-02 10:18:14 +01:00
Derick Alangi
56b5df3144 tests: Widen @covers annotations in PageContentHelperTest
Doing this while we're at it:

> We lose useful coverage and spend valuable time keeping these tags
> accurate through refactors (or worse, forget to do so).
>
> I've audited each test to confirm it is a general test of the
> subject class, where adding any called methods would be an accepted
> change, thus widening it is merely a no-op that clarifies intent
> and reduces maintenance. I am not disabling the "only track coverage
> of specified subject" benefits, nor am I claiming coverage in
> in classes outside the subject under test.
>
> Tracking tiny details per-method wastes time in keeping references
> in sync during refactors, time to realize (and fix) when people
> inevitably don't keep them in sync, time lost in finding uncovered
> code to write tests for only to realize it was already covered but
> not yet claimed, etc.

Change-Id: I3053b16df2aa032759e6d74bd41ce962c7a39968
2023-09-14 18:31:45 +00:00
daniel
942a286181
Support variant redirects in /page/html REST endpoint
This is a stepping stone patch to begin supporting redirecting
a non-existing page to it's corresponding language variant in our
REST end-points.

Bug: T338605
Change-Id: I3b28c9f99b4be19a90086362cb32bd87451c49e1
2023-09-13 22:07:50 +01:00
Umherirrender
792981fea5 tests: Use Title::makeTitle instead of Title::newFromText
Avoid parsing known titles in tests to improve performance

Change-Id: Iddefe62c3d85281642f17e60cbc27aff47b85a67
2023-06-19 21:54:57 +02:00
James D. Forrester
ad06527fb4 Reorg: Namespace the Title class
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
2023-03-02 08:46:53 -05:00
Derick Alangi
1afd52e3e4 REST: Move Helper classes to their own namespace
Mixing Handlers with Helpers doesn't look nice for consistency
reasons. Helpers should be in their own place (grouped) in the
Handlers directory as they're really "helpers for the handlers".

Change-Id: Ieeb7a0a706a4cb38778f312bfbfe781a1f366d14
2023-01-16 21:16:09 +01:00
Renamed from tests/phpunit/integration/includes/Rest/Handler/PageContentHelperTest.php (Browse further)