From 8743cade5b643e2577905194e0aaa2ed259dd1db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Fri, 26 Oct 2018 14:26:12 +0200 Subject: [PATCH] MDL-63730 quiz: Fix unit tests to use the new way of percents display As agreed in MDL-63186, the English language pack has no space separating the number and the percents. This patch removes the regressions from the unit tests. --- .../report/statistics/tests/statistics_table_test.php | 8 ++++---- mod/quiz/tests/reportlib_test.php | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mod/quiz/report/statistics/tests/statistics_table_test.php b/mod/quiz/report/statistics/tests/statistics_table_test.php index 45d0bcb9441..6d86c2036da 100644 --- a/mod/quiz/report/statistics/tests/statistics_table_test.php +++ b/mod/quiz/report/statistics/tests/statistics_table_test.php @@ -45,12 +45,12 @@ class quiz_statistics_statistics_table_testcase extends advanced_testcase { $method->setAccessible(true); $this->assertEquals( - '84.758 %', + '84.758%', $method->invokeArgs($table, [0.847576, true, 3]) ); $this->assertEquals( - '84.758 %', + '84.758%', $method->invokeArgs($table, [84.7576, false, 3]) ); } @@ -64,12 +64,12 @@ class quiz_statistics_statistics_table_testcase extends advanced_testcase { $method->setAccessible(true); $this->assertEquals( - '54.400 % − 84.758 %', + '54.400% − 84.758%', $method->invokeArgs($table, [0.544, 0.847576, true, 3]) ); $this->assertEquals( - '54.400 % − 84.758 %', + '54.400% − 84.758%', $method->invokeArgs($table, [54.4, 84.7576, false, 3]) ); } diff --git a/mod/quiz/tests/reportlib_test.php b/mod/quiz/tests/reportlib_test.php index 23d9ec314ce..2cbe51d80bb 100644 --- a/mod/quiz/tests/reportlib_test.php +++ b/mod/quiz/tests/reportlib_test.php @@ -27,9 +27,9 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; +require_once($CFG->dirroot . '/mod/quiz/attemptlib.php'); require_once($CFG->dirroot . '/mod/quiz/report/reportlib.php'); - /** * This class contains the test cases for the functions in reportlib.php. * @@ -66,9 +66,9 @@ class mod_quiz_reportlib_testcase extends advanced_testcase { $quiz->sumgrades = 10; $quiz->decimalpoints = 2; - $this->assertEquals('12.34567 %', + $this->assertEquals('12.34567%', quiz_report_scale_summarks_as_percentage(1.234567, $quiz, false)); - $this->assertEquals('12.35 %', + $this->assertEquals('12.35%', quiz_report_scale_summarks_as_percentage(1.234567, $quiz, true)); $this->assertEquals('-', quiz_report_scale_summarks_as_percentage('-', $quiz, true));