[14:00:33] Technical Advice IRC meeting starting in 60 minutes in channel #wikimedia-tech, hosts: @Thiemo_WMDE & @Tim_WMDE - all questions welcome, more infos: https://www.mediawiki.org/wiki/Technical_Advice_IRC_Meeting [14:50:18] Technical Advice IRC meeting starting in 10 minutes in channel #wikimedia-tech, hosts: @Thiemo_WMDE & @Tim_WMDE - all questions welcome, more infos: https://www.mediawiki.org/wiki/Technical_Advice_IRC_Meeting [15:00:34] Hey, welcome to the Technical Advice IRC Meeting, me and Thiemo_WMDE will be answering any questions for the next 60 minutes! [15:01:15] o/ [15:01:56] My apologies for not listing this question at [[mw:Technical_Advice_IRC_Meeting]], but I only ended up working with this today: What do the SpecialPages test for generally? [15:02:17] We don't have many for MediaWiki core, and even fewer for the different Pagers used on those special pages. [15:03:22] Hm, not sure I get the question. Is this about PHPUnit tests? [15:03:37] o/ [15:04:34] These pagers should not be a problem, in theory. They should be written in a way that makes it very easy to write unit tests for them. [15:05:33] Thiemo_WMDE: Yes, this is in regards to PHPUnit tests. I have a pager that uses some confusing (to me at least) logic that I want to solidify with some tests, but I'm not really sure how to do that [15:05:33] Writing useful unit tests for special pages is close to impossible and often not worth it. A better approach is to extract all logic from the special page's code to a separate service class, and test this service instead. [15:06:12] mainframe98: Can you name the class name of the pager you don't understandß [15:06:44] It's not a MediaWiki core pager, but one I've written myself. [15:07:15] I've been looking at the two provided in tests/includes/specials/ but those didn't have much documentation [15:07:54] Is your code hosted publicly? Maybe we can give some proper hints related to your code directly [15:08:01] I also just realized that there are two more tests in the pager directory, but they seems to test only logic specific to a pager type. [15:08:32] tim_WMDE: Not yet. I've been working on getting this thing finished so I can publish it. I can create a gist [15:08:48] Uh, hard to say anything then. As said: Try to write the pager class with the tests you want in mind. Even better: Do actual TDD and write the test along with the class. You will end with one that is easy to test. [15:09:02] Only if this is done wrap a special page around that class. The special page is then very trivial. [15:10:07] It should not be necessary to look at existing tests for existing pagers. Just write your own. [15:10:54] Thiemo_WMDE: Right. Basically, the way I've been walking all along. That's good to know. [15:12:40] The best class I can think of does not have many dependencies. All dependencies are visible as constructor parameters. In the test these constructor parameters are filled with mock objects. [15:13:39] The best special page I can think of does not do much: Show a form, accept the parameters from the form when it was submitted, validate the input, and forward it to a separate service. That service does the actual job. [15:14:08] Thiemo_WMDE: I've been applying that as much as the existing classes allow, and that works well. It's just that some MediaWiki tests seem to do things differently and picking the right way is not always clear. [15:14:42] Luckily, your description of the best special page roughly applies to the special pages I've written, or will apply after I've refactored them [15:15:08] Yea. A lot of the PHPUnit tests you will find in the codebase are not that great, lack separation, are not clear, test to many things at once, are more integration tests than unit tests, ... [15:15:36] ... but still better than no tests. :-) [15:22:50] Other questions, tech issues, complains about the MediaWiki tech stack? ;-) [16:01:39] Thanks for tuning in. This concludes the official part of todays Technical Advice IRC Meeting. Feel free to ask technical questions any time, here, possibly on Phabricator, and on https://discourse-mediawiki.wmflabs.org in case you don't know it yet. [18:08:47] <[1997kB]> https://en.wikipedia.org/wiki/Special:MobileDiff/865558512 this is an interesting skin. [18:09:03] mm [18:09:12] that UI is designed to be run with the Minerva skin on mobile devices [1997kB] [18:09:21] https://en.wikipedia.org/wiki/Special:MobileDiff/865558512?useskin=minerva [18:09:43] or https://en.m.wikipedia.org/wiki/Special:MobileDiff/865558512 if you don't mind those awful URLs [18:10:26] <[1997kB]> so that was mixup of Minerva+ vector [18:10:29] <[1997kB]> ? [18:11:46] [1997kB], yeah or whatever else you had set in your preferences (probably not Minerva) [18:12:36] it works in monobook! https://en.wikipedia.org/wiki/Special:MobileDiff/865558512?useskin=monobook :) [18:13:09] <[1997kB]> i clicked a diff somewhere and end up there, so nothing different in my preferences. [18:13:15] huh [18:13:18] did someone link you to it? [18:13:27] or was the link in the interface somewhere? [18:13:54] <[1997kB]> someone linked it in -en [18:14:33] no one has claimed any of my GCI tasks yet :-( [18:14:59] legoktm, first 24 hours are over :D [18:15:07] <[1997kB]> so a skin can load in a different skin! [18:15:15] I feel very left out [18:15:37] legoktm, assign yourself to the IRC task :D [18:20:07] ok I'm not feeling that left out