aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/content/JavaScriptContentHandlerTest.php
Commit message (Collapse)AuthorAgeFilesLines
* build: Update mediawiki/mediawiki-codesniffer to 44.0.0James D. Forrester2024-08-111-1/+1
| | | | Change-Id: Ic83ac1282b1b0b414450aa69731a9efcc55db665
* content: Improve roundtrip tests for JavaScriptContentTimo Tijhof2024-07-051-10/+11
| | | | | | | | | | | | * Re-use the same data provider explicitly instead of manually keeping them in sync. * Add test case names as array keys to improve debugging. * Widen `@covers` annotations in unit tests. Bug: T107289 Change-Id: I9a321400855ddd1f56334f6ecf85590fd8ed4aaf
* Add namespace and deprecation alias to JavaScriptContentHandlerEbrahim Byagowi2024-05-171-1/+2
| | | | | | | | | This patch introduces a namespace declaration for the MediaWiki\Content to JavaScriptContentHandler and establishes a class alias marked as deprecated since version 1.43. Bug: T353458 Change-Id: Ic30789d4e80a27004b6bc3b3ba891a7332a5e1ba
* Add namespace and deprecation alias to JavaScriptContentEbrahim Byagowi2024-05-171-0/+1
| | | | | | | | | This patch introduces a namespace declaration for the MediaWiki\Content to JavaScriptContent and establishes a class alias marked as deprecated since version 1.43. Bug: T353458 Change-Id: I87c17327911e28a461feaf2ff46242454cff257a
* tests: Fix @covers and @coversDefaultClass to have leading \Reedy2024-02-161-1/+1
| | | | Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
* content: Stop encoding `&` in JavaScript redirect contentKunal Mehta2023-11-011-4/+8
| | | | | | | | | | | | | | | | There is no security benefit from encoding &, it's perfectly safe in JavaScript (it likely dates from XML/XHTML requirements). Newly created redirects will use a literal & in these URLs, while continuing to support use of \u0026 for existing pages. Note that this is about use of & for query parameter seperators, the & in a page title will continue to be encoded as %26 in the 'title' value and is unaffected by this change. Bug: T107289 Co-Authored-By: Ammar Abdulhamid <ammarpad@yahoo.com> Change-Id: I1db4483db6bc52a96487fefd2c3693b4825ccbb2
* 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
* tests: Migrate `setMwGlobals()` to `overrideConfigValue(s)()`Derick Alangi2022-07-231-3/+5
| | | | | | | | | | | | | | Directories covered are: - tests/phpunit/includes/cache/ - tests/phpunit/includes/changes/ - tests/phpunit/includes/changetags/ - tests/phpunit/includes/config/ - tests/phpunit/includes/content/ - tests/phpunit/includes/debug/ - tests/phpunit/includes/deferred/ - tests/phpunit/includes/diff/ Change-Id: I3a1f586867db7d57b177e13a03a4593f7eed09f4
* phpcs: Disable `Generic.Files.LineLength` for test filesTimo Tijhof2022-02-181-1/+0
| | | | | | | | | | | There is a common and reasonable need for longer lines in tests. The nudge for shorter lines doesn't seem valuable here. The natural breaks will likely still fall in 80-100 given the enforced practice for non-test code, e.g. whether through habit, or 80-100 column markers in text editors, or the finite width of diff and code review interfaces. Change-Id: I879479e13551789a67624ce66f0946d2f185e6ee
* Recognize CSS/JS redirects with non-ASCII targetsKunal Mehta2018-10-311-0/+4
| | | | | | | | | The regex in JavaScriptContent and CssContent was trying to pass urlencoded stuff to Title::newFromText(), which would fail. Make sure we urldecode it first. Bug: T208264 Change-Id: I189c4c308da2875839ad8c1061332500f0e6d244
* 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
* build: Updating mediawiki/mediawiki-codesniffer to 15.0.0Umherirrender2018-01-011-2/+2
| | | | | | | | | | | | | Clean up use of @codingStandardsIgnore - @codingStandardsIgnoreFile -> phpcs:ignoreFile - @codingStandardsIgnoreLine -> phpcs:ignore - @codingStandardsIgnoreStart -> phpcs:disable - @codingStandardsIgnoreEnd -> phpcs:enable For phpcs:disable always the necessary sniffs are provided. Some start/end pairs are changed to line ignore Change-Id: I92ef235849bcc349c69e53504e664a155dd162c8
* Swap the rest of array() -> []Reedy2016-03-301-5/+14
| | | | Change-Id: I76a7259ed952a0673a1941f08b39b545211fba07
* Convert all array() syntax to []Kunal Mehta2016-02-171-2/+2
| | | | | | | | | | 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
* Fix some language depending phpunit tests by using MediaWikiLangTestCaseumherirrender2015-12-071-1/+1
| | | | | | | Some tests fails on wikis with $wgLanguageCode not = 'en', fix this by setting the correct language context. Change-Id: Ia72017df59d8beb5c508832584b2431ffab0f77f
* Add @codingStandardsIgnoreStart to 5 files under tests/phpunit/includesAmir E. Aharoni2015-10-031-0/+2
| | | | | | | To pass phpcs. Bug: T102614 Change-Id: I4c7d60d26112c7ba67b66f1923ce945e96175d15
* Support redirects in JavaScriptContentKunal Mehta2015-07-201-0/+30
When a JavaScript page is moved, a "redirect" in the form of mw.loader.load(...) will be left behind, so any other JavaScript loading the page that way will still work, albeit with an extra HTTP request. This also implements Content::getRedirectTarget(), so redirects are marked properly in the database, and users viewing them are redirected properly. A magic "/* #REDIRECT */" comment must be in front of the mw.loader.load call. This is done so that pages which currently are just one mw.loader.load call aren't turned into redirects. Bug: 71200 Bug: 33973 Change-Id: I10fdff087a901da56fad64531f0e382f90ebcf37