From 0fe9f4cba76a1aa4671250561afcfa885c42c058 Mon Sep 17 00:00:00 2001 From: Godruoyi Date: Thu, 2 Jan 2025 18:04:54 +0800 Subject: [PATCH 1/2] Chore: update point and fix ci --- .github/workflows/php.yaml | 4 +- composer.json | 12 ++-- src/Application.php | 31 ++++----- src/Clients/AliyunClient.php | 82 ++++++++++++------------ src/Clients/BaiduClient.php | 6 +- src/Manager.php | 2 +- src/Providers/HttpServiceProvider.php | 2 +- src/Requests/Request.php | 4 +- src/Support/Arr.php | 4 +- src/Support/BaiduAccessToken.php | 4 +- src/Support/FileConverter.php | 2 +- src/Support/Http.php | 4 +- src/Support/Response.php | 8 +-- tests/ApplicationTest.php | 50 +++++++-------- tests/Clients/AliyunClientTest.php | 6 +- tests/Clients/BaiduClientTest.php | 6 +- tests/Clients/BaseClientTest.php | 4 +- tests/Clients/CustomClientTest.php | 2 +- tests/Clients/RealRequestClientTest.php | 6 +- tests/Clients/TencentClientTest.php | 4 +- tests/ConfigTest.php | 6 +- tests/CustomServiceProvider.php | 2 +- tests/Requests/AliyunRequestTest.php | 22 +++---- tests/Requests/BaseRequestTest.php | 4 +- tests/Requests/TencentRequestTest.php | 2 +- tests/Support/ArrTest.php | 52 +++++++-------- tests/Support/BaiduAccessTokenTest.php | 4 +- tests/Support/EncoderTest.php | 2 +- tests/Support/FileConverterTest.php | 26 ++++---- tests/Support/LoggerTest.php | 40 ++++++------ tests/Support/ResponseTest.php | 8 +-- tests/Support/TencentSignatureV3Test.php | 6 +- tests/TestCase.php | 4 +- 33 files changed, 203 insertions(+), 218 deletions(-) diff --git a/.github/workflows/php.yaml b/.github/workflows/php.yaml index ee192ac..bd97e5c 100644 --- a/.github/workflows/php.yaml +++ b/.github/workflows/php.yaml @@ -9,7 +9,7 @@ jobs: strategy: matrix: operating-system: ['ubuntu-latest'] - php-versions: ['8.1', '8.2'] + php-versions: ['8.1', '8.2', '8.3', '8.4'] steps: - name: Checkout uses: actions/checkout@v2 @@ -42,7 +42,7 @@ jobs: fail-fast: false matrix: php-version: - - 8.2 + - 8.1 dependencies: - highest steps: diff --git a/composer.json b/composer.json index 41cb973..cd0424d 100644 --- a/composer.json +++ b/composer.json @@ -13,16 +13,16 @@ "php": ">=8.1", "guzzlehttp/guzzle": "^7.2", "monolog/monolog": "^3.0", - "psr/log": "^2.0 || ^3.0", - "godruoyi/easy-container": "^2.0 || ^3.0", - "psr/simple-cache": "^2.0 || ^3.0", + "psr/log": "^3.0", + "godruoyi/easy-container": "^3.0", + "psr/simple-cache": "^3.0", "symfony/cache": "^6.1", "ext-json": "*" }, "require-dev": { "phpunit/phpunit": "^10.1", "mockery/mockery": "^1.6", - "laravel/pint": "^1.10", + "laravel/pint": "^1.19", "ext-gd": "*" }, "autoload": { @@ -36,7 +36,7 @@ } }, "scripts": { - "test": "vendor/bin/phpunit", - "pint": "vendor/bin/pint" + "test": "vendor/bin/phpunit --display-incomplete --display-skipped --display-deprecations --display-errors --display-notices --display-warnings", + "pint": "vendor/bin/pint --config=pint.json" } } diff --git a/src/Application.php b/src/Application.php index d45c0d7..d4fc8a0 100644 --- a/src/Application.php +++ b/src/Application.php @@ -22,24 +22,18 @@ class Application extends Manager { /** * The container instance,. - * - * @var Container */ - protected $container; + protected Container $container; /** - * OCR configurage. - * - * @var array + * OCR configure. */ - protected $config; + protected array|Config $config; /** * The default service providers. - * - * @var array */ - protected $defaultProviders = [ + protected array $defaultProviders = [ Providers\HttpServiceProvider::class, Providers\LogServiceProvider::class, Providers\CacheServiceProvider::class, @@ -52,7 +46,7 @@ class Application extends Manager */ public function __construct(array $config = []) { - $this->container = new Container(); + $this->container = new Container; $this->config = new Config($config); $this->boot(); @@ -73,20 +67,19 @@ public function getContainer(): Container * * @throws Exception */ - protected function boot() + protected function boot(): void { $this->registerCore(); $this->registerDefaultProvider(); } /** - * Registe core alias and service. + * Register core alias and service. * - * @return void * * @throws Exception */ - protected function registerCore() + protected function registerCore(): void { $this->container->singleton('app', function ($app) { return $app; @@ -104,10 +97,8 @@ protected function registerCore() /** * Register default service provider. - * - * @return void */ - protected function registerDefaultProvider() + protected function registerDefaultProvider(): void { foreach ($this->defaultProviders as $p) { $this->register($p); @@ -117,9 +108,9 @@ protected function registerDefaultProvider() /** * Register a service to container. * - * @param mixed $service + * @throws Exception */ - public function register($service) + public function register(mixed $service): void { if (is_string($service) && class_exists($service)) { $service = $this->container->make($service); diff --git a/src/Clients/AliyunClient.php b/src/Clients/AliyunClient.php index 55506c6..14d6537 100644 --- a/src/Clients/AliyunClient.php +++ b/src/Clients/AliyunClient.php @@ -78,8 +78,8 @@ public function __construct(AliyunRequest $request) * * @param string|SplFIleInfo $images * @param array $options - * 参数 是否可选 类型 可选范围/说明 - * side N string 默认face,身份证正反面类型:face/back + * 参数 是否可选 类型 可选范围/说明 + * side N string 默认face,身份证正反面类型:face/back * @return array */ public function idcard($images, array $options = []) @@ -96,7 +96,7 @@ public function idcard($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * side N string 默认face,行驶证正反面类型:face/back + * side N string 默认face,行驶证正反面类型:face/back * @return array */ public function vehicle($images, array $options = []) @@ -113,8 +113,8 @@ public function vehicle($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * 参数 是否可选 类型 可选范围/说明 - * side N string 默认face,驾驶证首页/副页:face/back + * 参数 是否可选 类型 可选范围/说明 + * side N string 默认face,驾驶证首页/副页:face/back * @return array */ public function driverLicense($images, array $options = []) @@ -131,7 +131,7 @@ public function driverLicense($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * null + * null * @return array */ public function businessLicense($images, array $options = []) @@ -146,7 +146,7 @@ public function businessLicense($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * null + * null * @return array */ public function bankCard($images, array $options = []) @@ -161,7 +161,7 @@ public function bankCard($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * null + * null * @return array */ public function businessCard($images, array $options = []) @@ -176,7 +176,7 @@ public function businessCard($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * null + * null * @return array */ public function passport($images, array $options = []) @@ -191,11 +191,11 @@ public function passport($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * 参数 是否可选 类型 可选范围/说明 - * format N string format 输出格式html/json/xlsx - * dir_assure N bool 图片方向是否确定是正向的: true(确定)/false(不确定) - * line_less N bool 是否无线条: true(无线条,或者只有横线没有竖线)/false(有线条) - * skip_detection N bool 是否跳过检测,如果没有检测到表格,可以设置"skip_detection":true + * 参数 是否可选 类型 可选范围/说明 + * format N string format 输出格式html/json/xlsx + * dir_assure N bool 图片方向是否确定是正向的: true(确定)/false(不确定) + * line_less N bool 是否无线条: true(无线条,或者只有横线没有竖线)/false(有线条) + * skip_detection N bool 是否跳过检测,如果没有检测到表格,可以设置"skip_detection":true * @return array */ public function tableParse($images, array $options = []) @@ -212,7 +212,7 @@ public function tableParse($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * 参数 是否可选 类型 可选范围/说明 + * 参数 是否可选 类型 可选范围/说明 * @return array */ public function vin($images, array $options = []) @@ -227,7 +227,7 @@ public function vin($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * null + * null * @return array */ public function trainTicket($images, array $options = []) @@ -244,9 +244,9 @@ public function trainTicket($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * 参数 是否可选 类型 可选范围/说明 - * multi_crop N boolean 当设成true时,会做多crop预测,只有当多crop返回的结果一致, - * 并且置信度>0.9时,才返回结果 + * 参数 是否可选 类型 可选范围/说明 + * multi_crop N boolean 当设成true时,会做多crop预测,只有当多crop返回的结果一致, + * 并且置信度>0.9时,才返回结果 * @return array */ public function vehiclePlate($images, array $options = []) @@ -263,12 +263,12 @@ public function vehiclePlate($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * 参数 是否可选 类型 可选范围/说明 - * min_size 16, 图片中文字的最小高度,单位像素 - * output_prob true, 是否输出文字框的概率 - * output_keypoints false, 是否输出文字框角点 - * skip_detection false 是否跳过文字检测步骤直接进行文字识别 - * without_predicting_direction false 是否关闭文字行方向预测 + * 参数 是否可选 类型 可选范围/说明 + * min_size 16, 图片中文字的最小高度,单位像素 + * output_prob true, 是否输出文字框的概率 + * output_keypoints false, 是否输出文字框角点 + * skip_detection false 是否跳过文字检测步骤直接进行文字识别 + * without_predicting_direction false 是否关闭文字行方向预测 * @return array */ public function general($images, array $options = []) @@ -286,12 +286,12 @@ public function general($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * 参数 是否可选 类型 可选范围/说明 - * prob N bool 是否需要识别结果中每一行的置信度,默认不需要。 true:需要 false:不需要 - * charInfo N bool 是否需要单字识别功能,默认不需要。 true:需要 false:不需要 - * rotate N bool 是否需要自动旋转功能,默认不需要。 true:需要 false:不需要 - * table N bool 是否需要表格识别功能,默认不需要。 true:需要 false:不需要 - * sortPage N bool 字块返回顺序,false表示从左往右,从上到下的顺序,true表示从上到下,从左往右的顺序,默认false + * 参数 是否可选 类型 可选范围/说明 + * prob N bool 是否需要识别结果中每一行的置信度,默认不需要。 true:需要 false:不需要 + * charInfo N bool 是否需要单字识别功能,默认不需要。 true:需要 false:不需要 + * rotate N bool 是否需要自动旋转功能,默认不需要。 true:需要 false:不需要 + * table N bool 是否需要表格识别功能,默认不需要。 true:需要 false:不需要 + * sortPage N bool 字块返回顺序,false表示从左往右,从上到下的顺序,true表示从上到下,从左往右的顺序,默认false * @return array */ public function generalAdvanced($images, array $options = []) @@ -316,7 +316,7 @@ public function generalAdvanced($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * 参数 是否可选 类型 可选范围/说明 + * 参数 是否可选 类型 可选范围/说明 * @return array */ public function invoice($images, array $options = []) @@ -333,7 +333,7 @@ public function invoice($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * 参数 是否可选 类型 可选范围/说明 + * 参数 是否可选 类型 可选范围/说明 * @return array */ public function houseCert($images, array $options = []) @@ -350,8 +350,8 @@ public function houseCert($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * 参数 是否可选 类型 可选范围/说明 - * prob N bool 是否需要识别结果中每一行的置信度,默认不需要。 true:需要 false:不需要 + * 参数 是否可选 类型 可选范围/说明 + * prob N bool 是否需要识别结果中每一行的置信度,默认不需要。 true:需要 false:不需要 * @return array */ public function document($images, array $options = []) @@ -368,8 +368,8 @@ public function document($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * 参数 是否可选 类型 可选范围/说明 - * prob N bool 是否需要识别结果中每一行的置信度,默认不需要。 true:需要 false:不需要 + * 参数 是否可选 类型 可选范围/说明 + * prob N bool 是否需要识别结果中每一行的置信度,默认不需要。 true:需要 false:不需要 * @return array */ public function ugc($images, array $options = []) @@ -386,8 +386,8 @@ public function ugc($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * 参数 是否可选 类型 可选范围/说明 - * prob N bool 是否需要识别结果中每一行的置信度,默认不需要。 true:需要 false:不需要 + * 参数 是否可选 类型 可选范围/说明 + * prob N bool 是否需要识别结果中每一行的置信度,默认不需要。 true:需要 false:不需要 * @return array */ public function custom($images, array $options = []) @@ -404,8 +404,8 @@ public function custom($images, array $options = []) * * @param string|SplFIleInfo $images * @param array $options - * 参数 是否可选 类型 可选范围/说明 - * prob N bool 是否需要识别结果中每一行的置信度,默认不需要。 true:需要 false:不需要 + * 参数 是否可选 类型 可选范围/说明 + * prob N bool 是否需要识别结果中每一行的置信度,默认不需要。 true:需要 false:不需要 * @return array */ public function ecommerce($images, array $options = []) diff --git a/src/Clients/BaiduClient.php b/src/Clients/BaiduClient.php index 7fcb7dc..743bad6 100644 --- a/src/Clients/BaiduClient.php +++ b/src/Clients/BaiduClient.php @@ -274,13 +274,13 @@ public function asynTable($images, array $options = []) * @see https://ai.baidu.com/ai-doc/OCR/Ik3h7y238 * * @param string|\SplFileInfo $requestId - * @param array $requestType 期望获取结果的类型,取值为 “excel” 时返回 xls 文件的地址, - * 取值为 “json” 时返回 json 格式的字符串,默认为 ”excel” + * @param array $requestType 期望获取结果的类型,取值为 “excel” 时返回 xls 文件的地址, + * 取值为 “json” 时返回 json 格式的字符串,默认为 ”excel” * @return array * * @throws \RuntimeException */ - public function asynTableInfo(string $requestId, string $requestType = null) + public function asynTableInfo(string $requestId, ?string $requestType = null) { $uri = 'https://aip.baidubce.com/rest/2.0/solution/v1/form_ocr/get_request_result'; diff --git a/src/Manager.php b/src/Manager.php index 6f964cd..26265bf 100644 --- a/src/Manager.php +++ b/src/Manager.php @@ -56,7 +56,7 @@ abstract public function getDefaultDriver(); /** * Get a driver instance. */ - public function driver(string $driver = null): Client + public function driver(?string $driver = null): Client { $driver = $driver ?: $this->getDefaultDriver(); diff --git a/src/Providers/HttpServiceProvider.php b/src/Providers/HttpServiceProvider.php index 9bc3146..fe195b8 100644 --- a/src/Providers/HttpServiceProvider.php +++ b/src/Providers/HttpServiceProvider.php @@ -24,7 +24,7 @@ class HttpServiceProvider implements ServiceProviderInterface public function register(ContainerInterface $container) { $container->singleton('http', function ($app) { - $http = new Http(); + $http = new Http; $http->customHttpHandler($this->processHttpError()); diff --git a/src/Requests/Request.php b/src/Requests/Request.php index 683b087..7721090 100644 --- a/src/Requests/Request.php +++ b/src/Requests/Request.php @@ -100,9 +100,7 @@ protected function middlewares(): array /** * custon init method. */ - protected function init() - { - } + protected function init() {} /** * Translation $images and $options to guzzle http options. diff --git a/src/Support/Arr.php b/src/Support/Arr.php index 3448e07..60761ce 100644 --- a/src/Support/Arr.php +++ b/src/Support/Arr.php @@ -93,7 +93,7 @@ public static function exists($array, $key) * @param mixed $default * @return mixed */ - public static function first($array, callable $callback = null, $default = null) + public static function first($array, ?callable $callback = null, $default = null) { if (is_null($callback)) { if (empty($array)) { @@ -121,7 +121,7 @@ public static function first($array, callable $callback = null, $default = null) * @param mixed $default * @return mixed */ - public static function last($array, callable $callback = null, $default = null) + public static function last($array, ?callable $callback = null, $default = null) { if (is_null($callback)) { return empty($array) ? self::vvalue($default) : end($array); diff --git a/src/Support/BaiduAccessToken.php b/src/Support/BaiduAccessToken.php index facaac4..c2bba9b 100644 --- a/src/Support/BaiduAccessToken.php +++ b/src/Support/BaiduAccessToken.php @@ -29,13 +29,13 @@ class BaiduAccessToken private $tokenKey; - public function __construct(Http $http, CacheInterface $cache, string $secretID = null, string $secretKey = null) + public function __construct(Http $http, CacheInterface $cache, ?string $secretID = null, ?string $secretKey = null) { $this->secretID = $secretID; $this->secretKey = $secretKey; $this->http = $http; $this->cache = $cache; - $this->tokenKey = self::CACHE_KEY . '.' . $secretID; + $this->tokenKey = self::CACHE_KEY.'.'.$secretID; } public function getAccessToken(): string diff --git a/src/Support/FileConverter.php b/src/Support/FileConverter.php index 2b4125d..c4f306e 100644 --- a/src/Support/FileConverter.php +++ b/src/Support/FileConverter.php @@ -64,7 +64,7 @@ public static function getOnlineImageContent($url) } try { - $http = self::$http ?? new Http(); + $http = self::$http ?? new Http; $response = $http->get($url); diff --git a/src/Support/Http.php b/src/Support/Http.php index 507d528..227bf3b 100644 --- a/src/Support/Http.php +++ b/src/Support/Http.php @@ -146,7 +146,7 @@ public function json($url, $data = [], $queries = [], array $options = [], $enco * * @return mixed */ - public function middlewares(callable $middleware, string $name = null) + public function middlewares(callable $middleware, ?string $name = null) { $this->middlewares[] = compact('middleware', 'name'); } @@ -171,7 +171,7 @@ public function customHttpHandler(callable $fu) public function getClient() { if (empty($this->client) || ! ($this->client instanceof HttpClient)) { - $this->client = new HttpClient(); + $this->client = new HttpClient; } return $this->client; diff --git a/src/Support/Response.php b/src/Support/Response.php index 2fccc6b..2b3d723 100644 --- a/src/Support/Response.php +++ b/src/Support/Response.php @@ -90,11 +90,7 @@ public function offsetGet(mixed $offset): mixed return null; } - public function offsetSet(mixed $offset, mixed $value): void - { - } + public function offsetSet(mixed $offset, mixed $value): void {} - public function offsetUnset(mixed $offset): void - { - } + public function offsetUnset(mixed $offset): void {} } diff --git a/tests/ApplicationTest.php b/tests/ApplicationTest.php index 2c86eae..35bb2b9 100644 --- a/tests/ApplicationTest.php +++ b/tests/ApplicationTest.php @@ -24,7 +24,7 @@ class ApplicationTest extends TestCase { - public function testBasic() + public function test_basic() { $application = new Application($this->config); $this->assertInstanceOf(Application::class, $application); @@ -35,7 +35,7 @@ public function testBasic() $this->assertInstanceOf(Config::class, $app['config']); } - public function testAppHasRegisteredCoreComponent() + public function test_app_has_registered_core_component() { $application = new Application(['a' => 1]); $app = $application->getContainer(); @@ -45,13 +45,13 @@ public function testAppHasRegisteredCoreComponent() $this->assertTrue($app->bound('log')); } - public function testGetContainer() + public function test_get_container() { $application = new Application(['a' => 1]); $this->assertInstanceOf(Container::class, $application->getContainer()); } - public function testRegisterServiceProvider() + public function test_register_service_provider() { $this->application->register(CustomServiceProvider::class); @@ -68,7 +68,7 @@ public function testRegisterServiceProvider() $this->assertSame('custom', $app->get('custom3')); } - public function testRegisterServiceProviderNotExists() + public function test_register_service_provider_not_exists() { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Unsupported registration types'); @@ -76,7 +76,7 @@ public function testRegisterServiceProviderNotExists() $this->application->register('not_exists'); } - public function testRegisterServiceClosure() + public function test_register_service_closure() { $this->application->register(function ($app) { $app->singleton('custom', function () { @@ -101,14 +101,14 @@ public function testRegisterServiceClosure() $this->assertSame('custom', $app->get('custom3')); } - public function testGet() + public function test_get() { $this->assertInstanceOf(AliyunClient::class, $this->application->aliyun); $this->assertInstanceOf(BaiduClient::class, $this->application->baidu); $this->assertInstanceOf(TencentClient::class, $this->application->tencent); } - public function testGetUndefinedService() + public function test_get_undefined_service() { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Driver [foo] not supported.'); @@ -116,7 +116,7 @@ public function testGetUndefinedService() $this->application->foo->x(); } - public function testGetDefaultDriver() + public function test_get_default_driver() { $app = new Application([ 'default' => 'aliyun', @@ -125,28 +125,28 @@ public function testGetDefaultDriver() $this->assertSame('aliyun', $app->getDefaultDriver()); } - public function testGetDefaultDriverEmpty() + public function test_get_default_driver_empty() { - $app = new Application(); + $app = new Application; $this->assertEmpty($app->getDefaultDriver()); } - public function testGetDefaultDriver2() + public function test_get_default_driver2() { $this->assertSame('aliyun', $this->application->getDefaultDriver()); } - public function testDriver() + public function test_driver() { - $app = new Application(); + $app = new Application; $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Unable to resolve NULL driver for [Godruoyi\OCR\Application].'); $app->driver(null); } - public function testCreateDriverNotExists() + public function test_create_driver_not_exists() { $app = new Application([ 'default' => 'foo', @@ -157,9 +157,9 @@ public function testCreateDriverNotExists() $app->driver(null); } - public function testCallDriverManyTimesShouldSameInstance() + public function test_call_driver_many_times_should_same_instance() { - $app = new Application(); + $app = new Application; $a = $app->driver('aliyun'); $b = $app->driver('aliyun'); @@ -167,9 +167,9 @@ public function testCallDriverManyTimesShouldSameInstance() $this->assertSame($a, $b); } - public function testGetDrivers() + public function test_get_drivers() { - $app = new Application(); + $app = new Application; $this->assertSame([], array_keys($app->getDrivers())); @@ -183,7 +183,7 @@ public function testGetDrivers() $this->assertSame(['aliyun', 'baidu'], array_keys($app->getDrivers())); } - public function testExtends() + public function test_extends() { $app = new Application([ 'default' => 'foo', @@ -200,7 +200,7 @@ public function testExtends() $this->assertSame('foo', $app->driver('foo')); } - public function testCallMethod() + public function test_call_method() { $app = $this->application->getContainer(); @@ -210,14 +210,14 @@ public function testCallMethod() $this->assertSame('OK1', $this->application->aliyun->idcard(__DIR__.'/stubs/common.png')->getBody()->getContents()); } - public function testCallNotExistsDriver() + public function test_call_not_exists_driver() { $this->expectException(InvalidArgumentException::class); $this->application->tencentAi->idcard(); } - public function testCallMethodWithDefault() + public function test_call_method_with_default() { $app = $this->application->getContainer(); @@ -227,9 +227,9 @@ public function testCallMethodWithDefault() $this->assertSame('OK1', $this->application->idcard(__DIR__.'/stubs/common.png')->getBody()->getContents()); } - public function testRebindCache() + public function test_rebind_cache() { - $this->application->rebindCache(new Psr16Cache(new NullAdapter())); + $this->application->rebindCache(new Psr16Cache(new NullAdapter)); $this->assertInstanceOf(CacheInterface::class, $this->application->getContainer()['cache']); } diff --git a/tests/Clients/AliyunClientTest.php b/tests/Clients/AliyunClientTest.php index 8866ce9..8decf9a 100644 --- a/tests/Clients/AliyunClientTest.php +++ b/tests/Clients/AliyunClientTest.php @@ -20,14 +20,14 @@ class AliyunClientTest extends TestCase { - public function testClient() + public function test_client() { $c = $this->application->aliyun; $this->assertInstanceOf(AliyunClient::class, $c); } - public function testBasic() + public function test_basic() { $methods = [ 'idcard', @@ -71,7 +71,7 @@ public function testBasic() } } - public function testManyImage() + public function test_many_image() { $app = $this->application->getContainer(); diff --git a/tests/Clients/BaiduClientTest.php b/tests/Clients/BaiduClientTest.php index 4ff1ea7..244ea6c 100644 --- a/tests/Clients/BaiduClientTest.php +++ b/tests/Clients/BaiduClientTest.php @@ -18,14 +18,14 @@ class BaiduClientTest extends TestCase { - public function testBasic() + public function test_basic() { $baidu = $this->application->baidu; $this->assertInstanceOf(BaiduClient::class, $baidu); } - public function testAllMethods() + public function test_all_methods() { $methods = [ 'generalBasic', @@ -101,7 +101,7 @@ public function testAllMethods() } } - public function testGeneralBasic() + public function test_general_basic() { $http = $this->application->getContainer()['http']; $http = $this->mockHttpWithResponse([ diff --git a/tests/Clients/BaseClientTest.php b/tests/Clients/BaseClientTest.php index 2326a65..da6eacf 100644 --- a/tests/Clients/BaseClientTest.php +++ b/tests/Clients/BaseClientTest.php @@ -16,7 +16,7 @@ class BaseClientTest extends TestCase { - public function testExtend() + public function test_extend() { $this->application->aliyun->extend('hello', function ($request, $a, $b) { return new Response(200, [], $a + $b); @@ -27,7 +27,7 @@ public function testExtend() $this->assertEquals('3', $response->getBody()->getContents()); } - public function testCallNotExistsMethod() + public function test_call_not_exists_method() { $this->expectException(BadMethodCallException::class); diff --git a/tests/Clients/CustomClientTest.php b/tests/Clients/CustomClientTest.php index 160a014..32a020f 100644 --- a/tests/Clients/CustomClientTest.php +++ b/tests/Clients/CustomClientTest.php @@ -15,7 +15,7 @@ class CustomClientTest extends TestCase { - public function testCustom() + public function test_custom() { $this->application->extend('huawei', function ($container) { return $container->make(HuaweiClient::class); diff --git a/tests/Clients/RealRequestClientTest.php b/tests/Clients/RealRequestClientTest.php index 0eb18f1..60c2464 100644 --- a/tests/Clients/RealRequestClientTest.php +++ b/tests/Clients/RealRequestClientTest.php @@ -15,7 +15,7 @@ class RealRequestClientTest extends TestCase { - public function testFireRealAliyunRequest() + public function test_fire_real_aliyun_request() { $d = $this->application->aliyun; $response = $d->ugc(__DIR__.'/../stubs/common.png', []); @@ -38,7 +38,7 @@ public function testFireRealAliyunRequest() $this->assertIsArray($json); } - public function testFireRealBaiduRequest() + public function test_fire_real_baidu_request() { $d = $this->application->baidu; $response = $d->businessCard(__DIR__.'/../stubs/common.png', []); @@ -49,7 +49,7 @@ public function testFireRealBaiduRequest() $this->assertNotEmpty($response->toArray()); } - public function testFireRealTencentRequest() + public function test_fire_real_tencent_request() { $d = $this->application->tencent; $response = $d->generalBasic(__DIR__.'/../stubs/common.png', [ diff --git a/tests/Clients/TencentClientTest.php b/tests/Clients/TencentClientTest.php index 7bbcf6d..9ed904d 100644 --- a/tests/Clients/TencentClientTest.php +++ b/tests/Clients/TencentClientTest.php @@ -18,14 +18,14 @@ class TencentClientTest extends TestCase { - public function testBasic() + public function test_basic() { $tencent = $this->application->tencent; $this->assertInstanceOf(TencentClient::class, $tencent); } - public function testAllMethod() + public function test_all_method() { $methods = [ 'generalBasic', diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index 867b937..2286e27 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -14,14 +14,14 @@ class ConfigTest extends TestCase { - public function testBasic() + public function test_basic() { - $c = new Config(); + $c = new Config; $this->assertInstanceOf(Config::class, $c); } - public function testGetArray() + public function test_get_array() { $c = new Config([ 'a' => [ diff --git a/tests/CustomServiceProvider.php b/tests/CustomServiceProvider.php index 151d669..a490e23 100644 --- a/tests/CustomServiceProvider.php +++ b/tests/CustomServiceProvider.php @@ -26,7 +26,7 @@ class CustomServiceProvider implements ServiceProviderInterface * This method should only be used to configure services and parameters. * It should not get services. * - * @param ContainerInterface $container A container instance + * @param ContainerInterface $container A container instance */ public function register(ContainerInterface $container) { diff --git a/tests/Requests/AliyunRequestTest.php b/tests/Requests/AliyunRequestTest.php index b6c5c5f..732bec8 100644 --- a/tests/Requests/AliyunRequestTest.php +++ b/tests/Requests/AliyunRequestTest.php @@ -23,7 +23,7 @@ class AliyunRequestTest extends TestCase /** * @throws Exception */ - public function testBasicSend() + public function test_basic_send() { $app = new Application([ 'drivers' => [ @@ -42,7 +42,7 @@ public function testBasicSend() $this->assertSame('OK', $response->getBody()->getContents()); } - public function testBasicSendEnableLog() + public function test_basic_send_enable_log() { $app = new Application([ 'drivers' => [ @@ -67,7 +67,7 @@ public function testBasicSendEnableLog() $this->assertSame('OK', $response->getBody()->getContents()); } - public function testCanNotUseSecretIDAndSecret() + public function test_can_not_use_secret_id_and_secret() { $app = new Application([ 'drivers' => [ @@ -89,7 +89,7 @@ public function testCanNotUseSecretIDAndSecret() $request->send('url', __DIR__.'/../stubs/common.png'); } - public function testUseAppCode() + public function test_use_app_code() { $app = new Application([ 'drivers' => [ @@ -109,7 +109,7 @@ public function testUseAppCode() $this->assertSame('OK', $response->getBody()->getContents()); } - public function testInvalidImagesShouldThrowAError() + public function test_invalid_images_should_throw_a_error() { $this->expectException(InvalidArgumentException::class); @@ -117,7 +117,7 @@ public function testInvalidImagesShouldThrowAError() $request->send('url', []); } - public function testInvalidFormatType() + public function test_invalid_format_type() { $this->expectException(InvalidArgumentException::class); @@ -125,7 +125,7 @@ public function testInvalidFormatType() $request->send('url', [], ['_format' => 'invalid']); } - public function testFormatInputsIsURLImage() + public function test_format_inputs_is_url_image() { $http = $this->mockeryHttp(); $http->shouldReceive('json') @@ -140,7 +140,7 @@ public function testFormatInputsIsURLImage() $this->assertSame('OK', $response->getBody()->getContents()); } - public function testFormatInputs() + public function test_format_inputs() { $http = $this->mockeryHttp(); $http->shouldReceive('json') @@ -157,7 +157,7 @@ public function testFormatInputs() $this->assertSame('OK', $response->getBody()->getContents()); } - public function testFormatBasic() + public function test_format_basic() { $http = $this->mockeryHttp(); $http->shouldReceive('json') @@ -174,7 +174,7 @@ public function testFormatBasic() $this->assertSame('OK', $response->getBody()->getContents()); } - public function testFormatBasicIsURLImage() + public function test_format_basic_is_url_image() { $http = $this->mockeryHttp(); $http->shouldReceive('json') @@ -189,7 +189,7 @@ public function testFormatBasicIsURLImage() $this->assertSame('OK', $response->getBody()->getContents()); } - public function testFormatImgOrUrl() + public function test_format_img_or_url() { $http = $this->mockeryHttp(); $http->shouldReceive('json') diff --git a/tests/Requests/BaseRequestTest.php b/tests/Requests/BaseRequestTest.php index 26ca673..42ca171 100644 --- a/tests/Requests/BaseRequestTest.php +++ b/tests/Requests/BaseRequestTest.php @@ -21,7 +21,7 @@ class BaseRequestTest extends TestCase { - public function testUrlAuto2Base64() + public function test_url_auto2_base64() { $http = $this->mockeryHttp(); @@ -62,7 +62,7 @@ public function testUrlAuto2Base64() $this->assertSame('OK', $response->getBody()->getContents()); } - public function testSupportOnlineInamge() + public function test_support_online_inamge() { $http = $this->mockeryHttp(); diff --git a/tests/Requests/TencentRequestTest.php b/tests/Requests/TencentRequestTest.php index 5e304f6..cf0e400 100644 --- a/tests/Requests/TencentRequestTest.php +++ b/tests/Requests/TencentRequestTest.php @@ -16,7 +16,7 @@ class TencentRequestTest extends TestCase { - public function testSupportOnlineImages() + public function test_support_online_images() { $http = $this->mockeryHttp(); diff --git a/tests/Support/ArrTest.php b/tests/Support/ArrTest.php index 4f58753..bace044 100644 --- a/tests/Support/ArrTest.php +++ b/tests/Support/ArrTest.php @@ -16,7 +16,7 @@ class ArrTest extends TestCase { - public function testSortRecursive() + public function test_sort_recursive() { $array = [ 'foo' => 'bar', @@ -37,7 +37,7 @@ public function testSortRecursive() $this->assertEquals($expected, Arr::sortRecursive($array)); } - public function testExcept() + public function test_except() { $array = [ 'foo' => 'bar', @@ -57,7 +57,7 @@ public function testExcept() $this->assertSame($expected, Arr::except($array, ['bar.foo'])); } - public function testFirst() + public function test_first() { $array = [ 'foo' => 'bar', @@ -79,7 +79,7 @@ public function testFirst() }, 'default')); } - public function testDot() + public function test_dot() { $array = [ 'foo' => 'bar', @@ -94,7 +94,7 @@ public function testDot() $this->assertSame('default', Arr::get($array, 'bar.baz.foo', 'default')); } - public function testRandom() + public function test_random() { $array = [ 'foo', 'bar', 'baz', @@ -108,7 +108,7 @@ public function testRandom() Arr::random($array, 4); } - public function testDivide() + public function test_divide() { $array = [ 'k1' => 'v1', @@ -123,7 +123,7 @@ public function testDivide() $this->assertSame($expected, Arr::divide($array)); } - public function testOnly() + public function test_only() { $array = [ 'foo' => 'bar', @@ -140,7 +140,7 @@ public function testOnly() $this->assertSame($expected, Arr::only($array, 'foo')); } - public function testSet() + public function test_set() { $array = [ 'foo' => 'bar', @@ -155,7 +155,7 @@ public function testSet() $this->assertSame('barbar', Arr::get($array, 'bar.foo')); } - public function testVvalue() + public function test_vvalue() { $this->assertSame('foo', Arr::vvalue('foo')); $this->assertSame('foo', Arr::vvalue(function () { @@ -163,7 +163,7 @@ public function testVvalue() })()); } - public function testHasAny() + public function test_has_any() { $array = [ 'foo' => 'bar', @@ -181,7 +181,7 @@ public function testHasAny() $this->assertFalse(Arr::hasAny($array, 'bar.bax')); } - public function testWhere() + public function test_where() { $array = [ 'foo' => 'foo', @@ -193,7 +193,7 @@ public function testWhere() })); } - public function testExists() + public function test_exists() { $array = [ 'foo' => 'foo', @@ -205,7 +205,7 @@ public function testExists() $this->assertFalse(Arr::exists($array, 'baz')); } - public function testShuffle() + public function test_shuffle() { $array = [ 'foo', 'bar', 'baz', @@ -215,7 +215,7 @@ public function testShuffle() $this->assertSame(count($array), count(Arr::shuffle($array, time()))); } - public function testPrepend() + public function test_prepend() { $array = [ 'foo', 'bar', 'baz', @@ -226,7 +226,7 @@ public function testPrepend() $this->assertEquals(['foo', 'bar', 'zoo'], Arr::prepend($array, 'zoo', 2)); } - public function testQuery() + public function test_query() { $array = [ 'foo' => 'foo', @@ -236,7 +236,7 @@ public function testQuery() $this->assertSame('foo=foo&bar=bar', Arr::query($array)); } - public function testGet() + public function test_get() { $array = [ 'foo' => 'foo', @@ -248,7 +248,7 @@ public function testGet() $this->assertSame('default', Arr::get($array, 'baz', 'default')); } - public function testPull() + public function test_pull() { $array = [ 'foo' => 'foo', @@ -261,7 +261,7 @@ public function testPull() $this->assertSame('default', Arr::pull($array, 'baz', 'default')); } - public function testAccessible() + public function test_accessible() { $array = [ 'foo' => 'foo', @@ -271,7 +271,7 @@ public function testAccessible() $this->assertTrue(Arr::accessible($array)); } - public function testIsAssoc() + public function test_is_assoc() { $array = [ 'foo' => 'foo', @@ -281,7 +281,7 @@ public function testIsAssoc() $this->assertTrue(Arr::isAssoc($array)); } - public function testAdd() + public function test_add() { $array = [ 'foo' => 'foo', @@ -291,7 +291,7 @@ public function testAdd() $this->assertSame(['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz'], Arr::add($array, 'baz', 'baz')); } - public function testLast() + public function test_last() { $array = [ 'foo' => 'foo', @@ -301,7 +301,7 @@ public function testLast() $this->assertSame('bar', Arr::last($array)); } - public function testHas() + public function test_has() { $array = [ 'foo' => 'foo', @@ -313,14 +313,14 @@ public function testHas() $this->assertFalse(Arr::has($array, 'baz')); } - public function testWrap() + public function test_wrap() { $this->assertSame([1], Arr::wrap(1)); $this->assertSame([1, 2], Arr::wrap([1, 2])); $this->assertSame([], Arr::wrap(null)); } - public function testForget() + public function test_forget() { $array = [ 'foo' => 'foo', @@ -341,13 +341,13 @@ public function testForget() $this->assertArrayHasKey('foo', $array); } - public function testMacro() + public function test_macro() { Arr::macro('test', function () { return 'test'; }); - $arr = new Arr(); + $arr = new Arr; $this->assertTrue(Arr::hasMacro('test')); $this->assertSame('test', Arr::test()); diff --git a/tests/Support/BaiduAccessTokenTest.php b/tests/Support/BaiduAccessTokenTest.php index 7fc25b5..0fb2be2 100644 --- a/tests/Support/BaiduAccessTokenTest.php +++ b/tests/Support/BaiduAccessTokenTest.php @@ -19,7 +19,7 @@ class BaiduAccessTokenTest extends TestCase { - public function testGetAccessToken() + public function test_get_access_token() { $http = $this->mockeryHttp(); $http->shouldReceive('json') @@ -45,7 +45,7 @@ public function testGetAccessToken() $this->assertSame('access_token2', $token->getAccessToken()); } - public function testGetAccessTokenFail() + public function test_get_access_token_fail() { $http = $this->mockeryHttp(); $http->shouldReceive('json') diff --git a/tests/Support/EncoderTest.php b/tests/Support/EncoderTest.php index 308396d..effd86b 100644 --- a/tests/Support/EncoderTest.php +++ b/tests/Support/EncoderTest.php @@ -15,7 +15,7 @@ class EncoderTest extends TestCase { - public function testGetCanonicalHeaders() + public function test_get_canonical_headers() { $headers = [ 'A' => ' a ', diff --git a/tests/Support/FileConverterTest.php b/tests/Support/FileConverterTest.php index ea14ed3..cbbe5a0 100644 --- a/tests/Support/FileConverterTest.php +++ b/tests/Support/FileConverterTest.php @@ -19,22 +19,22 @@ class FileConverterTest extends TestCase { - public function testIsString() + public function test_is_string() { $this->assertFalse(is_string(FileConverter::isString('test'))); } - public function testIsResource() + public function test_is_resource() { $this->assertTrue(FileConverter::isResource(fopen('php://temp', 'r'))); } - public function testIsUrl() + public function test_is_url() { $this->assertTrue(FileConverter::isUrl('https://www.baidu.com')); } - public function testGetContent() + public function test_get_content() { $http = $this->mockHttpWithResponse(new Response(200, [], 'test')); FileConverter::setHttp($http); @@ -59,7 +59,7 @@ public function testGetContent() } } - public function testGetContentImage() + public function test_get_content_image() { $image = imagecreate(100, 100); @@ -67,29 +67,29 @@ public function testGetContentImage() $this->assertNotEmpty(FileConverter::getContent($image)); } - public function testGetContentInvalidString() + public function test_get_content_invalid_string() { $this->expectException(RuntimeException::class); $this->assertNotEmpty(FileConverter::getContent('invalid')); } - public function testGetContentInvalidType() + public function test_get_content_invalid_type() { $this->expectException(RuntimeException::class); - $this->assertNotEmpty(FileConverter::getContent(new stdClass())); + $this->assertNotEmpty(FileConverter::getContent(new stdClass)); } - public function testIsImage() + public function test_is_image() { $this->assertTrue(FileConverter::isImage(imagecreate(100, 100))); } - public function testIsSplFileInfo() + public function test_is_spl_file_info() { $this->assertTrue(FileConverter::isSplFileInfo(new SplFileInfo(__DIR__.'/../stubs/config.php'))); } - public function testGetOnlineImageContent() + public function test_get_online_image_content() { $http = $this->mockHttpWithResponse(new Response(200, [], 'test')); FileConverter::setHttp($http); @@ -98,12 +98,12 @@ public function testGetOnlineImageContent() $this->assertSame('test', FileConverter::getOnlineImageContent('https://example.com')); } - public function testIsFile() + public function test_is_file() { $this->assertTrue(FileConverter::isFile(__DIR__.'/../stubs/config.php')); } - public function testToBase64Encode() + public function test_to_base64_encode() { $http = $this->mockHttpWithResponse(new Response(200, [], 'test')); FileConverter::setHttp($http); diff --git a/tests/Support/LoggerTest.php b/tests/Support/LoggerTest.php index b0b32e2..ae9300b 100644 --- a/tests/Support/LoggerTest.php +++ b/tests/Support/LoggerTest.php @@ -27,7 +27,7 @@ protected function getLogger(): Logger return $this->application->getContainer()['logger']; } - public function testDebug() + public function test_debug() { $log = $this->getLogger(); @@ -36,7 +36,7 @@ public function testDebug() $this->assertTrue(true); } - public function testSetDefaultDriver() + public function test_set_default_driver() { $log = new Logger([ 'default' => 'daily', @@ -56,14 +56,14 @@ public function testSetDefaultDriver() $this->assertInstanceOf(ErrorLogHandler::class, $log->driver()->getHandlers()[0]); } - public function testAlert() + public function test_alert() { $this->getLogger()->alert('alert message'); $this->assertTrue(true); } - public function testDriver() + public function test_driver() { $log = $this->getLogger(); @@ -91,35 +91,35 @@ public function testDriver() $log->driver()->log('debug', 'debug message'); } - public function testEmergency() + public function test_emergency() { $this->getLogger()->emergency('emergency message'); $this->assertTrue(true); } - public function testLog() + public function test_log() { $this->getLogger()->log('info', 'info message'); $this->assertTrue(true); } - public function testError() + public function test_error() { $this->getLogger()->error('error message'); $this->assertTrue(true); } - public function testWarning() + public function test_warning() { $this->getLogger()->warning('warning message'); $this->assertTrue(true); } - public function testExtend() + public function test_extend() { $log = new Logger([ 'default' => 'daily', @@ -146,49 +146,49 @@ public function test__call() $this->assertTrue(true); } - public function testChannel() + public function test_channel() { $log = $this->getLogger(); $this->assertInstanceOf(StreamHandler::class, $log->channel('daily')->getHandlers()[0]); } - public function testInfo() + public function test_info() { $this->getLogger()->info('info message'); $this->assertTrue(true); } - public function testNotice() + public function test_notice() { $this->getLogger()->notice('notice message'); $this->assertTrue(true); } - public function testStack() + public function test_stack() { $this->getLogger()->stack(['daily', 'errorlog']); $this->assertTrue(true); } - public function testCritical() + public function test_critical() { $this->getLogger()->critical('critical message'); $this->assertTrue(true); } - public function testCall() + public function test_call() { $this->getLogger()->info('info message'); $this->assertTrue(true); } - public function testCreateSyslogDriver() + public function test_create_syslog_driver() { $log = new Logger([ 'default' => 'daily', @@ -206,7 +206,7 @@ public function testCreateSyslogDriver() $this->assertInstanceOf(SyslogHandler::class, $log->driver()->getHandlers()[0]); } - public function testCreateSlackDriver() + public function test_create_slack_driver() { $log = new Logger([ 'default' => 'slack', @@ -223,7 +223,7 @@ public function testCreateSlackDriver() $this->assertInstanceOf(SlackWebhookHandler::class, $log->driver()->getHandlers()[0]); } - public function testCreateSingleDriver() + public function test_create_single_driver() { $log = new Logger([ 'default' => 'single', @@ -240,7 +240,7 @@ public function testCreateSingleDriver() $this->assertInstanceOf(StreamHandler::class, $log->driver()->getHandlers()[0]); } - public function testInvalideType() + public function test_invalide_type() { $log = new Logger([ 'default' => 'daily', @@ -258,7 +258,7 @@ public function testInvalideType() $this->assertInstanceOf(StreamHandler::class, $log->driver()->getHandlers()[0]); } - public function testInvalidLevel() + public function test_invalid_level() { $log = new Logger([ 'default' => 'daily', diff --git a/tests/Support/ResponseTest.php b/tests/Support/ResponseTest.php index 0741ab9..8e8a74b 100644 --- a/tests/Support/ResponseTest.php +++ b/tests/Support/ResponseTest.php @@ -15,7 +15,7 @@ class ResponseTest extends TestCase { - public function testToArray() + public function test_to_array() { $response = new Response(200, [], ''); $this->assertSame([], $response->toArray()); @@ -27,7 +27,7 @@ public function testToArray() $this->assertSame(['a' => 1], $response->toArray()); } - public function testOfsetGet() + public function test_ofset_get() { $response = new Response(200, [], '{"a":1}'); $this->assertSame(1, $response['a']); @@ -35,7 +35,7 @@ public function testOfsetGet() $this->assertNull($response->offsetGet('b')); } - public function testOffsetExists() + public function test_offset_exists() { $response = new Response(200, [], '{"a":1}'); @@ -43,7 +43,7 @@ public function testOffsetExists() $this->assertFalse(isset($response['b'])); } - public function testToJson() + public function test_to_json() { $response = new Response(200, [], '{"a":1}'); $this->assertSame('{"a":1}', $response->toJson()); diff --git a/tests/Support/TencentSignatureV3Test.php b/tests/Support/TencentSignatureV3Test.php index f8c3204..244904c 100644 --- a/tests/Support/TencentSignatureV3Test.php +++ b/tests/Support/TencentSignatureV3Test.php @@ -22,7 +22,7 @@ class TencentSignatureV3Test extends TestCase protected $secretKey = 'Gu5t9xGARNpq86cd98joQYCN3*******'; - public function testHashedRequestPayload() + public function test_hashed_request_payload() { $signer = new TencentSignatureV3($this->secretId, $this->secretKey); $body = '{"Limit": 1, "Filters": [{"Values": ["\u672a\u547d\u540d"], "Name": "instance-name"}]}'; @@ -30,7 +30,7 @@ public function testHashedRequestPayload() $this->assertSame($signer->hashedRequestPayload($body), '35e9c5b0e3ae67532d3c9f17ead6c90222632e5b1ff7f6e89887f1398934f064'); } - public function testCanonicalRequest() + public function test_canonical_request() { $signer = new TencentSignatureV3($this->secretId, $this->secretKey); @@ -51,7 +51,7 @@ public function testCanonicalRequest() $this->assertSame($signer->canonicalRequest($request), "POST\n/\n\ncontent-type:application/json; charset=utf-8\nhost:cvm.tencentcloudapi.com\n\ncontent-type;host\n35e9c5b0e3ae67532d3c9f17ead6c90222632e5b1ff7f6e89887f1398934f064"); } - public function testAuthorizationInvalidArgumentException() + public function test_authorization_invalid_argument_exception() { $this->expectException(InvalidArgumentException::class); diff --git a/tests/TestCase.php b/tests/TestCase.php index 18e511a..0c5cffd 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -37,7 +37,7 @@ protected function setUp(): void /** * Clean up after running a test. */ - public function tearDown(): void + protected function tearDown(): void { Mockery::close(); @@ -57,7 +57,7 @@ protected function mockHttpWithResponseAndHistory($http, $response, &$container protected function mockHttpWithResponse($response, $http = null): Http { if (! $http) { - $http = new Http(); + $http = new Http; } $http->customHttpHandler(function ($stack) use ($response) { From 9c9b5bf742b2e3743af4870665938a8c86f1c869 Mon Sep 17 00:00:00 2001 From: Godruoyi Date: Thu, 2 Jan 2025 18:06:09 +0800 Subject: [PATCH 2/2] only allow run ci when PR --- .github/workflows/php.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/php.yaml b/.github/workflows/php.yaml index bd97e5c..802edbf 100644 --- a/.github/workflows/php.yaml +++ b/.github/workflows/php.yaml @@ -1,7 +1,6 @@ name: php on: pull_request: - push: jobs: phptests: runs-on: ${{ matrix.operating-system }}