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