refactor all base things

This commit is contained in:
crazywhalecc
2022-08-13 17:00:29 +08:00
committed by Jerry Ma
parent 1c801bb205
commit b2c95d96b1
54 changed files with 3009 additions and 383 deletions

View File

@@ -6,11 +6,9 @@ namespace Tests\ZM\Utils;
use PHPUnit\Framework\TestCase;
use Swoole\Http\Request;
use Swoole\Http\Response;
use Symfony\Component\Routing\RouteCollection;
use ZM\Annotation\Http\RequestMapping;
use ZM\Annotation\Http\RequestMethod;
use ZM\Config\ZMConfig;
use ZM\Utils\HttpUtil;
use ZM\Utils\Manager\RouteManager;
@@ -19,17 +17,6 @@ use ZM\Utils\Manager\RouteManager;
*/
class HttpUtilTest extends TestCase
{
/**
* @dataProvider providerTestHandleStaticPage
*/
public function testHandleStaticPage(string $page, bool $expected): void
{
$swoole_response = $this->getMockClass(Response::class);
$r = new \ZM\Http\Response(new $swoole_response());
HttpUtil::handleStaticPage($page, $r, ZMConfig::get('global', 'static_file_server'));
$this->assertEquals($expected, $r->getStatusCode() === 200);
}
public function providerTestHandleStaticPage(): array
{
return [
@@ -38,17 +25,6 @@ class HttpUtilTest extends TestCase
];
}
/**
* @covers \ZM\Utils\HttpUtil::getHttpCodePage
* @covers \ZM\Utils\HttpUtil::responseCodePage
* @dataProvider providerTestGetHttpCodePage
*/
public function testGetHttpCodePage(int $code, bool $expected): void
{
$has_response = !empty(HttpUtil::getHttpCodePage($code));
$this->assertSame($expected, $has_response);
}
public function providerTestGetHttpCodePage(): array
{
return [