mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-09 13:36:07 +09:00
45 lines
1017 B
PHP
45 lines
1017 B
PHP
<?php
|
|
|
|
|
|
namespace Box\Mod\Formbuilder\Api;
|
|
|
|
|
|
class GuestTest extends \PHPUnit_Framework_TestCase {
|
|
|
|
public function setup()
|
|
{
|
|
$this->api = new \Box\Mod\Formbuilder\Api\Guest();
|
|
}
|
|
|
|
|
|
public function testgetDi()
|
|
{
|
|
$di = new \Box_Di();
|
|
$this->api->setDi($di);
|
|
$getDi = $this->api->getDi();
|
|
$this->assertEquals($di, $getDi);
|
|
}
|
|
|
|
public function testget()
|
|
{
|
|
$data['id'] = 1;
|
|
|
|
$serviceMock = $this->getMockBuilder('\Box\Mod\Formbuilder\Service')->getMock();
|
|
$serviceMock->expects($this->atLeastOnce())
|
|
->method('getForm')
|
|
->will($this->returnValue(array()));
|
|
|
|
$this->api->setService($serviceMock);
|
|
$result = $this->api->get($data);
|
|
$this->assertInternalType('array', $result);
|
|
}
|
|
|
|
public function testgetMissingFormId()
|
|
{
|
|
$data = array();
|
|
|
|
$this->setExpectedException('\Box_Exception', 'Form id was not passed');
|
|
$this->api->get($data);
|
|
}
|
|
}
|
|
|