Merge branch 'MDL-82866-main' of https://github.com/lameze/moodle

This commit is contained in:
Sara Arjona 2025-01-14 14:22:20 +01:00
commit 8d429bc55b
No known key found for this signature in database
13 changed files with 297 additions and 169 deletions

View file

@ -0,0 +1,7 @@
issueNumber: MDL-82866
notes:
tool_lp:
- message: >-
behat_tool_lp_data_generators::the_following_lp_exist is deprecated. Use
the following "core_competency > [competency|framework|plan...]" exist:
type: deprecated

View file

@ -23,7 +23,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
require_once(__DIR__ . '/../../../../../lib/behat/behat_base.php'); require_once(__DIR__ . '/../../../../../lib/behat/behat_deprecated_base.php');
use Behat\Gherkin\Node\TableNode as TableNode; use Behat\Gherkin\Node\TableNode as TableNode;
use Behat\Behat\Tester\Exception\PendingException as PendingException; use Behat\Behat\Tester\Exception\PendingException as PendingException;
@ -40,7 +40,7 @@ use core_competency\user_evidence;
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca> * @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
class behat_tool_lp_data_generators extends behat_base { class behat_tool_lp_deprecated extends behat_deprecated_base {
/** /**
* @var tool_lp data generator * @var tool_lp data generator
@ -98,12 +98,21 @@ class behat_tool_lp_data_generators extends behat_base {
* *
* @Given /^the following lp "(?P<element_string>(?:[^"]|\\")*)" exist:$/ * @Given /^the following lp "(?P<element_string>(?:[^"]|\\")*)" exist:$/
* *
* @todo MDL-78077 This will be deleted in Moodle 6.0.
* @deprecated since 5.0
*
* @throws Exception * @throws Exception
* @throws PendingException * @throws PendingException
* @param string $elementname The name of the entity to add * @param string $elementname The name of the entity to add
* @param TableNode $data * @param TableNode $data
*/ */
#[\core\attribute\deprecated('behat_tool_lp_data_generators::the_following_lp_exist', since: '5.0')]
public function the_following_lp_exist($elementname, TableNode $data) { public function the_following_lp_exist($elementname, TableNode $data) {
$this->deprecated_message([
'behat_tool_lp_data_generators::the_following_lp_exist is deprecated',
'Use: the following "core_competency > [competency|framework|plan...]" exist:',
]);
// Now that we need them require the data generators. // Now that we need them require the data generators.
require_once(__DIR__.'/../../../../../lib/phpunit/classes/util.php'); require_once(__DIR__.'/../../../../../lib/phpunit/classes/util.php');

View file

@ -4,13 +4,13 @@ Feature: See the competencies for an activity on the course competencies page.
In order to see only the competencies for an activity in the course competencies page. In order to see only the competencies for an activity in the course competencies page.
Background: Background:
Given the following lp "frameworks" exist: Given the following "core_competency > frameworks" exist:
| shortname | idnumber | | shortname | idnumber |
| Test-Framework | ID-FW1 | | Test-Framework | ID-FW1 |
And the following lp "competencies" exist: And the following "core_competency > competencies" exist:
| shortname | framework | | shortname | competencyframework |
| Test-Comp1 | ID-FW1 | | Test-Comp1 | ID-FW1 |
| Test-Comp2 | ID-FW1 | | Test-Comp2 | ID-FW1 |
Given the following "courses" exist: Given the following "courses" exist:
| shortname | fullname | enablecompletion | | shortname | fullname | enablecompletion |
| C1 | Course 1 | 1 | | C1 | Course 1 | 1 |

View file

@ -29,18 +29,18 @@ Feature: Manage competency frameworks
And I should see "Science Year-1" And I should see "Science Year-1"
Scenario: Read a framework Scenario: Read a framework
Given the following lp "frameworks" exist: Given the following "core_competency > frameworks" exist:
| shortname | idnumber | | shortname | idnumber |
| Science Year-2 | sc-y-2 | | Science Year-2 | sc-y-2 |
And I navigate to "Competencies > Competency frameworks" in site administration And I navigate to "Competencies > Competency frameworks" in site administration
And I should see "Science Year-2" And I should see "Science Year-2"
When I click on "Science Year-2" "link" When I click on "Science Year-2" "link"
Then I should see "Science Year-2" Then I should see "Science Year-2"
Scenario: Edit a framework Scenario: Edit a framework
Given the following lp "frameworks" exist: Given the following "core_competency > frameworks" exist:
| shortname | idnumber | | shortname | idnumber |
| Science Year-3 | sc-y-3 | | Science Year-3 | sc-y-3 |
And I navigate to "Competencies > Competency frameworks" in site administration And I navigate to "Competencies > Competency frameworks" in site administration
And I should see "Science Year-3" And I should see "Science Year-3"
And I click on "Edit" of edit menu in the "Science Year-3" row And I click on "Edit" of edit menu in the "Science Year-3" row
@ -52,9 +52,9 @@ Feature: Manage competency frameworks
And I should see "sc-y-3" And I should see "sc-y-3"
Scenario: Delete a framework Scenario: Delete a framework
Given the following lp "frameworks" exist: Given the following "core_competency > frameworks" exist:
| shortname | idnumber | | shortname | idnumber |
| Science Year-4 | sc-y-4 | | Science Year-4 | sc-y-4 |
And I navigate to "Competencies > Competency frameworks" in site administration And I navigate to "Competencies > Competency frameworks" in site administration
And I should see "Science Year-4" And I should see "Science Year-4"
And I should see "sc-y-4" And I should see "sc-y-4"
@ -70,24 +70,24 @@ Feature: Manage competency frameworks
And I should not see "sc-y-4" And I should not see "sc-y-4"
Scenario: Edit a framework with competencies in user competency Scenario: Edit a framework with competencies in user competency
Given the following lp "frameworks" exist: Given the following "core_competency > frameworks" exist:
| shortname | idnumber | | shortname | idnumber |
| Science Year-5 | sc-y-5 | | Science Year-5 | sc-y-5 |
And the following lp "competencies" exist: And the following "core_competency > competencies" exist:
| shortname | framework | | shortname | competencyframework | idnumber |
| Comp1 | sc-y-5 | | Comp1 | sc-y-5 | Comp1 |
| Comp2 | sc-y-5 | | Comp2 | sc-y-5 | Comp2 |
And the following lp "plans" exist: And the following "core_competency > plans" exist:
| name | user | description | | name | user | description |
| Plan Science-5 | admin | Plan description | | Plan Science-5 | admin | Plan description |
And the following lp "plancompetencies" exist: And the following "core_competency > plan_competency" exist:
| plan | competency | | plan | competency |
| Plan Science-5 | Comp1 | | Plan Science-5 | Comp1 |
| Plan Science-5 | Comp2 | | Plan Science-5 | Comp2 |
And the following lp "usercompetencies" exist: And the following "core_competency > user_competency" exist:
| user | competency | | user | competency |
| admin | Comp1 | | admin | Comp1 |
| admin | Comp2 | | admin | Comp2 |
And I navigate to "Competencies > Competency frameworks" in site administration And I navigate to "Competencies > Competency frameworks" in site administration
And I should see "Science Year-5" And I should see "Science Year-5"
And I click on "Edit" of edit menu in the "Science Year-5" row And I click on "Edit" of edit menu in the "Science Year-5" row
@ -100,24 +100,24 @@ Feature: Manage competency frameworks
And I should see "sc-y-5" And I should see "sc-y-5"
Scenario: Edit a framework with competencies in user competency plan Scenario: Edit a framework with competencies in user competency plan
Given the following lp "frameworks" exist: Given the following "core_competency > frameworks" exist:
| shortname | idnumber | | shortname | idnumber |
| Science Year-6 | sc-y-6 | | Science Year-6 | sc-y-6 |
And the following lp "competencies" exist: And the following "core_competency > competencies" exist:
| shortname | framework | | shortname | competencyframework | idnumber |
| Comp1 | sc-y-6 | | Comp1 | sc-y-6 | Comp1 |
| Comp2 | sc-y-6 | | Comp2 | sc-y-6 | Comp2 |
And the following lp "plans" exist: And the following "core_competency > plans" exist:
| name | user | description | | name | user | description |
| Plan Science-6 | admin | Plan description | | Plan Science-6 | admin | Plan description |
And the following lp "plancompetencies" exist: And the following "core_competency > plan_competency" exist:
| plan | competency | | plan | competency |
| Plan Science-6 | Comp1 | | Plan Science-6 | Comp1 |
| Plan Science-6 | Comp2 | | Plan Science-6 | Comp2 |
And the following lp "usercompetencyplans" exist: And the following "core_competency > user_competency_plans" exist:
| user | competency | plan | | user | competency | plan |
| admin | Comp1 | Plan Science-6 | | admin | Comp1 | Plan Science-6 |
| admin | Comp2 | Plan Science-6 | | admin | Comp2 | Plan Science-6 |
And I navigate to "Competencies > Competency frameworks" in site administration And I navigate to "Competencies > Competency frameworks" in site administration
And I should see "Science Year-6" And I should see "Science Year-6"
And I click on "Edit" of edit menu in the "Science Year-6" row And I click on "Edit" of edit menu in the "Science Year-6" row
@ -130,12 +130,12 @@ Feature: Manage competency frameworks
And I should see "sc-y-6" And I should see "sc-y-6"
Scenario: Duplicate a competency framework Scenario: Duplicate a competency framework
Given the following lp "frameworks" exist: Given the following "core_competency > frameworks" exist:
| shortname | idnumber | | shortname | idnumber |
| CF1 | CF1 | | CF1 | CF1 |
And the following lp "competencies" exist: And the following "core_competency > competencies" exist:
| shortname | framework | | shortname | competencyframework |
| C1 | CF1 | | C1 | CF1 |
And I navigate to "Competencies > Competency frameworks" in site administration And I navigate to "Competencies > Competency frameworks" in site administration
# Duplicate the selected competency framework # Duplicate the selected competency framework
When I click on "Duplicate" of edit menu in the "CF1" row When I click on "Duplicate" of edit menu in the "CF1" row

View file

@ -22,8 +22,8 @@ Feature: Manage plearning plan
And I should see "Science plan" And I should see "Science plan"
Scenario: Create a learning plan based on template Scenario: Create a learning plan based on template
Given the following lp "templates" exist: Given the following "core_competency > templates" exist:
| shortname | description | | shortname | description |
| Science template | science template description | | Science template | science template description |
And I am on homepage And I am on homepage
And I navigate to "Competencies > Learning plan templates" in site administration And I navigate to "Competencies > Learning plan templates" in site administration
@ -36,8 +36,8 @@ Feature: Manage plearning plan
And I should see "Admin User" in the "Science template" "table_row" And I should see "Admin User" in the "Science template" "table_row"
Scenario: Create a learning plan from template cohort Scenario: Create a learning plan from template cohort
Given the following lp "templates" exist: Given the following "core_competency > templates" exist:
| shortname | description | | shortname | description |
| Science template cohort | science template description | | Science template cohort | science template description |
And the following "users" exist: And the following "users" exist:
| username | firstname | lastname | email | | username | firstname | lastname | email |
@ -62,8 +62,8 @@ Feature: Manage plearning plan
And I should see "Student 2" And I should see "Student 2"
Scenario: Read a learning plan Scenario: Read a learning plan
Given the following lp "plans" exist: Given the following "core_competency > plans" exist:
| name | user | description | | name | user | description |
| Science plan Year-1 | admin | science plan description | | Science plan Year-1 | admin | science plan description |
And I follow "Learning plans" And I follow "Learning plans"
And I should see "Science plan Year-1" And I should see "Science plan Year-1"
@ -72,16 +72,16 @@ Feature: Manage plearning plan
And I should see "Learning plan competencies" And I should see "Learning plan competencies"
Scenario: Manage a learning plan competencies Scenario: Manage a learning plan competencies
Given the following lp "plans" exist: Given the following "core_competency > plans" exist:
| name | user | description | | name | user | description |
| Science plan Year-manage | admin | science plan description | | Science plan Year-manage | admin | science plan description |
And the following lp "frameworks" exist: And the following "core_competency > frameworks" exist:
| shortname | idnumber | | shortname | idnumber |
| Framework 1 | sc-y-2 | | Framework 1 | sc-y-2 |
And the following lp "competencies" exist: And the following "core_competency > competencies" exist:
| shortname | framework | | shortname | competencyframework |
| comp1 | sc-y-2 | | comp1 | sc-y-2 |
| comp2 | sc-y-2 | | comp2 | sc-y-2 |
And I follow "Learning plans" And I follow "Learning plans"
And I should see "Science plan Year-manage" And I should see "Science plan Year-manage"
And I follow "Science plan Year-manage" And I follow "Science plan Year-manage"
@ -98,8 +98,8 @@ Feature: Manage plearning plan
And "comp1" "table_row" should not exist And "comp1" "table_row" should not exist
Scenario: Edit a learning plan Scenario: Edit a learning plan
Given the following lp "plans" exist: Given the following "core_competency > plans" exist:
| name | user | description | | name | user | description |
| Science plan Year-2 | admin | science plan description | | Science plan Year-2 | admin | science plan description |
| Science plan Year-3 | admin | science plan description | | Science plan Year-3 | admin | science plan description |
And I follow "Learning plans" And I follow "Learning plans"
@ -113,8 +113,8 @@ Feature: Manage plearning plan
And I should see "Science plan Year-3 Edited" And I should see "Science plan Year-3 Edited"
Scenario: Delete a learning plan Scenario: Delete a learning plan
Given the following lp "plans" exist: Given the following "core_competency > plans" exist:
| name | user | description | | name | user | description |
| Science plan Year-4 | admin | science plan description | | Science plan Year-4 | admin | science plan description |
And I follow "Learning plans" And I follow "Learning plans"
And I should see "Science plan Year-4" And I should see "Science plan Year-4"
@ -130,16 +130,16 @@ Feature: Manage plearning plan
Then I should not see "Science plan Year-4" Then I should not see "Science plan Year-4"
Scenario: See a learning plan from a course Scenario: See a learning plan from a course
Given the following lp "plans" exist: Given the following "core_competency > plans" exist:
| name | user | description | | name | user | description |
| Science plan Year-manage | admin | science plan description | | Science plan Year-manage | admin | science plan description |
And the following lp "frameworks" exist: And the following "core_competency > frameworks" exist:
| shortname | idnumber | | shortname | idnumber |
| Framework 1 | sc-y-2 | | Framework 1 | sc-y-2 |
And the following lp "competencies" exist: And the following "core_competency > competencies" exist:
| shortname | framework | | shortname | competencyframework |
| comp1 | sc-y-2 | | comp1 | sc-y-2 |
| comp2 | sc-y-2 | | comp2 | sc-y-2 |
And I follow "Learning plans" And I follow "Learning plans"
And I should see "Science plan Year-manage" And I should see "Science plan Year-manage"
And I follow "Science plan Year-manage" And I follow "Science plan Year-manage"

View file

@ -31,19 +31,19 @@ Feature: Manage plan workflow
| user1 | usermanageowndraftplan | System | | | user1 | usermanageowndraftplan | System | |
| user2 | usermanageownplan | System | | | user2 | usermanageownplan | System | |
| manager1 | manageplan | System | | | manager1 | manageplan | System | |
And the following lp "frameworks" exist: And the following "core_competency > frameworks" exist:
| shortname | idnumber | | shortname | idnumber |
| Test-Framework | ID-FW1 | | Test-Framework | ID-FW1 |
And the following lp "competencies" exist: And the following "core_competency > competencies" exist:
| shortname | framework | | shortname | competencyframework | idnumber |
| Test-Comp1 | ID-FW1 | | Test-Comp1 | ID-FW1 | Test-Comp1 |
| Test-Comp2 | ID-FW1 | | Test-Comp2 | ID-FW1 | Test-Comp2 |
And the following lp "plans" exist: And the following "core_competency > plans" exist:
| name | user | description | | name | user | description | reviewer | status |
| Test-Plan1 | user1 | Description of plan for user 1 | | Test-Plan1 | user1 | Description of plan for user 1 | user1 | draft |
| Test-Plan2 | user2 | Description of plan for user 2 | | Test-Plan2 | user2 | Description of plan for user 2 | user2 | draft |
And the following lp "plancompetencies" exist: And the following "core_competency > plan_competency" exist:
| plan | competency | | plan | competency |
| Test-Plan1 | Test-Comp1 | | Test-Plan1 | Test-Comp1 |
| Test-Plan1 | Test-Comp2 | | Test-Plan1 | Test-Comp2 |
| Test-Plan2 | Test-Comp1 | | Test-Plan2 | Test-Comp1 |
@ -89,18 +89,18 @@ Feature: Manage plan workflow
And I log out And I log out
Scenario: Manager can see learning plan with status waiting for review Scenario: Manager can see learning plan with status waiting for review
Given the following lp "plans" exist: Given the following "core_competency > plans" exist:
| name | user | description | status | | name | user | description | status |
| Test-Plan3 | user2 | Description of plan 3 for user 1 | waiting for review | | Test-Plan3 | user2 | Description of plan 3 for user 1 | waiting for review |
| Test-Plan4 | user1 | Description of plan 3 for user 1 | draft | | Test-Plan4 | user1 | Description of plan 3 for user 1 | draft |
When I log in as "manager1" When I log in as "manager1"
Then I should see "Test-Plan3" Then I should see "Test-Plan3"
And I should not see "Test-Plan4" And I should not see "Test-Plan4"
And I log out And I log out
Scenario: Manager can start review of learning plan with status waiting for review Scenario: Manager can start review of learning plan with status waiting for review
Given the following lp "plans" exist: Given the following "core_competency > plans" exist:
| name | user | description | status | | name | user | description | status |
| Test-Plan3 | user1 | Description of plan 3 for user 1 | waiting for review | | Test-Plan3 | user1 | Description of plan 3 for user 1 | waiting for review |
And I log in as "manager1" And I log in as "manager1"
And I follow "Test-Plan3" And I follow "Test-Plan3"
@ -111,8 +111,8 @@ Feature: Manage plan workflow
And I log out And I log out
Scenario: Manager can reject a learning plan with status in review Scenario: Manager can reject a learning plan with status in review
Given the following lp "plans" exist: Given the following "core_competency > plans" exist:
| name | user | description | status | reviewer | | name | user | description | status | reviewer |
| Test-Plan3 | user1 | Description of plan 3 for user 1 | in review | manager1 | | Test-Plan3 | user1 | Description of plan 3 for user 1 | in review | manager1 |
And I log in as "manager1" And I log in as "manager1"
And I follow "Test-Plan3" And I follow "Test-Plan3"
@ -124,8 +124,8 @@ Feature: Manage plan workflow
And I log out And I log out
Scenario: Manager can accept a learning plan with status in review Scenario: Manager can accept a learning plan with status in review
Given the following lp "plans" exist: Given the following "core_competency > plans" exist:
| name | user | description | status | reviewer | | name | user | description | status | reviewer |
| Test-Plan3 | user1 | Description of plan 3 for user 1 | in review | manager1 | | Test-Plan3 | user1 | Description of plan 3 for user 1 | in review | manager1 |
And I log in as "manager1" And I log in as "manager1"
And I follow "Test-Plan3" And I follow "Test-Plan3"
@ -137,8 +137,8 @@ Feature: Manage plan workflow
And I log out And I log out
Scenario: Manager send back to draft an active learning plan Scenario: Manager send back to draft an active learning plan
Given the following lp "plans" exist: Given the following "core_competency > plans" exist:
| name | user | description | status | reviewer | | name | user | description | status | reviewer |
| Test-Plan3 | user1 | Description of plan 3 for user 1 | active | manager1 | | Test-Plan3 | user1 | Description of plan 3 for user 1 | active | manager1 |
| Test-Plan4 | user1 | Description of plan 4 for user 1 | active | manager1 | | Test-Plan4 | user1 | Description of plan 4 for user 1 | active | manager1 |
And I am on the "user1" "user > profile" page logged in as "manager1" And I am on the "user1" "user > profile" page logged in as "manager1"
@ -153,8 +153,8 @@ Feature: Manage plan workflow
And I log out And I log out
Scenario: Manager change an active learning plan to completed Scenario: Manager change an active learning plan to completed
Given the following lp "plans" exist: Given the following "core_competency > plans" exist:
| name | user | description | status | reviewer | | name | user | description | status | reviewer |
| Test-Plan3 | user1 | Description of plan 3 for user 1 | active | manager1 | | Test-Plan3 | user1 | Description of plan 3 for user 1 | active | manager1 |
| Test-Plan4 | user1 | Description of plan 4 for user 1 | active | manager1 | | Test-Plan4 | user1 | Description of plan 4 for user 1 | active | manager1 |
And I am on the "user1" "user > profile" page logged in as "manager1" And I am on the "user1" "user > profile" page logged in as "manager1"
@ -172,8 +172,8 @@ Feature: Manage plan workflow
And I log out And I log out
Scenario: Manager reopen a complete learning plan Scenario: Manager reopen a complete learning plan
Given the following lp "plans" exist: Given the following "core_competency > plans" exist:
| name | user | description | status | reviewer | | name | user | description | status | reviewer |
| Test-Plan3 | user1 | Description of plan 3 for user 1 | complete | manager1 | | Test-Plan3 | user1 | Description of plan 3 for user 1 | complete | manager1 |
| Test-Plan4 | user1 | Description of plan 4 for user 1 | complete | manager1 | | Test-Plan4 | user1 | Description of plan 4 for user 1 | complete | manager1 |
And I am on the "user1" "user > profile" page logged in as "manager1" And I am on the "user1" "user > profile" page logged in as "manager1"

View file

@ -21,8 +21,8 @@ Feature: Manage plearning plan templates
And I should see "Science template" And I should see "Science template"
Scenario: Read a learning plan template Scenario: Read a learning plan template
Given the following lp "templates" exist: Given the following "core_competency > templates" exist:
| shortname | description | | shortname | description |
| Science template Year-2 | science template description | | Science template Year-2 | science template description |
And I navigate to "Competencies > Learning plan templates" in site administration And I navigate to "Competencies > Learning plan templates" in site administration
And I should see "Science template Year-2" And I should see "Science template Year-2"
@ -31,8 +31,8 @@ Feature: Manage plearning plan templates
And I should see "Learning plan template competencies" And I should see "Learning plan template competencies"
Scenario: Edit a learning plan template Scenario: Edit a learning plan template
Given the following lp "templates" exist: Given the following "core_competency > templates" exist:
| shortname | description | | shortname | description |
| Science template Year-3 | science template description | | Science template Year-3 | science template description |
And I navigate to "Competencies > Learning plan templates" in site administration And I navigate to "Competencies > Learning plan templates" in site administration
And I should see "Science template Year-3" And I should see "Science template Year-3"
@ -44,8 +44,8 @@ Feature: Manage plearning plan templates
And I should see "Science template Year-3 Edited" And I should see "Science template Year-3 Edited"
Scenario: Delete a learning plan template Scenario: Delete a learning plan template
Given the following lp "templates" exist: Given the following "core_competency > templates" exist:
| shortname | description | | shortname | description |
| Science template Year-4 | science template description | | Science template Year-4 | science template description |
And I navigate to "Competencies > Learning plan templates" in site administration And I navigate to "Competencies > Learning plan templates" in site administration
And I should see "Science template Year-4" And I should see "Science template Year-4"

View file

@ -5,22 +5,22 @@ Feature: Manage competencies linked to evidence of prior learning
I need to link and unlink competencies from evidence of prior learning I need to link and unlink competencies from evidence of prior learning
Background: Background:
Given the following lp "frameworks" exist: Given the following "core_competency > frameworks" exist:
| shortname | idnumber | | shortname | idnumber |
| Test-Framework | ID-FW1 | | Test-Framework | ID-FW1 |
And the following lp "competencies" exist: And the following "core_competency > competencies" exist:
| shortname | framework | | shortname | competencyframework | idnumber |
| Test-Comp1 | ID-FW1 | | Test-Comp1 | ID-FW1 | Test-Comp1 |
| Test-Comp2 | ID-FW1 | | Test-Comp2 | ID-FW1 | Test-Comp2 |
And the following lp "plans" exist: And the following "core_competency > plans" exist:
| name | user | description | | name | user | description |
| Test-Plan | admin | Plan description | | Test-Plan | admin | Plan description |
And the following lp "plancompetencies" exist: And the following "core_competency > plan_competency" exist:
| plan | competency | | plan | competency |
| Test-Plan | Test-Comp1 | | Test-Plan | Test-Comp1 |
| Test-Plan | Test-Comp2 | | Test-Plan | Test-Comp2 |
And the following lp "userevidence" exist: And the following "core_competency > user_evidence" exist:
| name | description | user | | name | description | user |
| Test-Evidence | Description evidence | admin | | Test-Evidence | Description evidence | admin |
When I log in as "admin" When I log in as "admin"
And I follow "Profile" in the user menu And I follow "Profile" in the user menu
@ -51,12 +51,12 @@ Feature: Manage competencies linked to evidence of prior learning
Then "Test-Comp2" "table_row" should exist Then "Test-Comp2" "table_row" should exist
Scenario: Unlink competency from evidence of prior learning Scenario: Unlink competency from evidence of prior learning
Given the following lp "userevidencecompetencies" exist: Given the following "core_competency > user_evidence_competency" exist:
| userevidence | competency | | userevidence | competency |
| Test-Evidence | Test-Comp1 | | Test-Evidence | Test-Comp1 |
| Test-Evidence | Test-Comp2 | | Test-Evidence | Test-Comp2 |
Given the following lp "usercompetencies" exist: And the following "core_competency > user_competency" exist:
| user | competency | | user | competency |
| admin | Test-Comp1 | | admin | Test-Comp1 |
| admin | Test-Comp2 | | admin | Test-Comp2 |
And I follow "Evidence of prior learning" And I follow "Evidence of prior learning"

View file

@ -24,8 +24,8 @@ Feature: Manage evidence of prior learning
And I should see "Evidence-1" And I should see "Evidence-1"
Scenario: Read an evidence of prior learning Scenario: Read an evidence of prior learning
Given the following lp "userevidence" exist: Given the following "core_competency > user_evidence" exist:
| name | description | user | | name | description | user |
| Evidence-2 | Evidence-2 description | user1 | | Evidence-2 | Evidence-2 description | user1 |
And I follow "Evidence of prior learning" And I follow "Evidence of prior learning"
And I should see "List of evidence" And I should see "List of evidence"
@ -34,8 +34,8 @@ Feature: Manage evidence of prior learning
Then I should see "Evidence-2" Then I should see "Evidence-2"
Scenario: Edit an evidence of prior learning Scenario: Edit an evidence of prior learning
Given the following lp "userevidence" exist: Given the following "core_competency > user_evidence" exist:
| name | description | user | | name | description | user |
| Evidence-3 | Evidence-3 description | user1 | | Evidence-3 | Evidence-3 description | user1 |
And I follow "Evidence of prior learning" And I follow "Evidence of prior learning"
And I should see "List of evidence" And I should see "List of evidence"
@ -47,8 +47,8 @@ Feature: Manage evidence of prior learning
And I should see "Evidence-3 Edited" And I should see "Evidence-3 Edited"
Scenario: Delete an evidence of prior learning Scenario: Delete an evidence of prior learning
Given the following lp "userevidence" exist: Given the following "core_competency > user_evidence" exist:
| name | description | user | | name | description | user |
| Evidence-4 | Evidence-4 description | user1 | | Evidence-4 | Evidence-4 description | user1 |
And I follow "Evidence of prior learning" And I follow "Evidence of prior learning"
And I should see "List of evidence" And I should see "List of evidence"
@ -62,10 +62,10 @@ Feature: Manage evidence of prior learning
Scenario: List evidences of prior learning Scenario: List evidences of prior learning
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username | firstname | lastname | email |
|user2 | User | 2 | user2@example.com | | user2 | User | 2 | user2@example.com |
And the following lp "userevidence" exist: And the following "core_competency > user_evidence" exist:
| name | description | user | | name | description | user |
| Evidence-5 | Evidence-5 description | user1 | | Evidence-5 | Evidence-5 description | user1 |
| Evidence-6 | Evidence-6 description | user2 | | Evidence-6 | Evidence-6 description | user2 |
And I follow "Evidence of prior learning" And I follow "Evidence of prior learning"

View file

@ -40,9 +40,9 @@ Feature: View competencies
| competency | relatedcompetency | | competency | relatedcompetency |
| desserts | cakes | | desserts | cakes |
And the following "core_competency > plans" exist: And the following "core_competency > plans" exist:
| name | description | competencies | user | | name | description | competencies | user | status |
| Cookery | Cookery is important | salads, desserts, cakes | student1 | | Cookery | Cookery is important | salads, desserts, cakes | student1 | active |
| Literacy | Literacy is important | reading, writing | student1 | | Literacy | Literacy is important | reading, writing | student1 | active |
And the following "core_competency > course_competencies" exist: And the following "core_competency > course_competencies" exist:
| course | competency | | course | competency |
| C1 | salads | | C1 | salads |

View file

@ -14,13 +14,13 @@ Feature: Award badges based on competency completion
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| user1 | C1 | student | | user1 | C1 | student |
And the following lp "frameworks" exist: And the following "core_competency > frameworks" exist:
| shortname | idnumber | | shortname | idnumber |
| Framework 1 | sc-y-2 | | Framework 1 | sc-y-2 |
And the following lp "competencies" exist: And the following "core_competency > competencies" exist:
| shortname | framework | | shortname | competencyframework |
| comp1 | sc-y-2 | | comp1 | sc-y-2 |
| comp2 | sc-y-2 | | comp2 | sc-y-2 |
And I log in as "admin" And I log in as "admin"
@javascript @javascript

View file

@ -57,7 +57,13 @@ class behat_core_competency_generator extends behat_generator_base {
'singular' => 'plan', 'singular' => 'plan',
'datagenerator' => 'plan', 'datagenerator' => 'plan',
'required' => ['name'], 'required' => ['name'],
'switchids' => ['user' => 'userid'], 'switchids' => ['user' => 'userid', 'status' => 'status'],
],
'plan_competencies' => [
'singular' => 'plan_competency',
'datagenerator' => 'plan_competency',
'required' => ['plan', 'competency'],
'switchids' => ['competency' => 'competencyid', 'plan' => 'planid'],
], ],
'related_competencies' => [ 'related_competencies' => [
'singular' => 'related_competency', 'singular' => 'related_competency',
@ -83,14 +89,32 @@ class behat_core_competency_generator extends behat_generator_base {
'required' => ['plan', 'competency', 'user'], 'required' => ['plan', 'competency', 'user'],
'switchids' => ['plan' => 'planid', 'competency' => 'competencyid', 'user' => 'userid'], 'switchids' => ['plan' => 'planid', 'competency' => 'competencyid', 'user' => 'userid'],
], ],
'user_evidence' => [
'singular' => 'user_evidence',
'datagenerator' => 'user_evidence',
'required' => ['user', 'name'],
'switchids' => ['user' => 'userid'],
],
'user_evidence_competency' => [
'singular' => 'user_evidence_competency',
'datagenerator' => 'user_evidence_competency',
'required' => ['userevidence', 'competency'],
'switchids' => ['userevidence' => 'userevidenceid', 'competency' => 'competencyid'],
],
'templates' => [
'singular' => 'template',
'datagenerator' => 'template',
'required' => ['shortname'],
'switchids' => ['context' => 'contextid'],
],
]; ];
} }
/** /**
* Get the competecy framework id using an idnumber. * Get the competency framework id using an idnumber.
* *
* @param string $idnumber * @param string $idnumber
* @return int The competecy framework id * @return int The competency framework id
*/ */
protected function get_competencyframework_id(string $idnumber): int { protected function get_competencyframework_id(string $idnumber): int {
global $DB; global $DB;
@ -103,10 +127,10 @@ class behat_core_competency_generator extends behat_generator_base {
} }
/** /**
* Get the competecy id using an idnumber. * Get the competency id using an idnumber.
* *
* @param string $idnumber * @param string $idnumber
* @return int The competecy id * @return int The competency id
*/ */
protected function get_competency_id(string $idnumber): int { protected function get_competency_id(string $idnumber): int {
global $DB; global $DB;
@ -135,10 +159,10 @@ class behat_core_competency_generator extends behat_generator_base {
} }
/** /**
* Get the related competecy id using an idnumber. * Get the related competency id using an idnumber.
* *
* @param string $idnumber * @param string $idnumber
* @return int The related competecy id * @return int The related competency id
*/ */
protected function get_relatedcompetency_id(string $idnumber): int { protected function get_relatedcompetency_id(string $idnumber): int {
return $this->get_competency_id($idnumber); return $this->get_competency_id($idnumber);
@ -208,6 +232,8 @@ class behat_core_competency_generator extends behat_generator_base {
* @return array Processed data. * @return array Processed data.
*/ */
protected function preprocess_plan(array $data): array { protected function preprocess_plan(array $data): array {
global $DB, $USER;
if (isset($data['competencies'])) { if (isset($data['competencies'])) {
$competencies = array_map('trim', str_getcsv($data['competencies'], escape: '\\')); $competencies = array_map('trim', str_getcsv($data['competencies'], escape: '\\'));
$data['competencyids'] = array_map([$this, 'get_competency_id'], $competencies); $data['competencyids'] = array_map([$this, 'get_competency_id'], $competencies);
@ -215,11 +241,20 @@ class behat_core_competency_generator extends behat_generator_base {
unset($data['competencies']); unset($data['competencies']);
} }
global $USER; if (isset($data['reviewer'])) {
if (is_number($data['reviewer'])) {
$data['reviewerid'] = $data['reviewer'];
} else {
if (!$userid = $DB->get_field('user', 'id', ['username' => $data['reviewer']])) {
throw new Exception('The specified user "' . $data['reviewer'] . '" could not be found.');
}
$data['reviewerid'] = $userid;
}
unset($data['reviewer']);
}
return $data + [ return $data + [
'userid' => $USER->id, 'userid' => $USER->id,
'status' => plan::STATUS_ACTIVE,
]; ];
} }
@ -258,4 +293,81 @@ class behat_core_competency_generator extends behat_generator_base {
protected function get_data_generator(): core_competency_generator { protected function get_data_generator(): core_competency_generator {
return $this->componentdatagenerator; return $this->componentdatagenerator;
} }
/**
* Get the user evidence id using a name.
*
* @param string $name User evidence name.
* @return int The user evidence id
*/
protected function get_userevidence_id(string $name): int {
global $DB;
if (!$id = $DB->get_field('competency_userevidence', 'id', ['name' => $name])) {
throw new Exception('The specified user evidence with name "' . $name . '" could not be found.');
}
return $id;
}
/**
* Get the template competency id using a name.
*
* @param string $name Template competency name.
* @return int The template competency id
*/
protected function get_templatecompetency_id(string $name): int {
global $DB;
if (!$id = $DB->get_field('competency_template', 'id', ['name' => $name])) {
throw new Exception('The specified template competency with name "' . $name . '" could not be found.');
}
return $id;
}
/**
* Get the context id using a contextid.
*
* @param string $contextid Context id.
* @return int The context id
*/
protected function get_context_id(string $contextid): int {
global $DB;
if (!$id = $DB->get_field('context', 'id', ['id' => $contextid])) {
throw new Exception('The specified context with id "' . $contextid . '" could not be found.');
}
return $id;
}
/**
* Get the status id by status name.
*
* @param string $name Status name.
* @return int
*/
protected function get_status_id(string $name): int {
switch ($name) {
case 'draft':
$status = plan::STATUS_DRAFT;
break;
case 'in review':
$status = plan::STATUS_IN_REVIEW;
break;
case 'waiting for review':
$status = plan::STATUS_WAITING_FOR_REVIEW;
break;
case 'complete':
$status = plan::STATUS_COMPLETE;
break;
default:
$status = plan::STATUS_ACTIVE;
break;
}
return $status;
}
} }

View file

@ -5,13 +5,13 @@ Feature: See the competencies for an activity
I need to see the competencies linked to one activity in the breakdown report. I need to see the competencies linked to one activity in the breakdown report.
Background: Background:
Given the following lp "frameworks" exist: Given the following "core_competency > frameworks" exist:
| shortname | idnumber | | shortname | idnumber |
| Test-Framework | ID-FW1 | | Test-Framework | ID-FW1 |
And the following lp "competencies" exist: And the following "core_competency > competencies" exist:
| shortname | framework | | shortname | competencyframework |
| Test-Comp1 | ID-FW1 | | Test-Comp1 | ID-FW1 |
| Test-Comp2 | ID-FW1 | | Test-Comp2 | ID-FW1 |
Given the following "courses" exist: Given the following "courses" exist:
| shortname | fullname | | shortname | fullname |
| C1 | Course 1 | | C1 | Course 1 |