Skip to content

Commit 8a1c400

Browse files
committed
Fixed verification error when expiry date element is present (#647)
1 parent 4425055 commit 8a1c400

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

classes/output/verify_certificate_result.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ class verify_certificate_result implements templatable, renderable {
6262
public string $certificatename;
6363

6464
/**
65-
* @var int|null The certificate's expiry date (optional).
65+
* @var string|null The certificate's expiry date (optional).
6666
*/
67-
public ?int $expiry;
67+
public ?string $expiry;
6868

6969
/**
7070
* Constructor.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
@mod @mod_customcert
2+
Feature: Being able to verify a certificate with an expiry element
3+
In order to ensure expiry elements are working as expected
4+
As a teacher
5+
I need to verify a certificate with an expiry element
6+
7+
Background:
8+
Given the following "courses" exist:
9+
| fullname | shortname | category |
10+
| Course 1 | C1 | 0 |
11+
And the following "users" exist:
12+
| username | firstname | lastname | email |
13+
| teacher1 | Teacher | 1 | teacher1@example.com |
14+
| student1 | Student | 1 | student1@example.com |
15+
And the following "course enrolments" exist:
16+
| user | course | role |
17+
| teacher1 | C1 | editingteacher |
18+
| student1 | C1 | student |
19+
And the following "activities" exist:
20+
| activity | name | intro | course | idnumber | verifyany |
21+
| customcert | Custom certificate 1 | Custom certificate 1 intro | C1 | customcert1 | 0 |
22+
And I log in as "teacher1"
23+
And I am on "Course 1" course homepage
24+
And I follow "Custom certificate 1"
25+
And I navigate to "Edit certificate" in current page administration
26+
And I add the element "Code" to page "1" of the "Custom certificate 1" certificate template
27+
And I set the following fields to these values:
28+
| Font | Helvetica |
29+
| Size | 20 |
30+
| Colour | #045ECD |
31+
| Width | 20 |
32+
| Reference point location | Top left |
33+
And I press "Save changes"
34+
And I add the element "Expiry" to page "1" of the "Custom certificate 1" certificate template
35+
And I set the following fields to these values:
36+
| Date item | Expiry date (1 year) |
37+
| Date format | 2 |
38+
| Start date | award |
39+
| Font | Helvetica |
40+
| Size | 20 |
41+
| Colour | #045ECD |
42+
| Width | 20 |
43+
| Reference point location | Top left |
44+
And I press "Save changes"
45+
46+
Scenario: Verify a certificate with an expiry element
47+
Given I log in as "student1"
48+
And I am on "Course 1" course homepage
49+
When I follow "Custom certificate 1"
50+
And I press "View certificate"
51+
And I log out
52+
And I log in as "teacher1"
53+
And I visit the verification url for the "Custom certificate 1" certificate
54+
Then I verify the "Custom certificate 1" certificate for the user "student1"

0 commit comments

Comments
 (0)