build(composer): 引入 pest 并升级到 php8.1

Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
This commit is contained in:
李东云
2023-09-26 10:41:15 +08:00
parent d84855f038
commit dbbe278aa6
9 changed files with 11692 additions and 11525 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
vendor/ vendor/
.phpunit.result.cache .phpunit.result.cache
.php-cs-fixer.cache .php-cs-fixer.cache
runtime/

2
.idea/HDK-Core.iml generated
View File

@@ -3,7 +3,6 @@
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="Singularity\HDK\Core\" /> <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="Singularity\HDK\Core\" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" packagePrefix="Singularity\HDK\Test\Core\" /> <sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" packagePrefix="Singularity\HDK\Test\Core\" />
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/recursion-context" /> <excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/recursion-context" />
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/lines-of-code" /> <excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/lines-of-code" />
@@ -158,6 +157,7 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/hyperf/serializer" /> <excludeFolder url="file://$MODULE_DIR$/vendor/hyperf/serializer" />
<excludeFolder url="file://$MODULE_DIR$/vendor/hyperf/stringable" /> <excludeFolder url="file://$MODULE_DIR$/vendor/hyperf/stringable" />
<excludeFolder url="file://$MODULE_DIR$/vendor/hyperf/support" /> <excludeFolder url="file://$MODULE_DIR$/vendor/hyperf/support" />
<excludeFolder url="file://$MODULE_DIR$/vendor/cooper/hyperf-pest" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />

6
.idea/pest.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PestSettings">
<option name="preferredTestFlavor" value="TEST" />
</component>
</project>

3
.idea/php.xml generated
View File

@@ -175,9 +175,10 @@
<path value="$PROJECT_DIR$/vendor/hyperf/stringable" /> <path value="$PROJECT_DIR$/vendor/hyperf/stringable" />
<path value="$PROJECT_DIR$/vendor/hyperf/support" /> <path value="$PROJECT_DIR$/vendor/hyperf/support" />
<path value="$PROJECT_DIR$/vendor/ralouphie/getallheaders" /> <path value="$PROJECT_DIR$/vendor/ralouphie/getallheaders" />
<path value="$PROJECT_DIR$/vendor/cooper/hyperf-pest" />
</include_path> </include_path>
</component> </component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.0" /> <component name="PhpProjectSharedConfiguration" php_language_level="8.1" />
<component name="PhpStan"> <component name="PhpStan">
<PhpStan_settings> <PhpStan_settings>
<PhpStanConfiguration tool_path="$PROJECT_DIR$/vendor/bin/phpstan" /> <PhpStanConfiguration tool_path="$PROJECT_DIR$/vendor/bin/phpstan" />

3
.idea/phpspec.xml generated
View File

@@ -23,6 +23,9 @@
<PhpSpecSuiteConfiguration> <PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" /> <option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration> </PhpSpecSuiteConfiguration>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
</suites> </suites>
</component> </component>
</project> </project>

View File

@@ -15,7 +15,7 @@
} }
], ],
"require": { "require": {
"php": "^8.0", "php": "^8.1",
"ext-redis": "^5.3", "ext-redis": "^5.3",
"ext-swoole": "*", "ext-swoole": "*",
"composer/composer": ">=2.0", "composer/composer": ">=2.0",
@@ -41,6 +41,7 @@
}, },
"require-dev": { "require-dev": {
"alibabacloud/dysmsapi-20170525": "^2.0", "alibabacloud/dysmsapi-20170525": "^2.0",
"cooper/hyperf-pest": "^1.1",
"firebase/php-jwt": "^6.1", "firebase/php-jwt": "^6.1",
"friendsofphp/php-cs-fixer": "^3.13", "friendsofphp/php-cs-fixer": "^3.13",
"guzzlehttp/guzzle": "^7.5", "guzzlehttp/guzzle": "^7.5",
@@ -91,7 +92,11 @@
"prefer-stable": true, "prefer-stable": true,
"scripts": { "scripts": {
"post-root-package-install": [], "post-root-package-install": [],
"test": "vendor/bin/pest $1", "test": [
"rm -rf runtime",
"Composer\\Config::disableProcessTimeout",
"co-pest --prepend tests/bootstrap.php -c phpunit.xml --colors=always $1"
],
"cs-fix": "vendor/bin/php-cs-fixer fix $1 --rules=@PSR12 --allow-risky=yes", "cs-fix": "vendor/bin/php-cs-fixer fix $1 --rules=@PSR12 --allow-risky=yes",
"analyse": "vendor/bin/phpstan analyse $1", "analyse": "vendor/bin/phpstan analyse $1",
"ci": [ "ci": [

1834
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,4 +7,4 @@ docker run \
-v "$(pwd)":/srv/www \ -v "$(pwd)":/srv/www \
-v ~/.ssh:/root/.ssh \ -v ~/.ssh:/root/.ssh \
-v ~/.gitconfig:/root/.gitconfig \ -v ~/.gitconfig:/root/.gitconfig \
harbor.luxcreo.cn/library/hyperf:8.0-swoole /bin/ash harbor.luxcreo.cn/library/hyperf:8.1-swoole /bin/ash

View File

@@ -9,8 +9,29 @@ declare(strict_types=1);
* @contact group@hyperf.io * @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/ */
use Hyperf\Context\ApplicationContext;
use Hyperf\Di\Container;
use Hyperf\Di\Definition\DefinitionSource;
use Psr\Container\ContainerInterface;
ini_set('display_errors', 'on'); ini_set('display_errors', 'on');
ini_set('display_startup_errors', 'on'); ini_set('display_startup_errors', 'on');
error_reporting(E_ALL); error_reporting(E_ALL);
date_default_timezone_set('Asia/Shanghai'); date_default_timezone_set('Asia/Shanghai');
!defined('BASE_PATH') && define('BASE_PATH', dirname(__DIR__, 1));
!defined('SWOOLE_HOOK_FLAGS') && define('SWOOLE_HOOK_FLAGS', SWOOLE_HOOK_ALL);
Swoole\Runtime::enableCoroutine(true);
require BASE_PATH . '/vendor/autoload.php';
Hyperf\Di\ClassLoader::init();
$container = new Container(new DefinitionSource([]));
if (!$container instanceof ContainerInterface) {
throw new RuntimeException('The dependency injection container is invalid.');
}
$container = ApplicationContext::setContainer($container);