forked from mapasculturais/mapasculturais
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHooksTest.php
More file actions
37 lines (29 loc) · 986 Bytes
/
Copy pathHooksTest.php
File metadata and controls
37 lines (29 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
require_once __DIR__.'/bootstrap.php';
class HooksTest extends MapasCulturais_TestCase{
function testHookOrder(){
$app = $this->app;
$result = [];
$app->hook('test hook order', function() use(&$result){
$result[] = 4;
}, 11);
$app->hook('test hook order', function() use(&$result){
$result[] = 1;
}, 10);
$app->hook('test hook order', function() use(&$result){
$result[] = 2;
}, 10);
$app->hook('test hook order', function() use(&$result){
$result[] = 3;
}, 10);
$app->hook('test hook order', function() use(&$result){
$result[] = 0;
}, 9);
$app->applyHook('test hook order');
$this->assertEquals(0, $result[0]);
$this->assertEquals(1, $result[1]);
$this->assertEquals(2, $result[2]);
$this->assertEquals(3, $result[3]);
$this->assertEquals(4, $result[4]);
}
}