mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-09 13:36:07 +09:00
58 lines
1.3 KiB
PHP
58 lines
1.3 KiB
PHP
<?php
|
|
|
|
|
|
namespace Box\Mod\Example\Api;
|
|
|
|
|
|
class GuestTest extends \PHPUnit_Framework_TestCase {
|
|
|
|
/**
|
|
* @var \Box\Mod\Example\Api\Guest
|
|
*/
|
|
protected $api = null;
|
|
|
|
public function setup()
|
|
{
|
|
$this->api= new \Box\Mod\Example\Api\Guest();
|
|
}
|
|
|
|
public function testreadme()
|
|
{
|
|
$toolsMock = $this->getMockBuilder('\Box_Tools')->getMock();
|
|
$toolsMock->expects($this->atLeastOnce())
|
|
->method('file_get_contents')
|
|
->willReturn('');
|
|
|
|
|
|
$di = new \Box_Di();
|
|
$di['tools'] = $toolsMock;
|
|
$this->api->setDi($di);
|
|
|
|
$result = $this->api->readme(array());
|
|
$this->assertInternalType('string', $result);
|
|
}
|
|
|
|
public function testtop_songs()
|
|
{
|
|
$xmlString = "<note>
|
|
<to>Tove</to>
|
|
<from>Jani</from>
|
|
<heading>Reminder</heading>
|
|
<body>Don't forget me this weekend!</body>
|
|
</note>";
|
|
$data = array();
|
|
$toolsMock = $this->getMockBuilder('\Box_Tools')->getMock();
|
|
$toolsMock->expects($this->atLeastOnce())
|
|
->method('file_get_contents')
|
|
->willReturn($xmlString);
|
|
|
|
$di = new \Box_Di();
|
|
$di['tools'] = $toolsMock;
|
|
|
|
$this->api->setDi($di);
|
|
$result = $this->api->top_songs($data);
|
|
$this->assertInternalType('array', $result);
|
|
|
|
}
|
|
}
|
|
|