ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2022 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
namespace Plumrocket\CookieConsent\Test\Unit\Model\Cookie;
|
||||
|
||||
use Plumrocket\CookieConsent\Model\Cookie\ParentDomain;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ParentDomainTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Plumrocket\CookieConsent\Model\Cookie\ParentDomain
|
||||
*/
|
||||
private $parentDomain;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->parentDomain = new ParentDomain();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getDomain
|
||||
*
|
||||
* @param string $domain
|
||||
* @param string $expectedDomain
|
||||
* @return void
|
||||
*/
|
||||
public function testResolve(string $domain, string $expectedDomain): void
|
||||
{
|
||||
$parentDomain = $this->parentDomain->resolve($domain);
|
||||
self::assertSame($expectedDomain, $parentDomain);
|
||||
}
|
||||
|
||||
public function getDomain()
|
||||
{
|
||||
yield [
|
||||
'domain' => 'www.plumrocket.com',
|
||||
'parentDomain' => '.plumrocket.com'
|
||||
];
|
||||
|
||||
yield [
|
||||
'domain' => 'blog.magento.com',
|
||||
'parentDomain' => '.magento.com'
|
||||
];
|
||||
|
||||
yield [
|
||||
'domain' => 'magento.com',
|
||||
'parentDomain' => ''
|
||||
];
|
||||
|
||||
yield [
|
||||
'domain' => 'magento.te.ua',
|
||||
'parentDomain' => ''
|
||||
];
|
||||
|
||||
yield [
|
||||
'domain' => 'www.test.magento.com',
|
||||
'parentDomain' => '.test.magento.com'
|
||||
];
|
||||
|
||||
yield [
|
||||
'domain' => 'www.magento.te.ua',
|
||||
'parentDomain' => '.magento.te.ua'
|
||||
];
|
||||
|
||||
yield [
|
||||
'domain' => 'www.magento.xxx',
|
||||
'parentDomain' => '.magento.xxx'
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user