6
6
namespace Magento \Cookie \Model \Config \Backend ;
7
7
8
8
use Magento \Framework \Exception \LocalizedException ;
9
+ use Magento \TestFramework \Helper \Bootstrap ;
10
+ use PHPUnit \Framework \TestCase ;
9
11
10
12
/**
11
13
* Test \Magento\Cookie\Model\Config\Backend\Domain
12
14
*
13
15
* @magentoAppArea adminhtml
14
16
*/
15
- class DomainTest extends \ PHPUnit \ Framework \ TestCase
17
+ class DomainTest extends TestCase
16
18
{
17
19
/**
18
20
* @param string $value
@@ -22,9 +24,9 @@ class DomainTest extends \PHPUnit\Framework\TestCase
22
24
*/
23
25
public function testBeforeSave ($ value , $ exceptionMessage = null )
24
26
{
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
27
+ /** @var $domain Domain */
28
+ $ domain = Bootstrap::getObjectManager ()->create (
29
+ Domain::class
28
30
);
29
31
$ domain ->setValue ($ value );
30
32
$ domain ->setPath ('path ' );
@@ -45,18 +47,19 @@ public function testBeforeSave($value, $exceptionMessage = null)
45
47
/**
46
48
* @return array
47
49
*/
48
- public function beforeSaveDataProvider ()
50
+ public function beforeSaveDataProvider (): array
49
51
{
50
52
return [
51
- 'not string ' => [['array ' ], 'Invalid domain name: must be a string ' ],
52
- 'invalid hostname ' => [
53
+ 'notString ' => [['array ' ], 'Invalid domain name: must be a string ' ],
54
+ 'invalidHostname ' => [
53
55
'http:// ' ,
54
56
'Invalid domain name: The input does not match the expected structure for a DNS hostname; '
55
57
. 'The input does not appear to be a valid URI hostname; '
56
58
. 'The input does not appear to be a valid local network name ' ,
57
59
],
58
- 'valid hostname ' => ['hostname.com ' ],
59
- 'empty string ' => ['' ],
60
+ 'validHostname ' => ['hostname.com ' ],
61
+ 'emptyString ' => ['' ],
62
+ 'invalidCharacter ' => ['hostname,com ' , 'Invalid domain name: invalid character in cookie domain ' ],
60
63
];
61
64
}
62
65
}
0 commit comments