@@ -72,6 +72,10 @@ public function configure(ArrayNodeDefinition $builder): void
72
72
->info ('Host domain or IP ' )
73
73
->defaultValue ('localhost ' )
74
74
->end ()
75
+ ->scalarNode ('runAs ' )
76
+ ->info ('The username to be used to run the built-in server ' )
77
+ ->defaultValue ('' )
78
+ ->end ()
75
79
->end ()
76
80
;
77
81
}
@@ -88,9 +92,10 @@ public function load(ContainerBuilder $container, array $config): void
88
92
}
89
93
}
90
94
$ host = $ this ->getHost ($ config );
95
+ $ runAs = $ this ->getRunAs ($ config );
91
96
$ definition = (new Definition ('PhpBuiltin\RunServerListener ' ))
92
97
->addTag ('event_dispatcher.subscriber ' )
93
- ->setArguments ([$ verbose , $ rootDir , $ host ])
98
+ ->setArguments ([$ verbose , $ rootDir , $ host, $ runAs ])
94
99
;
95
100
96
101
$ container ->setDefinition (self ::ID . '.listener ' , $ definition );
@@ -105,6 +110,15 @@ private function getHost(array $config): string
105
110
return (string ) $ host ;
106
111
}
107
112
113
+ private function getRunAs (array $ config ): string
114
+ {
115
+ $ runAs = getenv ('BEHAT_RUN_AS ' );
116
+ if ($ runAs === false ) {
117
+ $ runAs = $ config ['runAs ' ];
118
+ }
119
+ return (string ) $ runAs ;
120
+ }
121
+
108
122
private function getRootDir (array $ config ): string
109
123
{
110
124
$ rootDir = getenv ('BEHAT_ROOT_DIR ' );
0 commit comments