diff --git a/admin/tool/lp/tests/behat/behat_tool_lp_data_generators.php b/admin/tool/lp/tests/behat/behat_tool_lp_data_generators.php index f639649b8e874..2d6f3f5f48852 100644 --- a/admin/tool/lp/tests/behat/behat_tool_lp_data_generators.php +++ b/admin/tool/lp/tests/behat/behat_tool_lp_data_generators.php @@ -67,6 +67,10 @@ class behat_tool_lp_data_generators extends behat_base { 'competencies' => array( 'datagenerator' => 'competency', 'required' => array('framework') + ), + 'userevidences' => array( + 'datagenerator' => 'user_evidence', + 'required' => array('user') ) ); @@ -183,4 +187,21 @@ protected function preprocess_plan($data) { return $data; } + /** + * Adapt creating user_evidence from user username. + * + * @param array $data + * @return array + */ + protected function preprocess_user_evidence($data) { + global $DB; + + if (isset($data['user'])) { + $user = $DB->get_record('user', array('username' => $data['user']), '*', MUST_EXIST); + $data['userid'] = $user->id; + } + unset($data['user']); + return $data; + } + } diff --git a/admin/tool/lp/tests/behat/user_evidence_crud.feature b/admin/tool/lp/tests/behat/user_evidence_crud.feature new file mode 100644 index 0000000000000..e9c5ad5746b86 --- /dev/null +++ b/admin/tool/lp/tests/behat/user_evidence_crud.feature @@ -0,0 +1,84 @@ +@tool @javascript @tool_lp @tool_lp_user_evidence +Feature: Manage evidence of prior learning + In order to perform CRUD operations on evidence of prior learning + As a user + I need to create, update and delete evidence of prior learning + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + |user1 | User | 1 | user1@example.com | + When I log in as "user1" + And I follow "Profile" in the user menu + And I follow "Learning plans" + Then I should see "Evidence of prior learning" + + Scenario: Create a new evidence of prior learning + Given I follow "Evidence of prior learning" + And I should see "List of evidence" + When I click on "Add new evidence" "button" + And I set the field "Name" to "Evidence-1" + And I set the field "Description" to "Evidence-1 description" + And I press "Save changes" + Then I should see "Evidence of prior learning created" + And I click on "Continue" "button" + And I should see "Evidence-1" + + Scenario: Read an evidence of prior learning + Given the following lp "userevidences" exist: + | name | description | user | + | Evidence-2 | Evidence-2 description | user1 | + And I follow "Evidence of prior learning" + And I should see "List of evidence" + And I should see "Evidence-2" + When I click on "Evidence-2" "link" + Then I should see "Evidence-2" + + Scenario: Edit an evidence of prior learning + Given the following lp "userevidences" exist: + | name | description | user | + | Evidence-3 | Evidence-3 description | user1 | + And I follow "Evidence of prior learning" + And I should see "List of evidence" + And I click on "Edit" of edit menu in the "Evidence-3" row + And the field "Name" matches value "Evidence-3" + When I set the field "Name" to "Evidence-3 Edited" + And I press "Save changes" + Then I should see "Evidence of prior learning updated" + And I click on "Continue" "button" + And I should see "Evidence-3 Edited" + + Scenario: Delete an evidence of prior learning + Given the following lp "userevidences" exist: + | name | description | user | + | Evidence-4 | Evidence-4 description | user1 | + And I follow "Evidence of prior learning" + And I should see "List of evidence" + And I click on "Delete" of edit menu in the "Evidence-4" row + And I click on "Cancel" "button" + And I click on "Edit" "link" in the "Evidence-4" "table_row" + And I click on "Delete" of edit menu in the "Evidence-4" row + And "Confirm" "dialogue" should be visible + When I click on "Delete" "button" + Then I should not see "Evidence-4" + + Scenario: List evidences of prior learning + Given the following "users" exist: + | username | firstname | lastname | email | + |user2 | User | 2 | user2@example.com | + And the following lp "userevidences" exist: + | name | description | user | + | Evidence-5 | Evidence-5 description | user1 | + | Evidence-6 | Evidence-6 description | user2 | + And I follow "Evidence of prior learning" + And I should see "List of evidence" + And I should see "Evidence-5" + When I log out + And I log in as "user2" + And I follow "Profile" in the user menu + And I follow "Learning plans" + And I follow "Evidence of prior learning" + Then I should see "List of evidence" + And I should see "Evidence-6" + And I should not see "Evidence-5" + diff --git a/admin/tool/lp/version.php b/admin/tool/lp/version.php index b1c191fb7231b..f8daf3a61f71e 100644 --- a/admin/tool/lp/version.php +++ b/admin/tool/lp/version.php @@ -25,6 +25,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2016020905; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2016020906; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2014110400; // Requires this Moodle version. $plugin->component = 'tool_lp'; // Full name of the plugin (used for diagnostics).