@@ -427,4 +427,48 @@ public function dataProviderRenderAssets()
427
427
],
428
428
];
429
429
}
430
+
431
+ public function testRenderAssetWithNoContentType () : void
432
+ {
433
+ $ type = '' ;
434
+
435
+ $ assetMockOne = $ this ->createMock (\Magento \Framework \View \Asset \AssetInterface::class);
436
+ $ assetMockOne ->expects ($ this ->exactly (1 ))
437
+ ->method ('getUrl ' )
438
+ ->willReturn ('url ' );
439
+
440
+ $ assetMockOne ->expects ($ this ->atLeastOnce ())->method ('getContentType ' )->willReturn ($ type );
441
+
442
+ $ groupAssetsOne = [$ assetMockOne ];
443
+
444
+ $ groupMockOne = $ this ->getMockBuilder (\Magento \Framework \View \Asset \PropertyGroup::class)
445
+ ->disableOriginalConstructor ()
446
+ ->getMock ();
447
+ $ groupMockOne ->expects ($ this ->once ())
448
+ ->method ('getAll ' )
449
+ ->willReturn ($ groupAssetsOne );
450
+ $ groupMockOne ->expects ($ this ->any ())
451
+ ->method ('getProperty ' )
452
+ ->willReturnMap (
453
+ [
454
+ [GroupedCollection::PROPERTY_CAN_MERGE , true ],
455
+ [GroupedCollection::PROPERTY_CONTENT_TYPE , $ type ],
456
+ ['attributes ' , 'rel="some-rel" ' ],
457
+ ['ie_condition ' , null ],
458
+ ]
459
+ );
460
+
461
+ $ this ->pageConfigMock ->expects ($ this ->once ())
462
+ ->method ('getAssetCollection ' )
463
+ ->willReturn ($ this ->assetsCollection );
464
+
465
+ $ this ->assetsCollection ->expects ($ this ->once ())
466
+ ->method ('getGroups ' )
467
+ ->willReturn ([$ groupMockOne ]);
468
+
469
+ $ this ->assertEquals (
470
+ '<link rel="some-rel" href="url" /> ' . "\n" ,
471
+ $ this ->renderer ->renderAssets ($ this ->renderer ->getAvailableResultGroups ())
472
+ );
473
+ }
430
474
}
0 commit comments