1717use Magento \Framework \Registry ;
1818use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
1919use Magento \Framework \View \Asset \MergeService ;
20+ use Magento \Framework \Validator \Url as UrlValidator ;
21+ use Magento \Framework \App \ObjectManager as AppObjectManager ;
22+ use Magento \Framework \ObjectManagerInterface ;
2023use Magento \Store \Model \Store ;
2124use PHPUnit \Framework \TestCase ;
2225
@@ -71,6 +74,24 @@ public function testSaveMergedJsCssMustBeCleaned()
7174 public function testBeforeSaveConvertLowerCase ($ value , $ expectedValue )
7275 {
7376 $ model = (new ObjectManager ($ this ))->getObject (Baseurl::class);
77+
78+ $ urlValidatorMock = $ this ->getMockBuilder (UrlValidator::class)
79+ ->disableOriginalConstructor ()
80+ ->getMock ();
81+
82+ $ objectManagerInterface = $ this ->createMock (ObjectManagerInterface::class);
83+ $ objectManagerInterface ->expects ($ this ->exactly (1 ))
84+ ->method ('get ' )
85+ ->with (UrlValidator::class)
86+ ->willReturn ($ urlValidatorMock );
87+ AppObjectManager::setInstance ($ objectManagerInterface );
88+
89+ $ urlValidatorMock ->expects ($ this ->once ())
90+ ->method ('isValid ' )
91+ ->with ($ expectedValue , ['http ' , 'https ' ])
92+ ->willReturn (true );
93+
94+
7495 $ model ->setValue ($ value );
7596 $ model ->beforeSave ();
7697 $ this ->assertEquals ($ expectedValue , $ model ->getValue ());
@@ -79,7 +100,7 @@ public function testBeforeSaveConvertLowerCase($value, $expectedValue)
79100 /**
80101 * @return array
81102 */
82- public function beforeSaveDataProvider ()
103+ public static function beforeSaveDataProvider ()
83104 {
84105 return [
85106 ['https://Example1.com/ ' , 'https://example1.com/ ' ],
0 commit comments