Commit graph

24 commits

Author SHA1 Message Date
libraryupgrader
5357695270 build: Updating dependencies
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
2021-07-22 03:36:05 +00:00
DannyS712
24afc63e49 Remove constructors from test classes
Tests should put their setup code in ::setUp(),
rather than __construct

Change-Id: I622f017f3c78a72acc65310f37d61dbec2a5da79
2021-03-08 03:31:25 +00:00
Max Semenik
48a323f702 tests: Add explicit return type void to setUp() and tearDown()
Bug: T192167
Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43
Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
2019-10-30 14:31:22 -07:00
Max Semenik
fb06e4cd85 Update tests to use PHPUnit 6 class names
Bug: T192167
Change-Id: I42b0c8908b4968b95b08f861a40af18dc79fa0a1
2019-10-06 01:01:28 -07:00
Thiemo Kreuz
e4272518f7 tests: Replace PHPUnit's loose assertEquals(false) with assertFalse()
assertEquals( false, … ) still succeeds when the actual value is 0, null,
an empty string, even an empty array. All these should be reported as a
failure, I would argue.

Note this patch previously also touched assertSame( false ). I reverted
these. The only benefit would have been consistency within this codebase,
but there is no strict reason to prefer one over the other. assertFalse()
and assertSame( false ) are functionally identical.

Change-Id: Ic5f1c7d504e7249002d3184520012e03313137b4
2019-10-04 00:30:36 +00:00
Thiemo Kreuz
32a429e8c4 tests: Prefer assertSame() when comparing the integer 0
assertSame() is guaranteed to not do any type conversion. This can be
critical when acciden tially comparing, for example, 0 to 0.0.

Change-Id: Iffcc9bda69573623ba14af655dcd697d0fcce525
2019-09-19 15:35:23 +00:00
jdlrobson
5040b3f680 RecentChanges updated to use pseudo elements for presentation
Bug: T219348
Change-Id: I6eeeaa3b58d37adb7fefb4cc6915022229b3b324
2019-04-02 14:52:50 -07:00
Fomafix
73a514b574 Remove superfluous spaces and semicolons in comments
Change-Id: Ib4b452f1843ec250c8c1fcc2a738d80726b6135d
2018-02-05 19:05:57 +00:00
Umherirrender
45da581551 Use ::class to resolve class names in tests
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: Ie541a7baae10ab6f5c13f95ac2ff6598b8f8950c
2018-01-26 22:49:13 +01:00
Timo Tijhof
810933912f changes: Remove assertTag from RCCacheEntryFactoryTest
Use PHPUnit's Xml::load() to validate that all tags and attributes
are balanced.

Use simple assertEquals or assertRegexp for the specific parts.

Change-Id: I25796954a3bb9903e88256b8345ef751c767d7d5
2017-03-31 17:20:25 -07:00
aude
f85738d92c Remove unused variables in RCCacheEntryFactoryTest
Change-Id: I41478dc2086577aacf444d0620c8b950e94e61ff
2017-01-28 15:40:52 -05:00
Kunal Mehta
5119236d4d Move Linker::getLinkColour() into LinkRenderer
* Rename to getLinkClasses() since it's not really returning colours,
  but CSS classes.
* Dependency inject LinkCache into LinkRenderer
* Update all callers of Linker::getLinkColour(), and mark it as
  deprecated (no other uses in Gerrit)
* Update a bunch of tests for new dependency

Change-Id: Id178e2dcc60b833ce2dbad4920896b93cabba1bf
2016-05-27 09:18:09 -07:00
Kunal Mehta
53ccc289fa ChangesList: Use LinkRenderer instead of Linker::link()
Change-Id: Iae32a9e365aad268d2671df6a0b916e4d9c0a801
2016-05-26 14:47:45 -07:00
Ori Livneh
e638075936 Whenever possible, reuse User objects in unit tests
The unit tests spend nearly half of their run time resetting the user table for
each test. But the majority of tests do not depend on the user table having the
exact value that the setup code resets it to, and do not need to modify the
user objects they require to run.

Fix that by providing an API for tests to get User objects, and to indicate
whether the User object will be subject to destructive modification or not.
This allows User objects to be reused across multiple unit tests.

Change-Id: I17ef1f519759c5e7796c259282afe730ef722e96
2016-05-26 20:42:31 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
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
2016-02-17 01:33:00 -08:00
Derk-Jan Hartman
3daabc1221 Change talkpagelinktext to lowercase
The message is used during the string "Some user (Talk | contribs |
block)". There, it's used as a general noun, which shouldn't be
capitalized.

This message has been not capitalized on en.wp since 2009

Bug: T99225
Change-Id: I0c18ada9a6a0224f76e14e52f6da1cbfa81e68dd
2015-12-22 22:58:31 +01:00
Timo Tijhof
b4bac102b6 tests: Clean up file headers
* Remove redundant @licence/@license from test suite files.
  They already have full licence headers. And @licence raises a
  warning in Doxygen.

* Fix weird messes of comments inside comments and other things.

Change-Id: I38da8ca76330f72b8dc22b0ecf1ea69d5ea55ede
2015-04-01 00:17:12 +01:00
aude
7c30ba9afa Add $logAction param for test recent changes helper
to allow testing with various types of log actions

Change-Id: Idc78c964a68e98239265aaaa9e7913d477a3298f
2014-08-29 11:33:23 +00:00
aude
765e575aa7 Improvements to RCCacheEntryFactoryTest and helper class
* pass User as argument when making the test context
* override rc_source when applicable

Change-Id: Id2094978d9f5ba962e76de7df29638e15a7547c3
2014-07-25 22:51:55 +00:00
aude
362d7c1e83 Remove unused param in RCCacheEntryFactoryTest
Change-Id: Ide6743759aba1083f6b4a78ec2643f059f8d3e47
2014-07-25 22:41:12 +00:00
aude
5121b62fbe Split code for making test RecentChange objects into own class
this code is useful for adding tests of the other
changes classes and better not to duplicate it.

Change-Id: I464b4fbf39a0f47cb8911378b731cdd1672ecd86
2014-07-25 22:38:30 +00:00
umherirrender
7e8b3ee507 Remove unneeded rc_cur_time key from RCCacheEntryFactoryTest
Was added with I873f6b86007000a94337f0c963df4bf8fec5b715,
but patch set was older than the remove from sql
in I4a9c2fa813d1f25dfb755e564f7677a212934d7b.

Change-Id: I6e938c3d0b67470225f53cc5229f7669a7cd8f0b
2014-04-24 19:23:54 +00:00
Siebrand Mazeland
6073f19e12 Fix CodeSniffer errors and warnings in changes tests
Follow-up to 1c6b7c7485.

Change-Id: Ib42621a03a43487d94ff1cb755544823a8adda9c
2014-03-12 18:08:59 +01:00
aude
1c6b7c7485 Add RCCacheEntryBuilder, split from EnhancedChangesList and cleaned up
This makes it more feasible for Wikibase, Flow, etc. to support
enhanced changes format, and allow better support for the rc_source
column in the future.

Change-Id: I873f6b86007000a94337f0c963df4bf8fec5b715
2014-03-12 11:23:49 +01:00