diff --git a/lib/simpletest/testquestionlib.php b/lib/simpletest/testquestionlib.php new file mode 100644 index 00000000000..73572e76996 --- /dev/null +++ b/lib/simpletest/testquestionlib.php @@ -0,0 +1,40 @@ +libdir.'/questionlib.php'); +class questionlib_test extends UnitTestCase { + + function setUp() { + } + + function tearDown() { + } + + function test_find_file_links_from_html() { + global $CFG; + $this->assertEqual(array_keys(find_file_links_from_html("hello hello", 2)), + array("gg/go.php")); + $this->assertEqual(array_keys(find_file_links_from_html("hello wwwroot}/file.php/2/gg/go.php\">hello", 2)), + array("gg/go.php")); + $this->assertEqual(array_keys(find_file_links_from_html('hello wwwroot.'/file.php/1/ggo/fghfgh/sdfsdf/sdf/go.php\'>hello', 1)), + array('ggo/fghfgh/sdfsdf/sdf/go.php')); + $this->assertEqual(array_keys(find_file_links_from_html('hello wwwroot.'/file.php?file=/1/ggo/fghfgh/sdfsdf/sdf/go.php\'>hello'. + "hello hello" . "hello hello" . + "hello hello" ."hello hello",1)), + array('ggo/fghfgh/sdfsdf/sdf/go.php')); + $this->assertEqual(array_keys(find_file_links_from_html('hello wwwroot.'/file.php/1/ggo/fghfgh/sdfsdf/sdf/go.php\' />', 1)), + array('ggo/fghfgh/sdfsdf/sdf/go.php')); + } +} +?>