Files
FOSSBilling/tests/bb-modules/Example/Api/GuestTest.php
T
2014-11-03 09:00:47 +02:00

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);
}
}