From 64e6df0154412ca328f3b6cc47464e98c5473eaa Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Thu, 9 Mar 2017 12:21:59 +1300 Subject: [PATCH] Add test for changing default staus set, improve some language strings relating to status sets --- lang/en/attendance.php | 2 +- renderables.php | 2 +- renderer.php | 2 +- tests/behat/defaultstatus.feature | 32 ++++++++++++++++++++++++++++++ tests/behat/extra_features.feature | 2 +- tests/behat/preferences.feature | 2 +- 6 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 tests/behat/defaultstatus.feature diff --git a/lang/en/attendance.php b/lang/en/attendance.php index 9e85f49..a867618 100644 --- a/lang/en/attendance.php +++ b/lang/en/attendance.php @@ -158,7 +158,6 @@ $string['moreattendance'] = 'Attendance has been successfully taken for this pag $string['moveleft'] = 'Move left'; $string['moveright'] = 'Move right'; $string['mustselectusers'] = 'Must select users to export'; -$string['myvariables'] = 'My Variables'; $string['newdate'] = 'New date'; $string['newduration'] = 'New duration'; $string['newstatusset'] = 'New set of statuses'; @@ -267,6 +266,7 @@ $string['status'] = 'Status'; $string['statuses'] = 'Statuses'; $string['statusdeleted'] = 'Status deleted'; $string['statusset'] = 'Status set {$a}'; +$string['statussetsettings'] = 'Status set'; $string['strftimedm'] = '%h %d'; $string['strftimedmy'] = '%d %h %Y'; $string['strftimedmyhm'] = '%d %h %Y %I.%M%P'; // Line added to allow multiple sessions in the same day. diff --git a/renderables.php b/renderables.php index e9e22a6..14cc7b6 100644 --- a/renderables.php +++ b/renderables.php @@ -96,7 +96,7 @@ class attendance_tabs implements renderable { if (has_capability('mod/attendance:changepreferences', $context)) { $toprow[] = new tabobject(self::TAB_PREFERENCES, $this->att->url_preferences()->out(), - get_string('settings', 'attendance')); + get_string('statussetsettings', 'attendance')); } if (has_capability('mod/attendance:managetemporaryusers', $context)) { $toprow[] = new tabobject(self::TAB_TEMPORARYUSERS, $this->att->url_managetemp()->out(), diff --git a/renderer.php b/renderer.php index 9686396..234295a 100644 --- a/renderer.php +++ b/renderer.php @@ -1445,7 +1445,7 @@ class mod_attendance_renderer extends plugin_renderer_base { $table->data[$i][] = $this->construct_preferences_button(get_string('add', 'attendance'), mod_attendance_preferences_page_params::ACTION_ADD); - $o = html_writer::tag('h1', get_string('myvariables', 'attendance')); + $o = html_writer::tag('h1', get_string('statussetsettings', 'attendance')); $o .= html_writer::table($table); $o .= html_writer::input_hidden_params($prefdata->url(array(), false)); // We should probably rewrite this to use mforms but for now add sesskey. diff --git a/tests/behat/defaultstatus.feature b/tests/behat/defaultstatus.feature new file mode 100644 index 0000000..ef0176e --- /dev/null +++ b/tests/behat/defaultstatus.feature @@ -0,0 +1,32 @@ +@mod @mod_attendance +Feature: Admin can set default status set for use in new attendance + + Background: + Given the following "courses" exist: + | fullname | shortname | summary | category | timecreated | timemodified | + | Course 1 | C1 | Prove the attendance activity works | 0 | ##yesterday## | ##yesterday## | + And the following "users" exist: + | username | firstname | lastname | email | + | teacher1 | Teacher | 1 | teacher1@example.com | + And the following "course enrolments" exist: + | course | user | role | timestart | + | C1 | teacher1 | editingteacher | ##yesterday## | + And I log in as "admin" + And I navigate to "Attendance" node in "Site administration > Plugins" + And I follow "Default status set" + And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[2]/td[3]/input" to "customstatusdescription" + And I click on "Update" "button" in the "#preferencesform" "css_element" + And I should see "Status updated" + And I log out + + @javascript + Scenario: Modified default status set added to new attendance + When I log in as "teacher1" + And I follow "Course 1" + And I turn editing mode on + And I add a "Attendance" to section "1" and I fill the form with: + | Name | Attendance1 | + And I click on "Save and display" + And I should see "Attendance1" + And I follow "Status set" + Then I should see "customstatusdescription" \ No newline at end of file diff --git a/tests/behat/extra_features.feature b/tests/behat/extra_features.feature index 8067c5f..d0e2541 100644 --- a/tests/behat/extra_features.feature +++ b/tests/behat/extra_features.feature @@ -149,7 +149,7 @@ Feature: Test the various new features in the attendance module Given I log in as "teacher1" And I follow "Course 1" And I follow "Test attendance" - And I follow "Settings" + And I follow "Status set" And I set the field "jump" to "New set of statuses" And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[1]/td[2]/input" to "G" And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[1]/td[3]/input" to "Great" diff --git a/tests/behat/preferences.feature b/tests/behat/preferences.feature index dfef092..b55c24e 100644 --- a/tests/behat/preferences.feature +++ b/tests/behat/preferences.feature @@ -23,7 +23,7 @@ Feature: Teachers can't change status variables to have empty acronyms or descri And I add a "Attendance" to section "1" and I fill the form with: | Name | Attendancepreftest | And I follow "Attendancepreftest" - And I follow "Settings" + And I follow "Status set" @javascript Scenario: Teachers can add status variables