Page MenuHomePhabricator

Clean up FileImporter test class namespaces
Closed, ResolvedPublic2 Story Points

Description

We're using a few different conventions for namespaces in the tests directory. Here are a few,

FileImporter\Tests\Services\Wikitext
FileImporter\Services\Test
FileImporter\Tests\Operations
FileImporter\Operations\Test

Let's choose one consistent pattern, perhaps FileImporter\Tests\…, so that classes can be addressed using PSR-4 and to make it clear how to choose namespaces for additional classes in the future.

Event Timeline

awight created this task.May 11 2019, 8:55 PM
thiemowmde triaged this task as Lowest priority.May 14 2019, 1:22 PM
thiemowmde added subscribers: thiemowmde, WMDE-Fisch.

From my experience, the best naming scheme is FileImporter\Tests\…, followed by a copy of the namespace of the file under test. The most relevant advantage of this scheme is that it allows very convenient PSR-4 class loading.

However, the impact of this is super-low, as test classes are typically never loaded in any code. We should do it anyway, for our own sanity and because it's very fast to do.

From my experience, the best naming scheme is FileImporter\Tests\…, followed by a copy of the namespace of the file under test. The most relevant advantage of this scheme is that it allows very convenient PSR-4 class loading.

+1 that works!

test classes are typically never loaded in any code

Hopefully, we do end up encapsulating some of the repeated test code in which case PSR-4 will be helpful!

awight set the point value for this task to 2.
awight removed the point value for this task.
WMDE-Fisch set the point value for this task to 2.Jun 5 2019, 8:58 AM
thiemowmde updated the task description. (Show Details)Jun 5 2019, 9:06 AM
thiemowmde added a subscriber: Andrew-WMDE.
awight claimed this task.Jun 5 2019, 9:29 AM
awight moved this task from Sprint Backlog to Doing on the WMDE-QWERTY-Sprint-2019-05-29 board.

Change 514451 had a related patch set uploaded (by Awight; owner: Awight):
[mediawiki/extensions/FileImporter@master] Rename tests namespace to PSR-4

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

Change 514451 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Rename tests namespace to PSR-4

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

WMDE-Fisch closed this task as Resolved.Jun 5 2019, 3:05 PM