File tree Expand file tree Collapse file tree 2 files changed +69
-0
lines changed
tests/integration/frameworks/drupal Expand file tree Collapse file tree 2 files changed +69
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /*
3
+ * Copyright 2020 New Relic Corporation. All rights reserved.
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /* Verify agent behavior on valid hookImplementationsMap */
8
+
9
+ namespace Drupal \Core \Extension {
10
+ interface ModuleHandlerInterface
11
+ {
12
+ public function invokeAllWith ($ hook_str , $ callback );
13
+ }
14
+ class ModuleHandler implements ModuleHandlerInterface
15
+ {
16
+ protected array $ hookImplementationsMap = array (
17
+ 'hookname ' => array ('classname ' => array ('methodname ' => 'modulename ' )),
18
+ 'hookname_b ' => array ('classname_b ' => array ('methodname_b ' => 'modulename_b ' )),
19
+ 'hookname_c ' => array ('classname_c ' => array ('methodname_c ' => 'modulename_c ' )),
20
+ );
21
+
22
+ // to avoid editor warnings
23
+ public function invokeAllWith ($ hook_str , $ callback )
24
+ {
25
+ return null ;
26
+ }
27
+
28
+ // for debugging purposes
29
+ public function dump ()
30
+ {
31
+ var_dump ($ this ->hookImplementationsMap );
32
+ }
33
+ }
34
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /*
3
+ * Copyright 2020 New Relic Corporation. All rights reserved.
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /*DESCRIPTION
8
+ Verify agent behavior on valid hookImplementationsMap
9
+ */
10
+
11
+ /*INI
12
+ newrelic.framework = drupal8
13
+ */
14
+
15
+ /*EXPECT_TRACED_ERRORS null */
16
+
17
+ /*EXPECT_ERROR_EVENTS null */
18
+
19
+ /*EXPECT
20
+ */
21
+
22
+ require_once __DIR__ . '/mock_module_handler_valid.php ' ;
23
+
24
+ // This specific API is needed for us to instrument the ModuleHandler
25
+ class Drupal
26
+ {
27
+ public function moduleHandler ()
28
+ {
29
+ return new Drupal \Core \Extension \ModuleHandler ();
30
+ }
31
+ }
32
+
33
+ // Create module handler
34
+ $ drupal = new Drupal ();
35
+ $ handler = $ drupal ->moduleHandler ();
You can’t perform that action at this time.
0 commit comments