build(ci): 完善 style-fix/syntax-check/unit-test

This commit is contained in:
李东云
2023-01-09 15:53:22 +08:00
parent da1d6c68d2
commit 4b7f1189d3
4 changed files with 304 additions and 28 deletions

3
.gitignore vendored
View File

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

View File

@@ -41,12 +41,15 @@
"require-dev": { "require-dev": {
"alibabacloud/dysmsapi-20170525": "^2.0", "alibabacloud/dysmsapi-20170525": "^2.0",
"firebase/php-jwt": "^6.1", "firebase/php-jwt": "^6.1",
"friendsofphp/php-cs-fixer": "^3.13",
"guzzlehttp/guzzle": "^7.5", "guzzlehttp/guzzle": "^7.5",
"hyperf/session": "^2.2", "hyperf/session": "^2.2",
"hyperf/validation": "^2.2", "hyperf/validation": "^2.2",
"pestphp/pest": "^1.22", "pestphp/pest": "^1.22",
"phpstan/phpstan": "^1.9",
"phpunit/phpunit": "^9.5", "phpunit/phpunit": "^9.5",
"roave/security-advisories": "dev-latest", "roave/security-advisories": "dev-latest",
"spatie/pest-plugin-test-time": "^1.1",
"swoole/ide-helper": "*", "swoole/ide-helper": "*",
"symfony/mailer": "^6.0" "symfony/mailer": "^6.0"
}, },
@@ -76,9 +79,15 @@
"prefer-stable": true, "prefer-stable": true,
"scripts": { "scripts": {
"post-root-package-install": [], "post-root-package-install": [],
"test": "vendor/bin/phpunit --prepend test/bootstrap.php -c phpunit.xml --colors=always", "test": "vendor/bin/pest",
"cs-fix": "php-cs-fixer fix $1", "cs-fix": "vendor/bin/php-cs-fixer fix $1",
"analyse": "phpstan analyse --memory-limit 300M -l 0 -c phpstan.neon ./app ./config" "analyse": "vendor/bin/phpstan analyse -l 0 $1",
"ci": [
"vendor/bin/pest --ci",
"@cs-fix .",
"@analyse publish/ src/ tests/",
"echo CI Success"
]
}, },
"repositories": { "repositories": {
"lux-map": { "lux-map": {

299
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "188e82a3b576a79cac5f0fa6622a23b2", "content-hash": "8725cce0321e7f830ec9ac4994183116",
"packages": [ "packages": [
{ {
"name": "composer/ca-bundle", "name": "composer/ca-bundle",
@@ -4518,6 +4518,79 @@
], ],
"time": "2022-12-19T17:10:46+00:00" "time": "2022-12-19T17:10:46+00:00"
}, },
{
"name": "friendsofphp/php-cs-fixer",
"version": "v3.13.2",
"dist": {
"type": "zip",
"url": "https://mirrors.cloud.tencent.com/repository/composer/friendsofphp/php-cs-fixer/v3.13.2/friendsofphp-php-cs-fixer-v3.13.2.zip",
"reference": "3952f08a81bd3b1b15e11c3de0b6bf037faa8496",
"shasum": ""
},
"require": {
"composer/semver": "^3.2",
"composer/xdebug-handler": "^3.0.3",
"doctrine/annotations": "^1.13",
"ext-json": "*",
"ext-tokenizer": "*",
"php": "^7.4 || ^8.0",
"sebastian/diff": "^4.0",
"symfony/console": "^5.4 || ^6.0",
"symfony/event-dispatcher": "^5.4 || ^6.0",
"symfony/filesystem": "^5.4 || ^6.0",
"symfony/finder": "^5.4 || ^6.0",
"symfony/options-resolver": "^5.4 || ^6.0",
"symfony/polyfill-mbstring": "^1.23",
"symfony/polyfill-php80": "^1.25",
"symfony/polyfill-php81": "^1.25",
"symfony/process": "^5.4 || ^6.0",
"symfony/stopwatch": "^5.4 || ^6.0"
},
"require-dev": {
"justinrainbow/json-schema": "^5.2",
"keradus/cli-executor": "^2.0",
"mikey179/vfsstream": "^1.6.10",
"php-coveralls/php-coveralls": "^2.5.2",
"php-cs-fixer/accessible-object": "^1.1",
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1",
"phpspec/prophecy": "^1.15",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.5",
"phpunitgoodpractices/polyfill": "^1.6",
"phpunitgoodpractices/traits": "^1.9.2",
"symfony/phpunit-bridge": "^6.0",
"symfony/yaml": "^5.4 || ^6.0"
},
"suggest": {
"ext-dom": "For handling output formats in XML",
"ext-mbstring": "For handling non-UTF8 characters."
},
"bin": [
"php-cs-fixer"
],
"type": "application",
"autoload": {
"psr-4": {
"PhpCsFixer\\": "src/"
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Dariusz Rumiński",
"email": "dariusz.ruminski@gmail.com"
}
],
"description": "A tool to automatically fix PHP code style",
"time": "2023-01-02T23:53:50+00:00"
},
{ {
"name": "guzzlehttp/guzzle", "name": "guzzlehttp/guzzle",
"version": "7.5.0", "version": "7.5.0",
@@ -5222,6 +5295,41 @@
"description": "Library for handling version information and constraints", "description": "Library for handling version information and constraints",
"time": "2022-02-21T01:04:05+00:00" "time": "2022-02-21T01:04:05+00:00"
}, },
{
"name": "phpstan/phpstan",
"version": "1.9.8",
"dist": {
"type": "zip",
"url": "https://mirrors.cloud.tencent.com/repository/composer/phpstan/phpstan/1.9.8/phpstan-phpstan-1.9.8.zip",
"reference": "45411d15bf85a33b4a8ee9b75a6e82998c9adb97",
"shasum": ""
},
"require": {
"php": "^7.2|^8.0"
},
"conflict": {
"phpstan/phpstan-shim": "*"
},
"bin": [
"phpstan",
"phpstan.phar"
],
"type": "library",
"autoload": {
"files": [
"bootstrap.php"
]
},
"license": [
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
"keywords": [
"dev",
"static analysis"
],
"time": "2023-01-08T21:26:18+00:00"
},
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
"version": "9.2.22", "version": "9.2.22",
@@ -5667,7 +5775,7 @@
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://mirrors.cloud.tencent.com/repository/composer/roave/security-advisories/dev-latest/roave-security-advisories-dev-latest.zip", "url": "https://mirrors.cloud.tencent.com/repository/composer/roave/security-advisories/dev-latest/roave-security-advisories-dev-latest.zip",
"reference": "326a87e33bf91da7161ad24a6f7ab5d2bb63077a", "reference": "ef9dca6c49faa06e7203bbed30411e26e474a8fb",
"shasum": "" "shasum": ""
}, },
"conflict": { "conflict": {
@@ -5722,7 +5830,7 @@
"cesnet/simplesamlphp-module-proxystatistics": "<3.1", "cesnet/simplesamlphp-module-proxystatistics": "<3.1",
"codeception/codeception": "<3.1.3|>=4,<4.1.22", "codeception/codeception": "<3.1.3|>=4,<4.1.22",
"codeigniter/framework": "<=3.0.6", "codeigniter/framework": "<=3.0.6",
"codeigniter4/framework": "<4.2.7", "codeigniter4/framework": "<4.2.11",
"codeigniter4/shield": "= 1.0.0-beta", "codeigniter4/shield": "= 1.0.0-beta",
"codiad/codiad": "<=2.8.4", "codiad/codiad": "<=2.8.4",
"composer/composer": "<1.10.26|>=2-alpha.1,<2.2.12|>=2.3,<2.3.5", "composer/composer": "<1.10.26|>=2-alpha.1,<2.2.12|>=2.3,<2.3.5",
@@ -5806,7 +5914,7 @@
"friendsofsymfony/user-bundle": ">=1.2,<1.3.5", "friendsofsymfony/user-bundle": ">=1.2,<1.3.5",
"friendsoftypo3/mediace": ">=7.6.2,<7.6.5", "friendsoftypo3/mediace": ">=7.6.2,<7.6.5",
"froala/wysiwyg-editor": "<3.2.7", "froala/wysiwyg-editor": "<3.2.7",
"froxlor/froxlor": "<0.10.39", "froxlor/froxlor": "<0.10.39|>=2-beta.0,<2-beta.1",
"fuel/core": "<1.8.1", "fuel/core": "<1.8.1",
"gaoming13/wechat-php-sdk": "<=1.10.2", "gaoming13/wechat-php-sdk": "<=1.10.2",
"genix/cms": "<=1.1.11", "genix/cms": "<=1.1.11",
@@ -5894,6 +6002,7 @@
"melisplatform/melis-cms": "<5.0.1", "melisplatform/melis-cms": "<5.0.1",
"melisplatform/melis-front": "<5.0.1", "melisplatform/melis-front": "<5.0.1",
"mezzio/mezzio-swoole": "<3.7|>=4,<4.3", "mezzio/mezzio-swoole": "<3.7|>=4,<4.3",
"mgallegos/laravel-jqgrid": "<=1.3",
"microweber/microweber": "<=1.3.1", "microweber/microweber": "<=1.3.1",
"miniorange/miniorange-saml": "<1.4.3", "miniorange/miniorange-saml": "<1.4.3",
"mittwald/typo3_forum": "<1.2.1", "mittwald/typo3_forum": "<1.2.1",
@@ -6025,7 +6134,7 @@
"simplito/elliptic-php": "<1.0.6", "simplito/elliptic-php": "<1.0.6",
"slim/slim": "<2.6", "slim/slim": "<2.6",
"smarty/smarty": "<3.1.47|>=4,<4.2.1", "smarty/smarty": "<3.1.47|>=4,<4.2.1",
"snipe/snipe-it": "<6.0.11|>= 6.0.0-RC-1, <= 6.0.0-RC-5", "snipe/snipe-it": "<=6.0.14|>= 6.0.0-RC-1, <= 6.0.0-RC-5",
"socalnick/scn-social-auth": "<1.15.2", "socalnick/scn-social-auth": "<1.15.2",
"socialiteproviders/steam": "<1.1", "socialiteproviders/steam": "<1.1",
"spatie/browsershot": "<3.57.4", "spatie/browsershot": "<3.57.4",
@@ -6090,13 +6199,13 @@
"tinymce/tinymce": "<5.10.7|>=6,<6.3.1", "tinymce/tinymce": "<5.10.7|>=6,<6.3.1",
"titon/framework": ">=0,<9.9.99", "titon/framework": ">=0,<9.9.99",
"tobiasbg/tablepress": "<= 2.0-RC1", "tobiasbg/tablepress": "<= 2.0-RC1",
"topthink/framework": "<=6.0.13", "topthink/framework": "<6.0.14",
"topthink/think": "<=6.0.9", "topthink/think": "<=6.0.9",
"topthink/thinkphp": "<=3.2.3", "topthink/thinkphp": "<=3.2.3",
"tribalsystems/zenario": "<=9.3.57595", "tribalsystems/zenario": "<=9.3.57595",
"truckersmp/phpwhois": "<=4.3.1", "truckersmp/phpwhois": "<=4.3.1",
"twig/twig": "<1.44.7|>=2,<2.15.3|>=3,<3.4.3", "twig/twig": "<1.44.7|>=2,<2.15.3|>=3,<3.4.3",
"typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.38|>=9,<9.5.29|>=10,<10.4.33|>=11,<11.5.20|>=12,<12.1.1", "typo3/cms": "<2.0.5|>=3,<3.0.3|>=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.38|>=9,<9.5.29|>=10,<10.4.33|>=11,<11.5.20|>=12,<12.1.1",
"typo3/cms-backend": ">=7,<=7.6.50|>=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", "typo3/cms-backend": ">=7,<=7.6.50|>=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1",
"typo3/cms-core": "<8.7.49|>=9,<9.5.38|>=10,<10.4.33|>=11,<11.5.20|>=12,<12.1.1", "typo3/cms-core": "<8.7.49|>=9,<9.5.38|>=10,<10.4.33|>=11,<11.5.20|>=12,<12.1.1",
"typo3/cms-form": ">=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", "typo3/cms-form": ">=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1",
@@ -6134,7 +6243,7 @@
"yiisoft/yii2-bootstrap": "<2.0.4", "yiisoft/yii2-bootstrap": "<2.0.4",
"yiisoft/yii2-dev": "<2.0.43", "yiisoft/yii2-dev": "<2.0.43",
"yiisoft/yii2-elasticsearch": "<2.0.5", "yiisoft/yii2-elasticsearch": "<2.0.5",
"yiisoft/yii2-gii": "<2.0.4", "yiisoft/yii2-gii": "<=2.2.4",
"yiisoft/yii2-jui": "<2.0.4", "yiisoft/yii2-jui": "<2.0.4",
"yiisoft/yii2-redis": "<2.0.8", "yiisoft/yii2-redis": "<2.0.8",
"yikesinc/yikes-inc-easy-mailchimp-extender": "<6.8.6", "yikesinc/yikes-inc-easy-mailchimp-extender": "<6.8.6",
@@ -6185,7 +6294,7 @@
} }
], ],
"description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it",
"time": "2022-12-19T08:05:12+00:00" "time": "2023-01-04T14:04:25+00:00"
}, },
{ {
"name": "sebastian/cli-parser", "name": "sebastian/cli-parser",
@@ -6895,6 +7004,95 @@
"homepage": "https://github.com/sebastianbergmann/version", "homepage": "https://github.com/sebastianbergmann/version",
"time": "2020-09-28T06:39:44+00:00" "time": "2020-09-28T06:39:44+00:00"
}, },
{
"name": "spatie/pest-plugin-test-time",
"version": "1.1.1",
"dist": {
"type": "zip",
"url": "https://mirrors.cloud.tencent.com/repository/composer/spatie/pest-plugin-test-time/1.1.1/spatie-pest-plugin-test-time-1.1.1.zip",
"reference": "1ca56762948ceded0225ecd5b90bfc4bb48a0229",
"shasum": ""
},
"require": {
"nesbot/carbon": "^2.50",
"pestphp/pest": "^1.10",
"php": "^8.0",
"spatie/test-time": "^1.2"
},
"type": "library",
"autoload": {
"files": [
"src/Functions.php"
],
"psr-4": {
"Spatie\\PestPluginTestTime\\": "src"
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"role": "Developer"
}
],
"description": "A Pest plugin to control the flow of time",
"homepage": "https://github.com/spatie/pest-plugin-test-time",
"keywords": [
"pest-plugin-test-time",
"spatie"
],
"time": "2022-06-05T13:57:23+00:00"
},
{
"name": "spatie/test-time",
"version": "1.3.0",
"dist": {
"type": "zip",
"url": "https://mirrors.cloud.tencent.com/repository/composer/spatie/test-time/1.3.0/spatie-test-time-1.3.0.zip",
"reference": "5738d4bff591d896d443785c6d787eb8cfa20e27",
"shasum": ""
},
"require": {
"nesbot/carbon": "^2.54",
"php": "^7.3|^8.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5.10"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\TestTime\\": "src"
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
},
{
"name": "Alex Vanderbist",
"email": "alex@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "A small package to control the flow time",
"homepage": "https://github.com/spatie/test-time",
"keywords": [
"spatie",
"test-time"
],
"time": "2022-02-04T08:55:17+00:00"
},
{ {
"name": "swoole/ide-helper", "name": "swoole/ide-helper",
"version": "5.0.1", "version": "5.0.1",
@@ -7143,6 +7341,50 @@
], ],
"time": "2022-11-28T12:25:56+00:00" "time": "2022-11-28T12:25:56+00:00"
}, },
{
"name": "symfony/options-resolver",
"version": "v6.0.3",
"dist": {
"type": "zip",
"url": "https://mirrors.cloud.tencent.com/repository/composer/symfony/options-resolver/v6.0.3/symfony-options-resolver-v6.0.3.zip",
"reference": "51f7006670febe4cbcbae177cbffe93ff833250d",
"shasum": ""
},
"require": {
"php": ">=8.0.2",
"symfony/deprecation-contracts": "^2.1|^3"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\OptionsResolver\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides an improved replacement for the array_replace PHP function",
"homepage": "https://symfony.com",
"keywords": [
"config",
"configuration",
"options"
],
"time": "2022-01-02T09:55:41+00:00"
},
{ {
"name": "symfony/polyfill-intl-idn", "name": "symfony/polyfill-intl-idn",
"version": "v1.27.0", "version": "v1.27.0",
@@ -7260,6 +7502,45 @@
], ],
"time": "2022-11-03T14:55:06+00:00" "time": "2022-11-03T14:55:06+00:00"
}, },
{
"name": "symfony/stopwatch",
"version": "v6.0.13",
"dist": {
"type": "zip",
"url": "https://mirrors.cloud.tencent.com/repository/composer/symfony/stopwatch/v6.0.13/symfony-stopwatch-v6.0.13.zip",
"reference": "7554fde6848af5ef1178f8ccbdbdb8ae1092c70a",
"shasum": ""
},
"require": {
"php": ">=8.0.2",
"symfony/service-contracts": "^1|^2|^3"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Stopwatch\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides a way to profile code",
"homepage": "https://symfony.com",
"time": "2022-09-28T15:52:47+00:00"
},
{ {
"name": "theseer/tokenizer", "name": "theseer/tokenizer",
"version": "1.2.1", "version": "1.2.1",

View File

@@ -13,21 +13,6 @@
// uses(Tests\TestCase::class)->in('Feature'); // uses(Tests\TestCase::class)->in('Feature');
/*
|--------------------------------------------------------------------------
| Expectations
|--------------------------------------------------------------------------
|
| When you're writing tests, you often need to check that values meet certain conditions. The
| "expect()" function gives you access to a set of "expectations" methods that you can use
| to assert different things. Of course, you may extend the Expectation API at any time.
|
*/
expect()->extend('toBeOne', function () {
return $this->toBe(1);
});
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Functions | Functions