3.8.1
This commit is contained in:
57
tests/admin/Api/Requests_Test.php
Normal file
57
tests/admin/Api/Requests_Test.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user