From 30578bc6dd9eeb17234c4a61fdb7b1c7ebb72184 Mon Sep 17 00:00:00 2001 From: Trevor Parscal Date: Wed, 29 Sep 2010 23:57:53 +0000 Subject: [PATCH] Added some content for basic unit tests for ResourceLoader class. --- includes/ResourceLoader.php | 6 ++++++ 1 file changed, 6 insertions(+) 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 ); -- 2.20.1