Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 34... Línea 34...
34
 * @package    core_backup
34
 * @package    core_backup
35
 * @category   test
35
 * @category   test
36
 * @copyright  2013 The Open University
36
 * @copyright  2013 The Open University
37
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
37
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
38
 */
38
 */
39
class backup_encode_content_test extends \basic_testcase {
39
final class backup_encode_content_test extends \basic_testcase {
Línea 40... Línea 40...
40
 
40
 
41
    /**
41
    /**
42
     * Test the encode_content_links method for course.
42
     * Test the encode_content_links method for course.
43
     */
43
     */
Línea 50... Línea 50...
50
        // HTTPS root and links of both types in content.
50
        // HTTPS root and links of both types in content.
51
        $CFG->wwwroot = $httpsroot;
51
        $CFG->wwwroot = $httpsroot;
52
        $encoded = backup_course_task::encode_content_links(
52
        $encoded = backup_course_task::encode_content_links(
53
            $httproot . '/course/view.php?id=123, ' .
53
            $httproot . '/course/view.php?id=123, ' .
54
            $httpsroot . '/course/view.php?id=123, ' .
54
            $httpsroot . '/course/view.php?id=123, ' .
-
 
55
            $httpsroot . '/course/section.php?id=123, ' .
55
            $httpsroot . '/grade/index.php?id=123, ' .
56
            $httpsroot . '/grade/index.php?id=123, ' .
56
            $httpsroot . '/grade/report/index.php?id=123, ' .
57
            $httpsroot . '/grade/report/index.php?id=123, ' .
57
            $httpsroot . '/badges/view.php?type=2&id=123, ' .
58
            $httpsroot . '/badges/index.php?type=2&id=123, ' .
58
            $httpsroot . '/user/index.php?id=123, ' .
59
            $httpsroot . '/user/index.php?id=123, ' .
59
            $httpsroot . '/pluginfile.php/123 and ' .
60
            $httpsroot . '/pluginfile.php/123 and ' .
60
            urlencode($httpsroot . '/pluginfile.php/123') . '.'
61
            urlencode($httpsroot . '/pluginfile.php/123') . '.'
61
        );
62
        );
62
        $this->assertEquals('$@COURSEVIEWBYID*123@$, $@COURSEVIEWBYID*123@$, $@GRADEINDEXBYID*123@$, ' .
63
        $this->assertEquals('$@COURSEVIEWBYID*123@$, $@COURSEVIEWBYID*123@$, ' .
-
 
64
                '$@COURSESECTIONBYID*123@$, $@GRADEINDEXBYID*123@$, ' .
63
                '$@GRADEREPORTINDEXBYID*123@$, $@BADGESVIEWBYID*123@$, $@USERINDEXVIEWBYID*123@$, ' .
65
                '$@GRADEREPORTINDEXBYID*123@$, $@BADGESVIEWBYID*123@$, $@USERINDEXVIEWBYID*123@$, ' .
64
                '$@PLUGINFILEBYCONTEXT*123@$ and $@PLUGINFILEBYCONTEXTURLENCODED*123@$.', $encoded);
66
                '$@PLUGINFILEBYCONTEXT*123@$ and $@PLUGINFILEBYCONTEXTURLENCODED*123@$.', $encoded);
Línea 65... Línea 67...
65
 
67
 
66
        // HTTP root and links of both types in content.
68
        // HTTP root and links of both types in content.
67
        $CFG->wwwroot = $httproot;
69
        $CFG->wwwroot = $httproot;
68
        $encoded = backup_course_task::encode_content_links(
70
        $encoded = backup_course_task::encode_content_links(
69
            $httproot . '/course/view.php?id=123, ' .
71
            $httproot . '/course/view.php?id=123, ' .
-
 
72
            $httpsroot . '/course/view.php?id=123, ' .
70
            $httpsroot . '/course/view.php?id=123, ' .
73
            $httproot . '/course/section.php?id=123, ' .
71
            $httproot . '/grade/index.php?id=123, ' .
74
            $httproot . '/grade/index.php?id=123, ' .
72
            $httproot . '/grade/report/index.php?id=123, ' .
75
            $httproot . '/grade/report/index.php?id=123, ' .
73
            $httproot . '/badges/view.php?type=2&id=123, ' .
76
            $httproot . '/badges/index.php?type=2&id=123, ' .
74
            $httproot . '/user/index.php?id=123, ' .
77
            $httproot . '/user/index.php?id=123, ' .
75
            $httproot . '/pluginfile.php/123 and ' .
78
            $httproot . '/pluginfile.php/123 and ' .
76
            urlencode($httproot . '/pluginfile.php/123') . '.'
79
            urlencode($httproot . '/pluginfile.php/123') . '.'
77
        );
80
        );
-
 
81
        $this->assertEquals('$@COURSEVIEWBYID*123@$, $@COURSEVIEWBYID*123@$, ' .
78
        $this->assertEquals('$@COURSEVIEWBYID*123@$, $@COURSEVIEWBYID*123@$, $@GRADEINDEXBYID*123@$, ' .
82
                '$@COURSESECTIONBYID*123@$, $@GRADEINDEXBYID*123@$, ' .
79
                '$@GRADEREPORTINDEXBYID*123@$, $@BADGESVIEWBYID*123@$, $@USERINDEXVIEWBYID*123@$, ' .
83
                '$@GRADEREPORTINDEXBYID*123@$, $@BADGESVIEWBYID*123@$, $@USERINDEXVIEWBYID*123@$, ' .
80
                '$@PLUGINFILEBYCONTEXT*123@$ and $@PLUGINFILEBYCONTEXTURLENCODED*123@$.', $encoded);
84
                '$@PLUGINFILEBYCONTEXT*123@$ and $@PLUGINFILEBYCONTEXTURLENCODED*123@$.', $encoded);
81
        $CFG->wwwroot = $oldroot;
85
        $CFG->wwwroot = $oldroot;
82
    }
86
    }