ApiDisabled and ApiQueryDisabled should have PHPUnit tests
Closed, ResolvedPublic

Description

In MediaWiki core, the ApiDisabled and ApiQueryDisabled classes are modules that just spit out "This module is disabled". Regardless, we should still have tests for this functionality.

If you're not already familiar with PHPUnit tests, https://www.mediawiki.org/wiki/Manual:PHP_unit_testing/Writing_unit_tests has links to some good material on the basics of testing.

I would also recommend looking at other tests in the tests/phpunit/includes/api directory of MediaWiki core for an example of how we currently test API modules. Since these modules aren't used by default, you'll need to register them with $wgAPIModules and one of the API query module types to be able to test them.

I'll mentor this for Google-Code-in-2017

Legoktm created this task.Jan 2 2018, 5:30 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 2 2018, 5:30 AM
Anomie moved this task from Unsorted to Needs Code on the MediaWiki-API board.Jan 2 2018, 3:41 PM
BamLifa added a subscriber: BamLifa.EditedMar 13 2018, 8:36 AM

This task no longer needs code.

Tnis task no longer needs code.

@BamLifa: I don't understand. What does that mean? What is actually left to do in this (open) task if all code is in place?

BamLifa added a comment.EditedMar 13 2018, 1:27 PM

I saw this task on Needs code column (https://phabricator.wikimedia.org/tag/mediawiki-api/). I wanted to work on it when I found that the task has been completed already.

@BamLifa: Where to see that this task has been completed already? Links/references are welcome for any such statements. I don't see any dedicated test file in MediaWiki core's /tests/phpunit/includes/api directory for those two items, and git log includes/api/ApiQueryDisabled.php and git log includes/api/ApiDisabled.php does not show any recent related changes either, but maybe I'm looking in the wrong places?

Anomie added a subscriber: Anomie.Mar 13 2018, 7:23 PM

I don't see any dedicated test file in MediaWiki core's /tests/phpunit/includes/api directory for those two items, [...] but maybe I'm looking in the wrong places?

That's the correct place. I have no idea why @BamLifa might think the task no longer needs code, but he/she is incorrect.

Legoktm edited projects, added Easy; removed Google-Code-in-2017.Mar 13 2018, 7:25 PM
Krinkle moved this task from Inbox to PHPUnit on the MediaWiki-Core-Tests board.Jun 15 2018, 12:56 PM

Change 450068 had a related patch set uploaded (by Darien cot; owner: Darien cot):
[mediawiki/core@master] Add PHPUnit test to ApiQueryDisabled

https://gerrit.wikimedia.org/r/450068

dcot claimed this task.Aug 8 2018, 4:47 PM
dcot added a subscriber: dcot.

I'm working on resolution for this task.

Change 450068 merged by jenkins-bot:
[mediawiki/core@master] Add PHPUnit test to ApiQueryDisabled

https://gerrit.wikimedia.org/r/450068

Legoktm closed this task as Resolved.Aug 12 2018, 10:53 PM