File tree Expand file tree Collapse file tree 1 file changed +70
-0
lines changed
lib/internal/Magento/Framework/Test/Unit Expand file tree Collapse file tree 1 file changed +70
-0
lines changed Original file line number Diff line number Diff line change @@ -364,6 +364,76 @@ public function testEscapeUrl(string $data, string $expected): void
364
364
$ this ->assertEquals ($ expected , $ this ->escaper ->escapeUrl ($ expected ));
365
365
}
366
366
367
+ /**
368
+ * @covers \Magento\Framework\Escaper::escapeCss
369
+ *
370
+ * @param string $data
371
+ * @param string $expected
372
+ * @return void
373
+ *
374
+ * @dataProvider escapeCssDataProvider
375
+ */
376
+ public function testEscapeCss ($ data , string $ expected ): void
377
+ {
378
+ $ this ->assertEquals ($ expected , $ this ->escaper ->escapeCss ($ data ));
379
+ }
380
+
381
+ /**
382
+ * @return array
383
+ */
384
+ public function escapeCssDataProvider (): array
385
+ {
386
+ return [
387
+ [
388
+ 'data ' => 1 ,
389
+ 'expected ' => '1 ' ,
390
+ ],
391
+ [
392
+ 'data ' => '*%string{foo}%:: ' ,
393
+ 'expected ' => '\2A \25 string\7B foo\7D \25 \3A \3A ' ,
394
+ ]
395
+ ];
396
+ }
397
+
398
+ /**
399
+ * @covers \Magento\Framework\Escaper::encodeUrlParam
400
+ *
401
+ * @param string $data
402
+ * @param string $expected
403
+ * @return void
404
+ *
405
+ * @dataProvider encodeUrlParamDataProvider
406
+ */
407
+ public function testEncodeUrlParam ($ data , string $ expected ): void
408
+ {
409
+ $ this ->assertEquals ($ expected , $ this ->escaper ->encodeUrlParam ($ data ));
410
+ }
411
+
412
+ /**
413
+ * @return array
414
+ */
415
+ public function encodeUrlParamDataProvider (): array
416
+ {
417
+ return [
418
+ [
419
+ 'data ' => "a3== " ,
420
+ 'expected ' => "a3%3D%3D " ,
421
+ ],
422
+ [
423
+ 'data ' => "example string " ,
424
+ 'expected ' => "example%20string " ,
425
+ ],
426
+ [
427
+ 'data ' => 1 ,
428
+ 'expected ' => "1 " ,
429
+ ],
430
+ [
431
+ 'data ' => null ,
432
+ 'expected ' => "" ,
433
+ ]
434
+ ];
435
+ }
436
+
367
437
/**
368
438
* @return array
369
439
*/
You can’t perform that action at this time.
0 commit comments