Skip to content

Commit 5be4a34

Browse files
committed
Test outcome refactor & error output improvements
1 parent 4ec743e commit 5be4a34

38 files changed

+535
-298
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
php-versions: ['8.1', '8.2', '8.3', '8.4']
19+
php-versions: ['8.2', '8.3', '8.4']
2020

2121
steps:
2222
- uses: actions/checkout@v4

phpcs.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<exclude name="SlevomatCodingStandard.Classes.DisallowConstructorPropertyPromotion" />
2020
<exclude name="SlevomatCodingStandard.Classes.RequireSelfReference" />
2121
<exclude name="SlevomatCodingStandard.Classes.RequireSingleLineMethodSignature" />
22-
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming" />
22+
<exclude name="SlevomatCodingStandard.Classes.SuperfluousErrorNaming" />
2323
<exclude name="SlevomatCodingStandard.Commenting.DisallowCommentAfterCode" />
2424
<exclude name="SlevomatCodingStandard.Commenting.DisallowOneLinePropertyDocComment" />
2525
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLineDocComment" />

src/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected function execute(Input\InputInterface $input, Output\OutputInterface $
5555
$testSuite->addSubscriber(new Subscriber\Summary($input, $output));
5656
$testSuite->addSubscriber(new Subscriber\TestExecutor());
5757

58-
return $testSuite->run($input->getOption("bail") ?? false)
58+
return $testSuite->run($input->getOption("bail") ?? false)->isSuccess()
5959
? Command::SUCCESS
6060
: Command::FAILURE;
6161
}

src/Attributes/ExamplesSetup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
namespace TH\DocTest\Attributes;
44

55
#[\Attribute]
6-
final class ExamplesSetup
6+
final readonly class ExamplesSetup
77
{
88
public function __construct(
99
/** @var class-string */
10-
public readonly string $setupClass,
10+
public string $setupClass,
1111
) {
1212
}
1313
}

src/Event/AfterTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace TH\DocTest\Event;
44

5-
use TH\DocTest\Example;
5+
use TH\DocTest\TestCase;
66

7-
final class AfterTest
7+
final readonly class AfterTest
88
{
99
public function __construct(
10-
public readonly Example $example,
10+
public TestCase $test,
1111
) {
1212
}
1313
}

src/Event/AfterTestFailure.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
namespace TH\DocTest\Event;
44

5-
use TH\DocTest\Example;
5+
use TH\DocTest\TestCase;
66

7-
final class AfterTestFailure
7+
final readonly class AfterTestFailure
88
{
99
public function __construct(
10-
public readonly Example $example,
11-
public readonly \Throwable $failure,
10+
public TestCase $test,
11+
public \Throwable $failure,
1212
) {
1313
}
1414
}

src/Event/AfterTestSuccess.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace TH\DocTest\Event;
44

5-
use TH\DocTest\Example;
5+
use TH\DocTest\TestCase;
66

7-
final class AfterTestSuccess
7+
final readonly class AfterTestSuccess
88
{
99
public function __construct(
10-
public readonly Example $example,
10+
public TestCase $test,
1111
) {
1212
}
1313
}

src/Event/AfterTestSuite.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
namespace TH\DocTest\Event;
44

5-
final class AfterTestSuite
5+
use TH\DocTest\TestOutcome;
6+
7+
final readonly class AfterTestSuite
68
{
79
public function __construct(
8-
public readonly bool $success,
10+
public TestOutcome $outcome,
911
) {
1012
}
1113
}

src/Event/BeforeTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace TH\DocTest\Event;
44

5-
use TH\DocTest\Example;
5+
use TH\DocTest\TestCase;
66

7-
final class BeforeTest
7+
final readonly class BeforeTest
88
{
99
public function __construct(
10-
public readonly Example $example,
10+
public TestCase $test,
1111
) {
1212
}
1313
}

src/Event/ExecuteTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace TH\DocTest\Event;
44

5-
use TH\DocTest\Example;
5+
use TH\DocTest\TestCase;
66

7-
final class ExecuteTest
7+
final readonly class ExecuteTest
88
{
99
public function __construct(
10-
public readonly Example $example,
10+
public TestCase $test,
1111
) {
1212
}
1313
}

0 commit comments

Comments
 (0)