Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
772c9249
Commit
772c9249
authored
12 years ago
by
Michael Hamann
Browse files
Options
Downloads
Patches
Plain Diff
Add a test case for nested events, this tests
8cb3706d
parent
430db121
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
_test/tests/inc/events_nested.test.php
+36
-0
36 additions, 0 deletions
_test/tests/inc/events_nested.test.php
with
36 additions
and
0 deletions
_test/tests/inc/events_nested.test.php
0 → 100644
+
36
−
0
View file @
772c9249
<?php
/**
* This tests if event handlers can trigger the same event again.
* This is used by plugins that modify cache handling and use metadata
* for checking cache validity which triggers another cache use event.
*/
class
events_nested_test
extends
DokuWikiTest
{
function
test_nested_events
()
{
global
$EVENT_HANDLER
;
$firstcount
=
0
;
$secondcount
=
0
;
$EVENT_HANDLER
->
register_hook
(
'NESTED_EVENT'
,
'BEFORE'
,
null
,
function
()
use
(
&
$firstcount
)
{
$firstcount
++
;
if
(
$firstcount
==
1
)
{
$param
=
array
();
trigger_event
(
'NESTED_EVENT'
,
$param
);
}
}
);
$EVENT_HANDLER
->
register_hook
(
'NESTED_EVENT'
,
'BEFORE'
,
null
,
function
()
use
(
&
$secondcount
)
{
$secondcount
++
;
}
);
$param
=
array
();
trigger_event
(
'NESTED_EVENT'
,
$param
);
$this
->
assertEquals
(
2
,
$firstcount
);
$this
->
assertEquals
(
2
,
$secondcount
);
}
}
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