From 58ac1b444e0063b02990f132b3335c19c63b3961 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Fri, 22 Nov 2013 17:04:13 +1100 Subject: [PATCH] MDL-43026 behat: Add tests for all existing module generators --- .../behat/tests/behat/data_generators.feature | 24 +++++++++++++++---- lib/moodlelib.php | 14 ++--------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/admin/tool/behat/tests/behat/data_generators.feature b/admin/tool/behat/tests/behat/data_generators.feature index c0d36653ad1..7237f4cd341 100644 --- a/admin/tool/behat/tests/behat/data_generators.feature +++ b/admin/tool/behat/tests/behat/data_generators.feature @@ -1,4 +1,4 @@ -@tool @tool_behat +@tool @tool_behat @_only_local Feature: Set up contextual data for tests In order to write tests quickly As a developer @@ -143,13 +143,29 @@ Feature: Set up contextual data for tests | fullname | shortname | | Course 1 | C1 | And the following "activities" exists: - | activity | name | intro | course | idnumber | - | assign | Test assignment name | Test assignment description | C1 | assign1 | - | data | Test database name | Test database description | C1 | data1 | + | activity | name | intro | course | idnumber | + | assign | Test assignment name | Test assignment description | C1 | assign1 | + | assignment | Test assignment22 name | Test assignment22 description | C1 | assignment1 | + | data | Test database name | Test database description | C1 | data1 | + | forum | Test forum name | Test forum description | C1 | forum1 | + | label | Test label name | Test label description | C1 | label1 | + | lti | Test lti name | Test lti description | C1 | lti1 | + | page | Test page name | Test page description | C1 | page1 | + | quiz | Test quiz name | Test quiz description | C1 | quiz1 | + | resource | Test resource name | Test resource description | C1 | resource1 | When I log in as "admin" And I follow "Course 1" Then I should see "Test assignment name" + # Assignment 2.2 is disabled by default: + # And I should see "Test assignment22 name" And I should see "Test database name" + And I should see "Test forum name" + # User can see label description instead of name on the course page: + And I should see "Test label description" + And I should see "Test lti name" + And I should see "Test page name" + And I should see "Test quiz name" + And I should see "Test resource name" And I follow "Test assignment name" And I should see "Test assignment description" diff --git a/lib/moodlelib.php b/lib/moodlelib.php index d1605021512..7ec54c804d0 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1184,16 +1184,10 @@ function fix_utf8($value) { // No null bytes expected in our data, so let's remove it. $value = str_replace("\0", '', $value); - // Lower error reporting because glibc throws bogus notices. - $olderror = error_reporting(); - if ($olderror & E_NOTICE) { - error_reporting($olderror ^ E_NOTICE); - } - // Note: this duplicates min_fix_utf8() intentionally. static $buggyiconv = null; if ($buggyiconv === null) { - $buggyiconv = (!function_exists('iconv') or iconv('UTF-8', 'UTF-8//IGNORE', '100'.chr(130).'€') !== '100€'); + $buggyiconv = (!function_exists('iconv') or @iconv('UTF-8', 'UTF-8//IGNORE', '100'.chr(130).'€') !== '100€'); } if ($buggyiconv) { @@ -1209,11 +1203,7 @@ function fix_utf8($value) { } } else { - $result = iconv('UTF-8', 'UTF-8//IGNORE', $value); - } - - if ($olderror & E_NOTICE) { - error_reporting($olderror); + $result = @iconv('UTF-8', 'UTF-8//IGNORE', $value); } return $result;