MDL-75275 mod_data: Add ##actionsmenu## action tag

This commit is contained in:
Sara Arjona
2022-08-19 08:38:33 +02:00
parent fd1b874449
commit 2acda39537
8 changed files with 638 additions and 1 deletions
+146
View File
@@ -191,11 +191,41 @@ class template_test extends \advanced_testcase {
'templatecontent' => 'Some ##more## tag',
'expected' => '|Some .*more.*{cmid}.*rid.*{entryid}.*More.* tag|',
'rolename' => 'editingteacher',
'enableexport' => false,
'approved' => true,
'enablecomments' => false,
'enableratings' => false,
'options' => ['showmore' => true],
],
'Teacher more tag with showmore set to false' => [
'templatecontent' => 'Some ##more## tag',
'expected' => '|Some tag|',
'rolename' => 'editingteacher',
'enableexport' => false,
'approved' => true,
'enablecomments' => false,
'enableratings' => false,
'options' => ['showmore' => false],
],
'Teacher moreurl tag' => [
'templatecontent' => 'Some ##moreurl## tag',
'expected' => '|Some .*/mod/data/view.*{cmid}.*rid.*{entryid}.* tag|',
'rolename' => 'editingteacher',
'enableexport' => false,
'approved' => true,
'enablecomments' => false,
'enableratings' => false,
'options' => ['showmore' => true],
],
'Teacher moreurl tag with showmore set to false' => [
'templatecontent' => 'Some ##moreurl## tag',
'expected' => '|Some .*/mod/data/view.*{cmid}.*rid.*{entryid}.* tag|',
'rolename' => 'editingteacher',
'enableexport' => false,
'approved' => true,
'enablecomments' => false,
'enableratings' => false,
'options' => ['showmore' => false],
],
'Teacher delcheck tag' => [
'templatecontent' => 'Some ##delcheck## tag',
@@ -361,6 +391,49 @@ class template_test extends \advanced_testcase {
'enableratings' => true,
'options' => ['ratings' => true],
],
'Teacher actionsmenu tag with default options' => [
'templatecontent' => 'Some ##actionsmenu## tag',
'expected' => '|Some .*edit.*{entryid}.*sesskey.*Edit.* .*delete.*{entryid}.*sesskey.*Delete.* tag|',
'rolename' => 'editingteacher',
],
'Teacher actionsmenu tag with default options (check Show more is not there)' => [
'templatecontent' => 'Some ##actionsmenu## tag',
'expected' => '|^Some((?!Show more).)*tag$|',
'rolename' => 'editingteacher',
],
'Teacher actionsmenu tag with show more enabled' => [
'templatecontent' => 'Some ##actionsmenu## tag',
'expected' => '|Some .*view.*{cmid}.*rid.*{entryid}.*Show more.* .*Edit.* .*Delete.* tag|',
'rolename' => 'editingteacher',
'enableexport' => false,
'approved' => false,
'enablecomments' => false,
'enableratings' => false,
'options' => ['showmore' => true],
],
'Teacher actionsmenu tag with export enabled' => [
'templatecontent' => 'Some ##actionsmenu## tag',
'expected' => '|Some .*Edit.* .*Delete.* .*portfolio/add.* tag|',
'rolename' => 'editingteacher',
'enableexport' => true,
],
'Teacher actionsmenu tag with approved enabled' => [
'templatecontent' => 'Some ##actionsmenu## tag',
'expected' => '|Some .*Edit.* .*Delete.* .*disapprove.*{entryid}.*sesskey.*Undo approval.* tag|',
'rolename' => 'editingteacher',
'enableexport' => false,
'approved' => true,
],
'Teacher actionsmenu tag with export, approved and showmore enabled' => [
'templatecontent' => 'Some ##actionsmenu## tag',
'expected' => '|Some .*Show more.* .*Edit.* .*Delete.* .*Undo approval.* .*Export to portfolio.* tag|',
'rolename' => 'editingteacher',
'enableexport' => true,
'approved' => true,
'enablecomments' => false,
'enableratings' => false,
'options' => ['showmore' => true],
],
// Student scenarios.
'Student id tag' => [
'templatecontent' => 'Some ##id## tag',
@@ -403,11 +476,41 @@ class template_test extends \advanced_testcase {
'templatecontent' => 'Some ##more## tag',
'expected' => '|Some .*more.*{cmid}.*rid.*{entryid}.*More.* tag|',
'rolename' => 'student',
'enableexport' => false,
'approved' => true,
'enablecomments' => false,
'enableratings' => false,
'options' => ['showmore' => true],
],
'Student more tag with showmore set to false' => [
'templatecontent' => 'Some ##more## tag',
'expected' => '|Some tag|',
'rolename' => 'student',
'enableexport' => false,
'approved' => true,
'enablecomments' => false,
'enableratings' => false,
'options' => ['showmore' => false],
],
'Student moreurl tag' => [
'templatecontent' => 'Some ##moreurl## tag',
'expected' => '|Some .*/mod/data/view.*{cmid}.*rid.*{entryid}.* tag|',
'rolename' => 'student',
'enableexport' => false,
'approved' => true,
'enablecomments' => false,
'enableratings' => false,
'options' => ['showmore' => true],
],
'Student moreurl tag with showmore set to false' => [
'templatecontent' => 'Some ##moreurl## tag',
'expected' => '|Some .*/mod/data/view.*{cmid}.*rid.*{entryid}.* tag|',
'rolename' => 'student',
'enableexport' => false,
'approved' => true,
'enablecomments' => false,
'enableratings' => false,
'options' => ['showmore' => false],
],
'Student delcheck tag' => [
'templatecontent' => 'Some ##delcheck## tag',
@@ -584,6 +687,49 @@ class template_test extends \advanced_testcase {
'enableratings' => true,
'options' => ['ratings' => true]
],
'Student actionsmenu tag with default options' => [
'templatecontent' => 'Some ##actionsmenu## tag',
'expected' => '|Some .*edit.*{entryid}.*sesskey.*Edit.* .*delete.*{entryid}.*sesskey.*Delete.* tag|',
'rolename' => 'student',
],
'Student actionsmenu tag with default options (check Show more is not there)' => [
'templatecontent' => 'Some ##actionsmenu## tag',
'expected' => '|^Some((?!Show more).)*tag$|',
'rolename' => 'student',
],
'Student actionsmenu tag with show more enabled' => [
'templatecontent' => 'Some ##actionsmenu## tag',
'expected' => '|Some .*view.*{cmid}.*rid.*{entryid}.*Show more.* .*Edit.* .*Delete.* tag|',
'rolename' => 'student',
'enableexport' => false,
'approved' => false,
'enablecomments' => false,
'enableratings' => false,
'options' => ['showmore' => true],
],
'Student actionsmenu tag with export enabled' => [
'templatecontent' => 'Some ##actionsmenu## tag',
'expected' => '|Some .*Edit.* .*Delete.* .*portfolio/add.* tag|',
'rolename' => 'student',
'enableexport' => true,
],
'Student actionsmenu tag with approved enabled' => [
'templatecontent' => 'Some ##actionsmenu## tag',
'expected' => '|^Some((?!Approve).)*tag$|',
'rolename' => 'student',
'enableexport' => false,
'approved' => true,
],
'Student actionsmenu tag with export, approved and showmore enabled' => [
'templatecontent' => 'Some ##actionsmenu## tag',
'expected' => '|Some .*Show more.* .*Edit.* .*Delete.* .*Export to portfolio.* tag|',
'rolename' => 'student',
'enableexport' => true,
'approved' => true,
'enablecomments' => false,
'enableratings' => false,
'options' => ['showmore' => true],
],
];
}