From c28245d7e5e7a7d5b84bda659a1f9bb449537b60 Mon Sep 17 00:00:00 2001 From: jamiesensei Date: Sat, 30 Jun 2007 03:50:52 +0000 Subject: [PATCH] test for questionlib on MOODLE_19_QUESTIONS branch --- lib/simpletest/testquestionlib.php | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lib/simpletest/testquestionlib.php 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')); + } +} +?> -- 2.39.5