Server : Apache System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64 User : palandch ( 1163) PHP Version : 7.1.33 Disable Function : NONE Directory : /home/palandch/Cloudflare-CPanel-7.0.1/src/Test/Cpanel/ |
<?php namespace CF\Cpanel\Test; interface MockCpanelLiveAPI { public function cpanelfeature($feature); } use CF\Cpanel\CpanelAPI; /* * PSR2 wants interfaces in their own file - we use this interface to mock a cPanel class without a namespace. */ class CpanelAPITest extends \PHPUnit_Framework_TestCase // @codingStandardsIgnoreLine { private $mockCpanelLiveAPI; private $mockLogger; private $cpanelAPI; public function setup() { $this->mockCpanelLiveAPI = $this->getMockBuilder('CF\Cpanel\Test\MockCpanelLiveAPI') ->disableOriginalConstructor() ->getMock(); $this->mockLogger = $this->getMockBuilder('CF\Integration\DefaultLogger') ->disableOriginalConstructor() ->getMock(); $this->cpanelAPI = new CpanelAPI($this->mockCpanelLiveAPI, $this->mockLogger); } public function testIsAdvancedZoneEditEnabledReturnsTrueIfEnabled() { $this->mockCpanelLiveAPI->method('cpanelfeature')->with("zoneedit")->willReturn(1); $this->assertTrue($this->cpanelAPI->isAdvancedZoneEditEnabled()); } public function testIsAdvancedZoneEditEnabledReturnsFalseIfDisabled() { $this->mockCpanelLiveAPI->method('cpanelfeature')->with("zoneedit")->willReturn(0); $this->assertFalse($this->cpanelAPI->isAdvancedZoneEditEnabled()); } }