Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-tool_lifecycle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-tool_lifecycle
Commits
73e3ce92
Unverified
Commit
73e3ce92
authored
6 years ago
by
Tobias Reischmann
Browse files
Options
Downloads
Patches
Plain Diff
Fix startdatedelay trigger to consider wheresql
parent
84e41d5b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
trigger/startdatedelay/tests/trigger_test.php
+23
-9
23 additions, 9 deletions
trigger/startdatedelay/tests/trigger_test.php
with
23 additions
and
9 deletions
trigger/startdatedelay/tests/trigger_test.php
+
23
−
9
View file @
73e3ce92
...
...
@@ -16,7 +16,7 @@
namespace
tool_lifecycle\trigger
;
use
tool_lifecycle\
response\trigger_response
;
use
tool_lifecycle
\
processor
;
defined
(
'MOODLE_INTERNAL'
)
||
die
();
...
...
@@ -36,10 +36,14 @@ class tool_lifecycle_trigger_startdatedelay_testcase extends \advanced_testcase
private
$triggerinstance
;
/**@var processor Instance of the lifecycle processor */
private
$processor
;
public
function
setUp
()
{
$this
->
resetAfterTest
(
true
);
$this
->
setAdminUser
();
$this
->
processor
=
new
processor
();
$this
->
triggerinstance
=
\tool_lifecycle_trigger_startdatedelay_generator
::
create_trigger_with_workflow
();
}
...
...
@@ -50,10 +54,15 @@ class tool_lifecycle_trigger_startdatedelay_testcase extends \advanced_testcase
$course
=
$this
->
getDataGenerator
()
->
create_course
(
array
(
'startdate'
=>
time
()
-
50
*
24
*
60
*
60
));
$trigger
=
new
startdatedelay
();
$response
=
$trigger
->
check_course
(
$course
,
$this
->
triggerinstance
->
id
);
$this
->
assertEquals
(
$response
,
trigger_response
::
next
());
$recordset
=
$this
->
processor
->
get_course_recordset
([
$this
->
triggerinstance
],
[]);
$found
=
false
;
foreach
(
$recordset
as
$element
)
{
if
(
$course
->
id
===
$element
->
id
)
{
$found
=
true
;
break
;
}
}
$this
->
assertFalse
(
$found
,
'The course should not have been triggered'
);
}
/**
...
...
@@ -63,9 +72,14 @@ class tool_lifecycle_trigger_startdatedelay_testcase extends \advanced_testcase
$course
=
$this
->
getDataGenerator
()
->
create_course
(
array
(
'startdate'
=>
time
()
-
200
*
24
*
60
*
60
));
$trigger
=
new
startdatedelay
();
$response
=
$trigger
->
check_course
(
$course
,
$this
->
triggerinstance
->
id
);
$this
->
assertEquals
(
$response
,
trigger_response
::
trigger
());
$recordset
=
$this
->
processor
->
get_course_recordset
([
$this
->
triggerinstance
],
[]);
$found
=
false
;
foreach
(
$recordset
as
$element
)
{
if
(
$course
->
id
===
$element
->
id
)
{
$found
=
true
;
break
;
}
}
$this
->
assertTrue
(
$found
,
'The course should have been triggered'
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment