MDL-35238 Fix the unit test for invalid input_manager::TYPE_URL values
authorDavid Mudrák <david@moodle.com>
Wed, 7 Nov 2012 15:33:44 +0000 (16:33 +0100)
committerDavid Mudrák <david@moodle.com>
Thu, 8 Nov 2012 21:33:07 +0000 (22:33 +0100)
mdeploytest.php

index 1cbfb91..eb3332f 100644 (file)
@@ -134,7 +134,6 @@ class mdeploytest extends PHPUnit_Framework_TestCase {
                 input_manager::TYPE_URL,
                 'https://moodle.org/plugins/download.php/1292/mod_stampcoll_moodle23_2012062201.zip'
             ),
-            array('file:///etc/passwd', input_manager::TYPE_URL, ''),
 
             array('5e8d2ea4f50d154730100b1645fbad67', input_manager::TYPE_MD5, '5e8d2ea4f50d154730100b1645fbad67'),
         );
@@ -157,6 +156,15 @@ class mdeploytest extends PHPUnit_Framework_TestCase {
         $input->cast_value($o, input_manager::TYPE_INT); // must throw exception
     }
 
+    /**
+     * @expectedException invalid_option_exception
+     */
+    public function test_cast_invalid_url_value() {
+        $input = testable_input_manager::instance();
+        $invalid = 'file:///etc/passwd';
+        $input->cast_value($invalid, input_manager::TYPE_URL); // must throw exception
+    }
+
     /**
      * @expectedException invalid_option_exception
      */