Page MenuHomePhabricator

Rename test classes in TimedMediaHandler to let phpunit run it
Closed, ResolvedPublic

Description

The classes under /tests/phpunit/ does not end with *Test.php, and phpunit will not run them.

I would suggest to rename the classes.

I would also suggest to rename ApiTestCaseVideoUpload to ApiVideoUploadTestCase

Event Timeline

This may works at the moment, because the extension is using the UnitTestsList hook

Can you provide a sample command line that would work if they were right? If I just use say phpunit TestWebMHandler.php it complains about being unable to find MediaWikiMediaTestCase parent class, and I have no idea how it would find the MediaWiki configuration, so it would never be able to find the detailed cases....?

You can use the phpunit.php script in core

It works for a single file

php tests/phpunit/phpunit.php extensions/TimedMediaHandler/tests/phpunit/TestWebMHandler.php

But when running it for a folder, it does not find test classes, because it search for *Test.php

# php tests\phpunit\phpunit.php extensions\TimedMediaHandler\tests\phpunit

Using PHP 7.0.29
PHPUnit 6.5.8 by Sebastian Bergmann and contributors.

Time: 381 ms, Memory: 12.00MB

No tests executed!

Ah right, forgot about that mode of the script! I'll test it and adjust when my VM's back up and running later today...

TheDJ triaged this task as Lowest priority.May 8 2019, 11:46 AM
TheDJ added a project: good first task.

Change 510842 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/TimedMediaHandler@master] Rename ApiTestCaseVideoUpload to ApiVideoUploadTestCase

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

TheDJ reassigned this task from brooke to Jdforrester-WMF.
TheDJ removed a project: Patch-For-Review.

Change 510842 merged by jenkins-bot:
[mediawiki/extensions/TimedMediaHandler@master] Rename ApiTestCaseVideoUpload to ApiVideoUploadTestCase

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

Change 511313 had a related patch set uploaded (by TheDJ; owner: TheDJ):
[mediawiki/extensions/TimedMediaHandler@master] Remove 'UnitTestList' hook

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

Change 511313 merged by jenkins-bot:
[mediawiki/extensions/TimedMediaHandler@master] Remove 'UnitTestList' hook

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