From: jamiesensei Date: Sat, 30 Jun 2007 03:50:52 +0000 (+0000) Subject: test for questionlib on MOODLE_19_QUESTIONS branch X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=c28245d7e5e7a7d5b84bda659a1f9bb449537b60;p=moodle.git test for questionlib on MOODLE_19_QUESTIONS branch --- diff --git a/lib/simpletest/testquestionlib.php b/lib/simpletest/testquestionlib.php new file mode 100644 index 0000000000..73572e7699 --- /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')); + } +} +?>