58 lines
1.2 KiB
PHP
58 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* PhalApi_Admin\Api\Requests_Test
|
|
*
|
|
* 针对 ../src/admin/Api/Requests.php Admin\Api\Requests 类的PHPUnit单元测试
|
|
*
|
|
* @author: dogstar 20200116
|
|
*/
|
|
|
|
namespace tests\Admin\Api;
|
|
use Admin\Api\Requests;
|
|
use PhalApi\Helper\TestRunner;
|
|
|
|
class PhpUnderControl_AdminApiRequests_Test extends \PHPUnit\Framework\TestCase
|
|
{
|
|
public $adminApiRequests;
|
|
|
|
protected function setUp()
|
|
{
|
|
parent::setUp();
|
|
|
|
$this->adminApiRequests = new \Admin\Api\Requests();
|
|
}
|
|
|
|
protected function tearDown()
|
|
{
|
|
// 输出本次单元测试所执行的SQL语句
|
|
// var_dump(\PhalApi\DI()->tracer->getSqls());
|
|
|
|
// 输出本次单元测试所涉及的追踪埋点
|
|
// var_dump(\PhalApi\DI()->tracer->getStack());
|
|
}
|
|
|
|
|
|
/**
|
|
* @group testGetRules
|
|
*/
|
|
public function testGetRules()
|
|
{
|
|
$rs = $this->adminApiRequests->getRules();
|
|
$this->assertTrue(is_array($rs));
|
|
}
|
|
|
|
/**
|
|
* @group testGetLogList
|
|
*/
|
|
public function testGetLogList()
|
|
{
|
|
$url = 's=Admin.Requests.GetLogList';
|
|
|
|
$rs = TestRunner::go($url);
|
|
|
|
$this->assertArrayHasKey('total', $rs);
|
|
$this->assertArrayHasKey('items', $rs);
|
|
}
|
|
|
|
}
|