Commit graph

15 commits

Author SHA1 Message Date
Daimona Eaytoy
48a1c0bb2f Autofix spacing around commas
This was done automatically using the
`Universal.WhiteSpace.CommaSpacing` sniff, which will be included in the
next release of the MW PHPCS config.

Some of these have been adjusted manually where the autofix broke
vertical alignment.

Change-Id: I54a4668d8a2759b9d7de47742c943a535a04e211
2023-10-25 01:08:44 +02:00
thiemowmde
ea2f0b651e Replace generic new Exception with more generic ones
… or with $this->fail() from the PHPUnit TestCase base class.

I hope this makes the code more readable, i.e. communicate the
intention better. The output should be the same, i.e. the test fails
as before in case of an error.

Change-Id: Ied8a045141ac92d6af6398682bb5d9ca7ca88c49
2023-10-17 07:59:50 +00:00
Bartosz Dziewoński
56379109f4 Add tests for date formatting in Walloon (wa)
In case someone gets the idea to refactor the unusual date
formatting code in LanguageWa.

Change-Id: I4a8713c7d70e92be6ea9b6a8ccdfddfeebb8d798
2023-08-04 16:45:32 +02:00
Tim Starling
5d26080d62 Fix Chinese diff segmentation
segmentForDiff() is supposed to allow character-level diffing of Chinese
text, by adding spaces and then removing them after the diff is
complete. But when I tested it for I2d0a6996b02d37a3, unsegmentForDiff()
failed to remove the spaces, since there was an <ins> tag between the space
and the Chinese character.

So instead, use formfeed characters to separate the Chinese characters,
and strip them unconditionally instead of relying on them being next to
Chinese characters.

Add test.

Change-Id: I230d8261bbda34ad313785a1f7c31d4db7bf989b
2023-07-06 18:14:30 +10:00
Daimona Eaytoy
1c6e872bd4 Replace usages of deprecated MWException
Use SPL exceptions instead when the exception is unchecked.

Bug: T328220
Change-Id: Ia1e5edc2ef3269a44b670262b78b305d07559829
2023-06-06 17:05:32 +02:00
Bartosz Dziewoński
bcd9266c58 Add first test cases for grammar in 'kk', 'tyv' languages
Using the names of currently existing Wikimedia projects
and grammar cases already used in localisation messages.

Change-Id: I0ddd0c609a2c21dcb541718a5381d23c2c4e4213
2023-05-12 14:32:55 +00:00
Tim Starling
5e30a927bc tests: Make some PHPUnit data providers static
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
2023-03-24 02:53:57 +00:00
Umherirrender
9bcd6f7f80 tests: Move all language converter tests into /includes/
Move tests from /languages/ to /includes/language/ similiar to the
classes in f5644ba
Clean up suite config too not longer run that folder as test,
remove from coverage, there no php files to cover

Remove converter tests from Language*Test files,
all identical to the *ConverterTest cases (or remove the whole file)

Change-Id: I098ba241bd61d8ed2ee9b65393416077e3544e79
2023-02-01 20:10:56 +01:00
C. Scott Ananian
a92d1283bf Make LanguageFactory::getParentLanguage() consistent with ::getLanguage()
Allow Bcp47Code (which includes Language) as a parameter to
::getParentLanguage(), to match what was added in
Iea158fc849964ba71a27363f9522b1b3bbb82aee. Add a note to warn
callers that ::getParentLanguage() does *not* accept the same set
of string codes as ::getLanguage(); however if you pass an object
instead of a string the behavior matches.

Change-Id: I89c581ea12b354d8988c1ae8787a05976b8e3143
2023-01-31 11:33:22 -05:00
Umherirrender
fd516a98e1 Fix whitespaces after comma
Change-Id: Ide6de0a53661e6f650099d7b1f274a02699441df
2022-12-15 01:24:14 +01:00
Amir E. Aharoni
53a34c1742 Use yield consistently in grammar tests
Change-Id: I6285587e87d5c89f1723924d294eaf0884e91b7f
2022-06-03 14:52:53 +03:00
Amir E. Aharoni
cf383126b7 Grammar for Georgian - genitive
First step towards resolving bug T307207.

Other cases will be added in subsequent patches.

Bug: T307207
Change-Id: I7ae6c05cd2eca6031da29aa3c203341b70ebb1b1
2022-05-15 14:20:16 +03:00
Alexander Vorwerk
decbaf4f38 phpunit: use ->getServiceContainer() in integration tests
Change-Id: I38299cb65eeaadfdc0eb05db4e8c0b0119cfb37d
2022-01-27 22:04:16 +01:00
Fomafix
c7ebc1ec44 Fix various typos in documentation
Bug: T201491
Change-Id: I144c120cc88bda723c8608ed7fb0ccb709f295f1
2021-08-23 09:03:44 +00:00
Timo Tijhof
7c39f76452 Move Language subclasses to includes/
Depending on which namespace we want these classes to have after
T166010 they could either stay in includes/languages/ (plural) in
their own MediaWiki\Languages\-namespace dedicated to Language
subclasses, or they could go in into a subdirectory like
`includes/language/languages/` if we want to keep them in the same
top-level namespace as other Language classes and services, but in
a more nested namespace.

For now, I've made the smaller change and kept the Language subclasses
in their own directory directly under includes/, not nested further.

Bug: T225756
Change-Id: I01015424707b442853879fd50c97f00215e5c2fa
2021-08-04 23:44:46 +01:00