File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
tests/integration/autoloader/autoload-with-composer/vendor/composer Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,8 @@ static bool nr_execute_handle_autoload_composer_is_initialized() {
30
30
return false;
31
31
}
32
32
#else
33
- if (NULL == nr_php_find_class_method (zce , "getallrawdata" )) {
33
+ if (NULL == nr_php_find_class_method (zce , "getallrawdata" )
34
+ || NULL == nr_php_find_class_method (zce , "getrootpackage" )) {
34
35
nrl_verbosedebug (
35
36
NRL_INSTRUMENT ,
36
37
"Composer\\InstalledVersions class found, but methods not found" );
@@ -135,9 +136,13 @@ static void nr_execute_handle_autoload_composer_get_packages_information(
135
136
= ""
136
137
"(function() {"
137
138
" try {"
139
+ " $root_package = \\Composer\\InstalledVersions::getRootPackage();"
138
140
" $packages = array();"
139
141
" foreach (\\Composer\\InstalledVersions::getAllRawData() as $installed) { "
140
142
" foreach ($installed['versions'] as $packageName => $packageData) {"
143
+ " if ($packageName == @$root_package['name']) {"
144
+ " continue;"
145
+ " }"
141
146
" if (isset($packageData['pretty_version'])) {"
142
147
" $packages[$packageName] = ltrim($packageData['pretty_version'], 'v');"
143
148
" }"
Original file line number Diff line number Diff line change @@ -35,6 +35,14 @@ public static function getAllRawData()
35
35
return array ($ installed );
36
36
}
37
37
38
+ // This Composer's runtime API method is used by the agent to get the root package:
39
+ public static function getRootPackage ()
40
+ {
41
+ $ installed = require __DIR__ . '/installed.php ' ;
42
+ // This mock only returns a single dataset; in real life, there could be more
43
+ return $ installed [0 ]['root ' ];
44
+ }
45
+
38
46
// Mock of 'composer show' used by integration tests to generate list of packages:
39
47
public static function show () {
40
48
$ installed = self ::getAllRawData ();
You can’t perform that action at this time.
0 commit comments