@@ -143,6 +143,42 @@ public function testAssetMapperCanBeEnabled()
143
143
$ this ->assertEquals ($ defaultConfig , $ config ['asset_mapper ' ]);
144
144
}
145
145
146
+ /**
147
+ * @dataProvider provideImportmapPolyfillTests
148
+ */
149
+ public function testAssetMapperPolyfillValue (mixed $ polyfillValue , bool $ isValid , mixed $ expected )
150
+ {
151
+ $ processor = new Processor ();
152
+ $ configuration = new Configuration (true );
153
+
154
+ if (!$ isValid ) {
155
+ $ this ->expectException (InvalidConfigurationException::class);
156
+ $ this ->expectExceptionMessage ($ expected );
157
+ }
158
+
159
+ $ config = $ processor ->processConfiguration ($ configuration , [[
160
+ 'http_method_override ' => false ,
161
+ 'handle_all_throwables ' => true ,
162
+ 'php_errors ' => ['log ' => true ],
163
+ 'asset_mapper ' => null === $ polyfillValue ? [] : [
164
+ 'importmap_polyfill ' => $ polyfillValue ,
165
+ ],
166
+ ]]);
167
+
168
+ if ($ isValid ) {
169
+ $ this ->assertEquals ($ expected , $ config ['asset_mapper ' ]['importmap_polyfill ' ]);
170
+ }
171
+ }
172
+
173
+ public static function provideImportmapPolyfillTests ()
174
+ {
175
+ yield [true , false , 'Must be either an importmap name or false. ' ];
176
+ yield [null , true , 'es-module-shims ' ];
177
+ yield ['es-module-shims ' , true , 'es-module-shims ' ];
178
+ yield ['foo ' , true , 'foo ' ];
179
+ yield [false , true , false ];
180
+ }
181
+
146
182
/**
147
183
* @dataProvider provideValidAssetsPackageNameConfigurationTests
148
184
*/
0 commit comments