Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/testo.yml
Original file line number Diff line number Diff line change
@@ -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']
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 10 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
}
],
"require": {
"php": ">=8.1",
"php": ">=8.2",
"ext-json": "*",
"composer/semver": "^3.4",
"spiral/roadrunner-worker": "^2 || ^3",
Expand All @@ -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,
Expand Down
3 changes: 0 additions & 3 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@
<ArgumentTypeCoercion>
<code><![CDATA[$this->stability->get($input, $io)]]></code>
</ArgumentTypeCoercion>
<PossiblyInvalidArgument>
<code><![CDATA[$release->getAssets()]]></code>
</PossiblyInvalidArgument>
<PossiblyInvalidMethodCall>
<code><![CDATA[count]]></code>
<code><![CDATA[empty]]></code>
Expand Down
3 changes: 3 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
>
<issueHandlers>
<MissingClassConstType errorLevel="suppress" />
<!-- Psalm 6 reports; temporarily suppressed until the static analysis pass -->
<MissingOverrideAttribute errorLevel="suppress" />
<ClassMustBeFinal errorLevel="suppress" />
</issueHandlers>
<projectFiles>
<directory name="src" />
Expand Down
16 changes: 16 additions & 0 deletions testo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

use Testo\Application\Config\ApplicationConfig;
use Testo\Application\Config\SuiteConfig;

return new ApplicationConfig(
src: ['src'],
suites: [
new SuiteConfig(
name: 'Unit',
location: ['tests/Unit'],
),
],
);
48 changes: 48 additions & 0 deletions tests/Unit/Environment/StabilityTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

declare(strict_types=1);

namespace Spiral\RoadRunner\Console\Tests\Unit\Environment;

use Spiral\RoadRunner\Console\Environment\Stability;
use Testo\Assert;
use Testo\Data\DataSet;
use Testo\Test;

#[Test]
final class StabilityTest
{
public function allListsEveryStability(): void
{
Assert::same(Stability::all(), [
'STABILITY_STABLE' => '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);
}
}
Loading