fix(1): 增加 pestphp 默认引入

Closes #1

Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
This commit is contained in:
李东云
2023-05-12 15:47:00 +08:00
parent 4082d97d76
commit 27ba5b0c53
2 changed files with 137 additions and 100 deletions

View File

@@ -1,105 +1,112 @@
{ {
"name": "singularity/hdk-skeleton", "name": "singularity/hdk-skeleton",
"license": "MIT", "license": "MIT",
"type": "project", "type": "project",
"description": "HDK 骨架", "description": "HDK 骨架",
"authors": [ "authors": [
{ {
"name": "李东云", "name": "李东云",
"email": "dongyun.li@luxcreo.ai" "email": "dongyun.li@luxcreo.ai"
} }
], ],
"extra": { "extra": {
"hyperf": { "hyperf": {
"config": "Singularity\\HDK\\Skeleton\\ConfigProvider" "config": "Singularity\\HDK\\Skeleton\\ConfigProvider"
},
"hooks": {
"config": {
"stop-on-failure": [
"pre-push"
]
},
"pre-push": [
"echo committing as $(git config user.name)",
"docker run --rm -t -v \"$(pwd)\":/srv/www harbor.luxcreo.cn/library/hyperf:8.1-swoole composer ci"
]
}
}, },
"hooks": { "autoload": {
"config": { "psr-4": {
"stop-on-failure": [ "App\\": "app/",
"pre-push" "Installer\\": "installer/"
}
},
"autoload-dev": {
"psr-4": {
"Test\\": "test/"
}
},
"require": {
"php": "^8.1",
"composer/composer": ">=2.5.5",
"hyperf/constants": "^3.0.18",
"hyperf/database": "^3.0.18",
"hyperf/db-connection": "^3.0.18",
"hyperf/di": "^3.0.18",
"hyperf/paginator": "^3.0.18",
"hyperf/session": "^3.0.18",
"hyperf/translation": "^3.0.18",
"hyperf/validation": "^3.0.18",
"singularity/hdk-core": "^0.2.17",
"symfony/polyfill-php81": "^1.27.0"
},
"require-dev": {
"brainmaestro/composer-git-hooks": "^2.8.5",
"friendsofphp/php-cs-fixer": "^v3.16.0",
"hyperf/devtool": "^3.0.18",
"hyperf/testing": "^3.0.18",
"pestphp/pest": "^1.23",
"phpstan/phpstan": "^1.10.15",
"swoole/ide-helper": "^4.8.13"
},
"prefer-stable": true,
"config": {
"optimize-autoloader": true,
"sort-packages": true,
"secure-http": false,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"scripts": {
"pre-install-cmd": "Installer\\Script::install",
"pre-update-cmd": "Installer\\Script::install",
"post-install-cmd": "cghooks add --ignore-lock",
"post-update-cmd": "cghooks update",
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-autoload-dump": [
"rm -rf runtime/container"
],
"test": [
"rm -rf runtime",
"Composer\\Config::disableProcessTimeout",
"co-phpunit --prepend test/bootstrap.php -c phpunit.xml --colors=always"
],
"cs-fix": "vendor/bin/php-cs-fixer fix $1 --rules=@PSR12 --allow-risky=yes",
"analyse": "vendor/bin/phpstan analyse $1",
"ci": [
"@analyse app/ test/",
"@cs-fix",
"@test",
"echo CI Success"
],
"start": [
"rm -rf runtime",
"Composer\\Config::disableProcessTimeout",
"php ./bin/hyperf.php start"
] ]
},
"pre-push": [
"echo committing as $(git config user.name)",
"docker run --rm -t -v \"$(pwd)\":/srv/www harbor.luxcreo.cn/library/hyperf:8.1-swoole composer ci"
]
}
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Installer\\": "installer/"
}
},
"autoload-dev": {
"psr-4": {
"Test\\": "test/"
}
},
"require": {
"php": "^8.1",
"composer/composer": ">=2.5.5",
"hyperf/db-connection": "^3.0.15",
"hyperf/session": "^3.0.15",
"hyperf/validation": "^3.0.15",
"singularity/hdk-core": "^0.2.12",
"symfony/polyfill-php81": "^1.27.0"
},
"require-dev": {
"brainmaestro/composer-git-hooks": "^2.8.5",
"friendsofphp/php-cs-fixer": "^v3.16.0",
"hyperf/devtool": "^3.0.15",
"hyperf/testing": "^3.0.15",
"phpstan/phpstan": "^1.10.11",
"swoole/ide-helper": "^4.8.13",
"singularity/hdk-auth": "^0.2.2",
"singularity/hyperf-saml": "^0.2.3"
},
"prefer-stable": true,
"config": {
"optimize-autoloader": true,
"sort-packages": true,
"secure-http": false
},
"scripts": {
"pre-install-cmd": "Installer\\Script::install",
"pre-update-cmd": "Installer\\Script::install",
"post-install-cmd": "cghooks add --ignore-lock",
"post-update-cmd": "cghooks update",
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-autoload-dump": [
"rm -rf runtime/container"
],
"test": [
"rm -rf runtime",
"Composer\\Config::disableProcessTimeout",
"co-phpunit --prepend test/bootstrap.php -c phpunit.xml --colors=always"
],
"cs-fix": "vendor/bin/php-cs-fixer fix $1 --rules=@PSR12 --allow-risky=yes",
"analyse": "vendor/bin/phpstan analyse $1",
"ci": [
"@analyse app/ test/",
"@cs-fix",
"@test",
"echo CI Success"
],
"start": [
"rm -rf runtime",
"Composer\\Config::disableProcessTimeout",
"php ./bin/hyperf.php start"
]
},
"repositories": {
"lux-map": {
"type": "composer",
"url": "https://satis.luxcreo.cn/"
}, },
"packagist": { "repositories": {
"type": "composer", "lux-map": {
"url": "https://mirrors.cloud.tencent.com/composer/" "type": "composer",
} "url": "https://satis.luxcreo.cn/"
}, },
"version": "0.2.3" "packagist": {
"type": "composer",
"url": "https://mirrors.cloud.tencent.com/composer/"
}
},
"version": "0.2.3"
} }

30
test/Pest.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
/*
|--------------------------------------------------------------------------
| Test Case
|--------------------------------------------------------------------------
|
| The closure you provide to your test functions is always bound to a specific PHPUnit test
| case class. By default, that class is "PHPUnit\Framework\TestCase". Of course, you may
| need to change it using the "uses()" function to bind a different classes or traits.
|
*/
// uses(Tests\TestCase::class)->in('Feature');
/*
|--------------------------------------------------------------------------
| Functions
|--------------------------------------------------------------------------
|
| While Pest is very powerful out-of-the-box, you may have some testing code specific to your
| project that you don't want to repeat in every file. Here you can also expose helpers as
| global functions to help you to reduce the number of lines of code in your test files.
|
*/
/*function something()
{
// ..
}*/