Merge branch 'MDL-62899-search-icons-master' of https://github.com/dmitriim/moodle
[moodle.git] / user / tests / search_test.php
index 5e7f5dc..030145f 100644 (file)
@@ -215,4 +215,18 @@ class user_search_testcase extends advanced_testcase {
         $this->assertEquals(\core_search\manager::ACCESS_GRANTED, $searcharea->check_access($user2->id));
         $this->assertEquals(\core_search\manager::ACCESS_GRANTED, $searcharea->check_access($user3->id));
     }
+
+    /**
+     * Test document icon.
+     */
+    public function test_get_doc_icon() {
+        $searcharea = \core_search\manager::get_search_area($this->userareaid);
+        $user = self::getDataGenerator()->create_user();
+        $doc = $searcharea->get_document($user);
+
+        $result = $searcharea->get_doc_icon($doc);
+
+        $this->assertEquals('i/user', $result->get_name());
+        $this->assertEquals('moodle', $result->get_component());
+    }
 }