MDL-67271 core: Add test to find missing SVG icons
[moodle.git] / lib / tests / outputrenderers_test.php
blobba20f63bf41862e88fa18942e799469ed9aceb67
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17 namespace core;
19 /**
20 * Unit tests for lib/outputrenderers.
22 * @package core
23 * @category test
24 * @copyright 2023 Rodrigo Mady
25 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 * @coversDefaultClass \core_renderer
28 class outputrenderers_test extends \advanced_testcase {
29 /**
30 * Test generated url from course image.
32 * @covers ::get_generated_url_for_course
34 public function test_get_generated_url_for_course_image() {
35 global $OUTPUT;
37 $this->resetAfterTest();
39 $course = self::getDataGenerator()->create_course();
40 $context = \context_course::instance($course->id, IGNORE_MISSING);
42 // Get the image with correct course context.
43 $courseimage = $OUTPUT->get_generated_url_for_course($context);
44 $url = "https://www.example.com/moodle/pluginfile.php/{$context->id}/course/generated/course.svg";
45 $this->assertEquals($url, $courseimage);