mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-09 13:36:07 +09:00
80 lines
2.2 KiB
PHP
80 lines
2.2 KiB
PHP
<?php
|
|
namespace Box\Tests\Mod\Servicecustom\Api;
|
|
|
|
|
|
class ClientTest extends \BBTestCase
|
|
{
|
|
/**
|
|
* @var \Box\Mod\Servicecustom\Api\Client
|
|
*/
|
|
protected $api = null;
|
|
|
|
public function setup()
|
|
{
|
|
$this->api = new \Box\Mod\Servicecustom\Api\Client();
|
|
}
|
|
|
|
public function testCall()
|
|
{
|
|
$serviceMock = $this->getMockBuilder('Box\Mod\Servicecustom\Service')->getMock();
|
|
$serviceMock->expects($this->atLeastOnce())
|
|
->method('getServiceCustomByOrderId')
|
|
->will($this->returnValue(new \Model_ServiceCustom()));
|
|
$serviceMock->expects($this->atLeastOnce())
|
|
->method('customCall')
|
|
->will($this->returnValue(null));
|
|
|
|
$arguments = array(
|
|
0 => array(
|
|
'order_id' => rand(1, 100)
|
|
),
|
|
);
|
|
|
|
$this->api->setService($serviceMock);
|
|
|
|
$this->api->__call('delete', $arguments);
|
|
}
|
|
|
|
/**
|
|
* @expectedException \Box_Exception
|
|
*/
|
|
public function testCallArgumentsNotSetException()
|
|
{
|
|
$serviceMock = $this->getMockBuilder('Box\Mod\Servicecustom\Service')->getMock();
|
|
$serviceMock->expects($this->never())
|
|
->method('getServiceCustomByOrderId')
|
|
->will($this->returnValue(new \Model_ServiceCustom()));
|
|
$serviceMock->expects($this->never())
|
|
->method('customCall')
|
|
->will($this->returnValue(null));
|
|
|
|
$arguments = array();
|
|
|
|
$this->api->setService($serviceMock);
|
|
|
|
$this->api->__call('delete', $arguments);
|
|
}
|
|
|
|
/**
|
|
* @expectedException \Box_Exception
|
|
*/
|
|
public function testCallOrderIdNotSetException()
|
|
{
|
|
$serviceMock = $this->getMockBuilder('Box\Mod\Servicecustom\Service')->getMock();
|
|
$serviceMock->expects($this->never())
|
|
->method('getServiceCustomByOrderId')
|
|
->will($this->returnValue(new \Model_ServiceCustom()));
|
|
$serviceMock->expects($this->never())
|
|
->method('customCall')
|
|
->will($this->returnValue(null));
|
|
|
|
$arguments = array(
|
|
0 => array(),
|
|
);
|
|
|
|
$this->api->setService($serviceMock);
|
|
|
|
$this->api->__call('delete', $arguments);
|
|
}
|
|
}
|
|
|