MDL-42098 - Libraries: Unit test for fullname function to ensure that debug message is
authorAdrian Greeve <adrian@moodle.com>
Wed, 2 Oct 2013 08:11:47 +0000 (16:11 +0800)
committerAdrian Greeve <adrian@moodle.com>
Fri, 4 Oct 2013 07:03:00 +0000 (15:03 +0800)
shown even when additional names are enabled.

lib/tests/moodlelib_test.php

index 4ef9da6..ed648c0 100644 (file)
@@ -2375,6 +2375,16 @@ class core_moodlelib_testcase extends advanced_testcase {
             $this->assertSame($expectedname, $testname);
         }
 
+        // Test debugging message displays when
+        // fullnamedisplay setting is "normal".
+        $CFG->fullnamedisplay = 'firstname lastname';
+        unset($user);
+        $user = new stdClass();
+        $user->firstname = 'Stan';
+        $user->lastname = 'Lee';
+        $namedisplay = fullname($user);
+        $this->assertDebuggingCalled();
+
         // Tidy up after we finish testing.
         $CFG->fullnamedisplay = $originalcfg->fullnamedisplay;
     }