Page MenuHomePhabricator

Replace if wrapping test class in Scribunto_LuaWikibaseLibraryTestCase
Open, Needs TriagePublic

Description

There's definitely better way than doing this...

if ( !ExtensionRegistry::getInstance()->isLoaded( 'Scribunto' ) ) {
	/**
	 * Fake base class in case Scribunto is not available.
	 *
	 * @license GPL-2.0-or-later
	 * @author Marius Hoch < hoo@online.de >
	 */
	abstract class Scribunto_LuaWikibaseLibraryTestCase extends \PHPUnit\Framework\TestCase {

		protected function setUp() : void {
			$this->markTestSkipped( 'Scribunto is not available' );
		}

		public function testPlaceholder() {
			$this->fail( 'PHPunit expects this class to have tests. This should never run.' );
		}

	}

	return;
}

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

There's definitely better way than doing this...

Do you have a suggestion? Because otherwise, as long as this doesn’t cause problems, I’d be fine to leave it as it is and close this task.

The one problem I know is that the IDE can’t navigate to the class’ unique definition because there are two, but IMHO that’s only a minor annoyance.

image.png (135×1 px, 28 KB)