Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-83904

Add namespace to badges/classes/observer.php

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 5.0
    • Badges
    • MOODLE_500_STABLE
    • MDL-83904-master
    • Hide

      Test 1: Course Module Completion Event

      1. Log in as Admin
      2. Create a new course (Site administration > Courses > Add a new course) with starting date in the past.
        1. Name: "Module Completion Test"
        2. Enable completion tracking under Course completion settings
      3. Add a Page activity to the course
        1. Set completion tracking to "Add requirements"
        2. Select "View activity"
      4. Create a new course badge
        1. Go to Course administration > Badges > Add a new badge
        2. Fill in the required fields and upload an image
        3. For Criteria, select "Activity completion" and choose the Page activity
        4. Enable the badge
      5. Create a student account and enroll them in the course
      6. Log in as the student
      7. Access the Page activity
      8. Run cron or wait for it to run automatically
      9. Go to the student's profile > Badges
      10. Verify that the badge has been awarded

      Test 2: Badge Awarded Event

      1. Log in as Admin
      2. Create two site badges:
        1. First badge: "Badge A"
          1. For Criteria, select something simple like "Profile completion"
          2. Enable the badge
        2. Second badge: "Meta Badge"
          1. For Criteria, select "Awarded badges" and choose "Badge A"
          2. Enable the badge
      3. Log in as a student
      4. Complete your profile information to earn Badge A
      5. Run cron as admin or wait for it to run automatically
      6. Check your Badges page as student
      7. Verify that both Badge A and the Meta Badge were awarded

      Test 3: Course Completion Event

      1. Log in as Admin
      2. Create a new course (Site administration > Courses > Add a new course)
        1. Name: "Course Completion Test"
        2. Enable completion tracking
      3. Set up course completion criteria:
        1. Go to Course administration > Course completion
        2. Set simple criteria like "Enrolment in this course"
        3. Save changes
      4. Create a site badge:
        1. Go to Site administration > Badges > Add a new badge
        2. For Criteria, select "Completing a set of courses" and choose your test course
        3. Enable the badge
      5. Enroll a student in the course
        1. Run cron or wait for it to run automatically
        2. Log in as the student and check their Badges page
        3. Verify that the badge has been awarded

      Test 4: Cohort Member Added Event

      1. Log in as Admin
      2. Create a cohort:
        1. Go to Site administration > Users > Cohorts
        2. Add a new cohort called "Test Cohort"
      3. Create a site badge:
        1. Go to Site administration > Badges > Add a new badge
        2. For Criteria, select "Cohort membership" and choose "Test Cohort"
        3. Enable the badge
      4. Create a student account (or use an existing one)
      5. Add the student to the cohort:
        1. Go to the cohort page
        2. Click on "Assign" to add the student
      6. Run cron or wait for it to run automatically
      7. Log in as the student
      8. Go to your Badges page
      9. Verify that the badge has been awarded

      Test 5: Competency Evidence Created Event

      1. Log in as Admin
      2. Ensure competencies are enabled at Site administration > Competencies
      3. Create a competency framework:
        1. Go to Site administration > Competencies > Competency frameworks
        2. Add a new competency framework
        3. Add at least one competency to the framework
      4. Create a site badge:
        1. Go to Site administration > Badges > Add a new badge
        2. For Criteria, select "Competencies" and choose your competency
        3. Enable the badge
      5. Create a learning plan template:
        1. Go to Site administration > Competencies > Learning plan templates
        2. Add a new template
        3. Add your competency to the template
      6. Create a student account (or use an existing one)
      7. Create a learning plan for the student:
        1. Go to the student's profile > Learning plans
        2. Create a new plan from your template
      8. As Admin, rate the student's competency as proficient:
        1. Go to the student's learning plan
        2. Rate the competency
      9. Run cron or wait for it to run automatically 
      10. Log in as the student
      11. Go to your Badges page
      12. Verify that the badge has been awarded
         
      Show
      Test 1: Course Module Completion Event Log in as Admin Create a new course (Site administration > Courses > Add a new course) with starting date in the past. Name: "Module Completion Test" Enable completion tracking under Course completion settings Add a Page activity to the course Set completion tracking to "Add requirements" Select "View activity" Create a new course badge Go to Course administration > Badges > Add a new badge Fill in the required fields and upload an image For Criteria, select "Activity completion" and choose the Page activity Enable the badge Create a student account and enroll them in the course Log in as the student Access the Page activity Run cron or wait for it to run automatically Go to the student's profile > Badges Verify that the badge has been awarded Test 2: Badge Awarded Event Log in as Admin Create two site badges: First badge: "Badge A" For Criteria, select something simple like "Profile completion" Enable the badge Second badge: "Meta Badge" For Criteria, select "Awarded badges" and choose "Badge A" Enable the badge Log in as a student Complete your profile information to earn Badge A Run cron as admin or wait for it to run automatically Check your Badges page as student Verify that both Badge A and the Meta Badge were awarded Test 3: Course Completion Event Log in as Admin Create a new course (Site administration > Courses > Add a new course) Name: "Course Completion Test" Enable completion tracking Set up course completion criteria: Go to Course administration > Course completion Set simple criteria like "Enrolment in this course" Save changes Create a site badge: Go to Site administration > Badges > Add a new badge For Criteria, select "Completing a set of courses" and choose your test course Enable the badge Enroll a student in the course Run cron or wait for it to run automatically Log in as the student and check their Badges page Verify that the badge has been awarded Test 4: Cohort Member Added Event Log in as Admin Create a cohort: Go to Site administration > Users > Cohorts Add a new cohort called "Test Cohort" Create a site badge: Go to Site administration > Badges > Add a new badge For Criteria, select "Cohort membership" and choose "Test Cohort" Enable the badge Create a student account (or use an existing one) Add the student to the cohort: Go to the cohort page Click on "Assign" to add the student Run cron or wait for it to run automatically Log in as the student Go to your Badges page Verify that the badge has been awarded Test 5: Competency Evidence Created Event Log in as Admin Ensure competencies are enabled at Site administration > Competencies Create a competency framework: Go to Site administration > Competencies > Competency frameworks Add a new competency framework Add at least one competency to the framework Create a site badge: Go to Site administration > Badges > Add a new badge For Criteria, select "Competencies" and choose your competency Enable the badge Create a learning plan template: Go to Site administration > Competencies > Learning plan templates Add a new template Add your competency to the template Create a student account (or use an existing one) Create a learning plan for the student: Go to the student's profile > Learning plans Create a new plan from your template As Admin, rate the student's competency as proficient: Go to the student's learning plan Rate the competency Run cron or wait for it to run automatically  Log in as the student Go to your Badges page Verify that the badge has been awarded  
    • Hide

      Code verified against automated checks.

      Checked MDL-83904 using repository: https://github.com/ngtrdai/moodle

      More information about this report

      Built on: Tue Mar 25 01:36:27 UTC 2025

      Show
      Code verified against automated checks. Checked MDL-83904 using repository: https://github.com/ngtrdai/moodle main (0 errors / 0 warnings) [branch: MDL-83904-master | CI Job ] More information about this report Built on: Tue Mar 25 01:36:27 UTC 2025
    • Show
      Launching automatic jobs for branch MDL-83904 -master https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/19691/ PHPUnit (sqlsrv) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/67331/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/67332/ Behat (Firefox - boost) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/67333/ Behat (Firefox - classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/67334/ App tests (stable app version) Built on: Fri Jun 13 08:30:30 UTC 2025
    • 2
    • C->HQ 2025 Sprint I2.2 Moppies

      Apart from adding the namespace, evaluate if it's also worth it to move it to badges/classes/event/observer.php.

            ngtrdai Dai Nguyen Trong
            sarjona Sara Arjona (@sarjona)
            Amaia Anabitarte Amaia Anabitarte
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.