Added some content for basic unit tests for ResourceLoader class.
authorTrevor Parscal <tparscal@users.mediawiki.org>
Wed, 29 Sep 2010 23:57:53 +0000 (23:57 +0000)
committerTrevor Parscal <tparscal@users.mediawiki.org>
Wed, 29 Sep 2010 23:57:53 +0000 (23:57 +0000)
includes/ResourceLoader.php

index 4cd1d96..69313b4 100644 (file)
@@ -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 );