From: Trevor Parscal Date: Wed, 29 Sep 2010 23:57:53 +0000 (+0000) Subject: Added some content for basic unit tests for ResourceLoader class. X-Git-Tag: 1.31.0-rc.0~34728 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/journal.php?a=commitdiff_plain;h=30578bc6dd9eeb17234c4a61fdb7b1c7ebb72184;p=lhc%2Fweb%2Fwiklou.git Added some content for basic unit tests for ResourceLoader class. --- diff --git a/includes/ResourceLoader.php b/includes/ResourceLoader.php index 4cd1d96b9c..69313b4a97 100644 --- a/includes/ResourceLoader.php +++ b/includes/ResourceLoader.php @@ -199,6 +199,12 @@ class ResourceLoader { // A module has already been registered by this name throw new MWException( 'Another module has already been registered as ' . $name ); } + + // Validate the input (type hinting lets null through) + if ( !( $object instanceof ResourceLoaderModule ) ) { + throw new MWException( 'Invalid ResourceLoader module error. Instances of ResourceLoaderModule expected.' ); + } + // Attach module $this->modules[$name] = $object; $object->setName( $name );