66namespace Magento \Cookie \Model \Config \Backend ;
77
88use Magento \Framework \Exception \LocalizedException ;
9+ use Magento \TestFramework \Helper \Bootstrap ;
10+ use PHPUnit \Framework \TestCase ;
911
1012/**
1113 * Test \Magento\Cookie\Model\Config\Backend\Domain
1214 *
1315 * @magentoAppArea adminhtml
1416 */
15- class DomainTest extends \ PHPUnit \ Framework \ TestCase
17+ class DomainTest extends TestCase
1618{
1719 /**
1820 * @param string $value
@@ -22,10 +24,8 @@ class DomainTest extends \PHPUnit\Framework\TestCase
2224 */
2325 public function testBeforeSave ($ value , $ exceptionMessage = null )
2426 {
25- /** @var $domain \Magento\Cookie\Model\Config\Backend\Domain */
26- $ domain = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->create (
27- \Magento \Cookie \Model \Config \Backend \Domain::class
28- );
27+ /** @var $domain Domain */
28+ $ domain = Bootstrap::getObjectManager ()->create (Domain::class);
2929 $ domain ->setValue ($ value );
3030 $ domain ->setPath ('path ' );
3131 try {
@@ -45,18 +45,19 @@ public function testBeforeSave($value, $exceptionMessage = null)
4545 /**
4646 * @return array
4747 */
48- public function beforeSaveDataProvider ()
48+ public function beforeSaveDataProvider (): array
4949 {
5050 return [
51- 'not string ' => [['array ' ], 'Invalid domain name: must be a string ' ],
52- 'invalid hostname ' => [
51+ 'notString ' => [['array ' ], 'Invalid domain name: must be a string ' ],
52+ 'invalidHostname ' => [
5353 'http:// ' ,
5454 'Invalid domain name: The input does not match the expected structure for a DNS hostname; '
5555 . 'The input does not appear to be a valid URI hostname; '
5656 . 'The input does not appear to be a valid local network name ' ,
5757 ],
58- 'valid hostname ' => ['hostname.com ' ],
59- 'empty string ' => ['' ],
58+ 'validHostname ' => ['hostname.com ' ],
59+ 'emptyString ' => ['' ],
60+ 'invalidCharacter ' => ['hostname,com ' , 'Invalid domain name: invalid character in cookie domain ' ],
6061 ];
6162 }
6263}
0 commit comments