. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 172.67.135.14 / Your IP :
216.73.216.209 [
Web Server : LiteSpeed System : Linux premium35.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 User : lasanffc ( 2331) PHP Version : 8.0.30 Disable Function : NONE Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/lasanffc/public_html/wp-content/plugins/cloudflare/src/Test/WordPress/ |
Upload File : |
<?php
namespace CF\WordPress\Test;
use CF\API\Request;
use CF\WordPress\ClientActions;
use CF\Integration\DefaultIntegration;
class ClientActionsTest extends \PHPUnit\Framework\TestCase
{
private $mockClientAPI;
private $mockConfig;
private $mockWordPressAPI;
private $mockDataStore;
private $mockLogger;
private $mockDefaultIntegration;
public function setup(): void
{
$this->mockClientAPI = $this->getMockBuilder('CF\API\Client')
->disableOriginalConstructor()
->getMock();
$this->mockConfig = $this->getMockBuilder('CF\Integration\DefaultConfig')
->disableOriginalConstructor()
->getMock();
$this->mockWordPressAPI = $this->getMockBuilder('CF\WordPress\WordPressAPI')
->disableOriginalConstructor()
->getMock();
$this->mockDataStore = $this->getMockBuilder('CF\WordPress\DataStore')
->disableOriginalConstructor()
->getMock();
$this->mockLogger = $this->getMockBuilder('CF\Integration\DefaultLogger')
->disableOriginalConstructor()
->getMock();
$this->mockDefaultIntegration = new DefaultIntegration($this->mockConfig, $this->mockWordPressAPI, $this->mockDataStore, $this->mockLogger);
}
public function testReturnWordPressDomain()
{
$wordPressDomain = 'example.com';
$request = new Request(null, null, null, null);
$clientActions = new ClientActions($this->mockDefaultIntegration, $this->mockClientAPI, $request);
$this->mockWordPressAPI->method('getDomainList')->willReturn(
array($wordPressDomain)
);
$this->mockClientAPI->method('responseOk')->willReturn(true);
$this->mockClientAPI->method('callAPI')->willReturn(array('result' => array()));
$response = $clientActions->returnWordPressDomain();
$this->assertEquals($wordPressDomain, $response['result'][0]['name']);
}
public function testCacheDomainNameCachesSubDomain()
{
$responseDomain = 'domain.com';
$originalDomain = 'sub.domain.com';
$cachedDomainList = '';
$response = array(
'result' => array(
array(
'name' => $responseDomain,
),
),
);
$request = new Request(null, null, null, null);
$clientActions = new ClientActions($this->mockDefaultIntegration, $this->mockClientAPI, $request);
$this->mockWordPressAPI->method('getOriginalDomain')->willReturn($originalDomain);
$this->mockWordPressAPI->method('getDomainList')->willReturn(array($cachedDomainList));
$result = $clientActions->cacheDomainName($response);
$this->assertEquals($originalDomain, $result);
}
public function testCacheDomainNameReturnsCachedDomain()
{
$originalDomain = 'domain.com';
$cachedDomainList = 'domain.com';
$request = new Request(null, null, null, null);
$clientActions = new ClientActions($this->mockDefaultIntegration, $this->mockClientAPI, $request);
$this->mockWordPressAPI->method('getOriginalDomain')->willReturn($originalDomain);
$this->mockWordPressAPI->method('getDomainList')->willReturn(array($cachedDomainList));
$result = $clientActions->cacheDomainName(array());
$this->assertEquals($cachedDomainList, $result);
}
}