@@ -389,18 +389,23 @@ public function test_validate_pwa_options($validate, $cfg_array, $expected_error
389389 $ this ->config ['icons_path ' ] = 'images/icons ' ;
390390 $ config_name = key ($ cfg_array );
391391 $ config_definition = ['validate ' => $ validate ];
392- $ small_image = isset ($ cfg_array ['pwa_icon_small ' ]) ? explode ('. ' , $ cfg_array ['pwa_icon_small ' ]) : ['' , '' ];
393- $ large_image = isset ($ cfg_array ['pwa_icon_large ' ]) ? explode ('. ' , $ cfg_array ['pwa_icon_large ' ]) : ['' , '' ];
392+
393+ $ pwa_icon_small = isset ($ cfg_array ['pwa_icon_small ' ]) ? $ cfg_array ['pwa_icon_small ' ] : '' ;
394+ $ pwa_icon_large = isset ($ cfg_array ['pwa_icon_large ' ]) ? $ cfg_array ['pwa_icon_large ' ] : '' ;
395+
396+ [$ small_image_name , $ small_image_ext ] = $ pwa_icon_small ? explode ('. ' , $ pwa_icon_small , 2 ) : ['' , '' ];
397+ [$ large_image_name , $ large_image_ext ] = $ pwa_icon_large ? explode ('. ' , $ pwa_icon_large , 2 ) : ['' , '' ];
398+
394399 $ error = [];
395400
396401 $ this ->set_listener ();
397402
398- $ this ->imagesize ->expects (! empty ( $ cfg_array [ ' pwa_icon_small ' ]) || ! empty ( $ cfg_array [ ' pwa_icon_large ' ]) ? self ::once () : self ::never ())
403+ $ this ->imagesize ->expects ($ pwa_icon_small && $ pwa_icon_large ? self ::once () : self ::never ())
399404 ->method ('getImageSize ' )
400405 ->willReturnMap ([
401406 [$ this ->root_path . $ this ->config ['icons_path ' ] . '/ ' , '' , false ],
402- [$ this ->root_path . $ this ->config ['icons_path ' ] . '/ ' . $ cfg_array [ ' pwa_icon_small ' ] , '' , ['width ' => (int ) $ small_image [ 0 ] , 'height ' => (int ) $ small_image [ 0 ] , 'type ' => $ small_image [ 1 ] === 'png ' ? IMAGETYPE_PNG : IMAGETYPE_UNKNOWN ]],
403- [$ this ->root_path . $ this ->config ['icons_path ' ] . '/ ' . $ cfg_array [ ' pwa_icon_large ' ] , '' , ['width ' => (int ) $ large_image [ 0 ] , 'height ' => (int ) $ large_image [ 0 ] , 'type ' => $ large_image [ 1 ] === 'png ' ? IMAGETYPE_PNG : IMAGETYPE_UNKNOWN ]],
407+ [$ this ->root_path . $ this ->config ['icons_path ' ] . '/ ' . $ pwa_icon_small , '' , ['width ' => (int ) $ small_image_name , 'height ' => (int ) $ small_image_name , 'type ' => $ small_image_ext === 'png ' ? IMAGETYPE_PNG : IMAGETYPE_UNKNOWN ]],
408+ [$ this ->root_path . $ this ->config ['icons_path ' ] . '/ ' . $ pwa_icon_large , '' , ['width ' => (int ) $ large_image_name , 'height ' => (int ) $ large_image_name , 'type ' => $ large_image_ext === 'png ' ? IMAGETYPE_PNG : IMAGETYPE_UNKNOWN ]],
404409 ]);
405410
406411 $ dispatcher = new \phpbb \event \dispatcher ();
0 commit comments