diff --git a/.github/workflows/testo.yml b/.github/workflows/testo.yml new file mode 100644 index 0000000..0fc9997 --- /dev/null +++ b/.github/workflows/testo.yml @@ -0,0 +1,14 @@ +on: + pull_request: null + push: + branches: + - '2.x' + +name: testo + +jobs: + testo: + uses: spiral/gh-actions/.github/workflows/testo.yml@master + with: + os: >- + ['ubuntu-latest'] diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 5d04cfb..8143b8e 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -7,6 +7,7 @@ return \Spiral\CodeStyle\Builder::create() ->include(__DIR__ . '/bin/rr') ->include(__DIR__ . '/src') + ->include(__DIR__ . '/tests') ->include(__FILE__) ->cache('./runtime/php-cs-fixer.cache') ->allowRisky(false) diff --git a/composer.json b/composer.json index 3989185..00093be 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ } ], "require": { - "php": ">=8.1", + "php": ">=8.2", "ext-json": "*", "composer/semver": "^3.4", "spiral/roadrunner-worker": "^2 || ^3", @@ -42,18 +42,25 @@ "jetbrains/phpstorm-attributes": "^1.2", "spiral/code-style": "^2.3.1", "spiral/dumper": "^3.3", - "vimeo/psalm": "^6.0" + "testo/testo": "^0.10.55", + "vimeo/psalm": "^6 || ^7" }, "autoload": { "psr-4": { "Spiral\\RoadRunner\\Console\\": "src" } }, + "autoload-dev": { + "psr-4": { + "Spiral\\RoadRunner\\Console\\Tests\\": "tests" + } + }, "scripts": { "cs:diff": "php-cs-fixer fix --dry-run -v --diff", "cs:fix": "php-cs-fixer fix -v", "psalm": "psalm", - "psalm:baseline": "psalm --set-baseline=psalm-baseline.xml" + "psalm:baseline": "psalm --set-baseline=psalm-baseline.xml", + "test": "vendor/bin/testo" }, "config": { "sort-packages": true, diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 4a22a52..80eff43 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -145,9 +145,6 @@ stability->get($input, $io)]]> - - getAssets()]]> - diff --git a/psalm.xml b/psalm.xml index c729c68..e275989 100644 --- a/psalm.xml +++ b/psalm.xml @@ -16,6 +16,9 @@ > + + + diff --git a/testo.php b/testo.php new file mode 100644 index 0000000..0320172 --- /dev/null +++ b/testo.php @@ -0,0 +1,16 @@ + 'stable', + 'STABILITY_RC' => 'RC', + 'STABILITY_BETA' => 'beta', + 'STABILITY_ALPHA' => 'alpha', + 'STABILITY_DEV' => 'dev', + ]); + } + + public function weightsFollowStabilityOrder(): void + { + Assert::true(Stability::toInt(Stability::STABILITY_STABLE) > Stability::toInt(Stability::STABILITY_RC)); + Assert::true(Stability::toInt(Stability::STABILITY_RC) > Stability::toInt(Stability::STABILITY_BETA)); + Assert::true(Stability::toInt(Stability::STABILITY_BETA) > Stability::toInt(Stability::STABILITY_ALPHA)); + Assert::true(Stability::toInt(Stability::STABILITY_ALPHA) > Stability::toInt(Stability::STABILITY_DEV)); + } + + public function unknownStabilityWeighsAsDev(): void + { + Assert::same(Stability::toInt('unknown'), Stability::toInt(Stability::STABILITY_DEV)); + } + + #[DataSet(['stable', true])] + #[DataSet(['RC', true])] + #[DataSet(['dev', true])] + #[DataSet(['rc', false], 'case-sensitive')] + #[DataSet(['', false], 'empty')] + public function isValid(string $value, bool $expected): void + { + Assert::same(Stability::isValid($value), $expected); + } +}