Skip to content

Commit da5b379

Browse files
committed
build: cleans up coverage analysis
1 parent be80673 commit da5b379

File tree

330 files changed

+737
-27
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

330 files changed

+737
-27
lines changed

bin/test

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
/**
5+
* The following is heavily borrowed from Ecotone.
6+
*
7+
* This script allows us to dynamically retrieve the package namespace
8+
* and directory from our composer file. This is then used by our GitHub
9+
* action to publish the packages to their appropriate repositories.
10+
*
11+
* @link https://github.com/ecotoneframework/ecotone-dev/blob/main/bin/get-packages
12+
*/
13+
14+
const PACKAGES_DIRECTORY = __DIR__ . '/../src/Tempest/';
15+
16+
function getPackageNameFromComposerFile(string $composerFile)
17+
{
18+
$composer = json_decode(file_get_contents($composerFile), true);
19+
20+
$name = $composer['name'] ?? throw new UnexpectedValueException(
21+
'The referenced package is invalid because it is missing a name: ' . $composerFile
22+
);
23+
24+
return str_replace('tempest/', '', $name);
25+
}
26+
27+
/**
28+
* @return array<array-key, array{
29+
* basename: string,
30+
* directory: string,
31+
* name: string,
32+
* package: string,
33+
* organization: string,
34+
* repository: string
35+
* }>
36+
*/
37+
function getPackages(): array {
38+
$packages = [];
39+
$directoryIterator = new DirectoryIterator(realpath(PACKAGES_DIRECTORY));
40+
41+
/**
42+
* @var DirectoryIterator $directory
43+
*/
44+
foreach ($directoryIterator as $directory) {
45+
if ($directory->isDot()) {
46+
continue;
47+
}
48+
49+
$file = $directory->getRealPath() . DIRECTORY_SEPARATOR . 'composer.json';
50+
51+
if (! file_exists($file)) {
52+
continue;
53+
}
54+
55+
$name = getPackageNameFromComposerFile($file);
56+
$packages[] = [
57+
'basename' => $directory->getBasename(),
58+
'directory' => $directory->getRealPath(),
59+
'name' => $name,
60+
'package' => 'tempest/' . $name,
61+
'organization' => 'tempestphp',
62+
'repository' => sprintf('tempest-%s', $name),
63+
];
64+
}
65+
66+
return $packages;
67+
}
68+
69+
foreach (getPackages() as $package) {
70+
$config = $package['directory'] . '/phpunit.xml';
71+
72+
passthru(__DIR__ . "/../vendor/bin/phpunit -c $config --bootstrap " . __DIR__ . "/../vendor/autoload.php --stop-on-failure --stop-on-risky", $result);
73+
74+
if ($result !== 0) {
75+
exit;
76+
}
77+
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"symfony/uid": "^7.1",
3535
"symfony/var-dumper": "^7.1",
3636
"symfony/var-exporter": "^7.1",
37-
"tempest/highlight": "^2.11.2",
37+
"tempest/highlight": "^2.11.4",
3838
"vlucas/phpdotenv": "^5.6",
3939
"voku/portable-ascii": "^2.0.3"
4040
},

phpunit.xml.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd"
55
colors="true"
6+
requireCoverageMetadata="true"
7+
beStrictAboutCoverageMetadata="true"
68
displayDetailsOnTestsThatTriggerDeprecations="true"
79
displayDetailsOnTestsThatTriggerErrors="true"
810
displayDetailsOnTestsThatTriggerNotices="true"

src/Tempest/Auth/phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd" bootstrap="vendor/autoload.php" executionOrder="depends,defects" beStrictAboutOutputDuringTests="true" displayDetailsOnPhpunitDeprecations="true" failOnPhpunitDeprecation="false" failOnRisky="true" failOnWarning="true">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd" bootstrap="vendor/autoload.php" executionOrder="depends,defects" requireCoverageMetadata="true" beStrictAboutCoverageMetadata="true" beStrictAboutOutputDuringTests="true" displayDetailsOnPhpunitDeprecations="true" failOnPhpunitDeprecation="false" failOnRisky="true" failOnWarning="true">
33
<testsuites>
44
<testsuite name="Tempest Auth">
55
<directory>tests</directory>

src/Tempest/Cache/phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd" bootstrap="vendor/autoload.php" executionOrder="depends,defects" beStrictAboutOutputDuringTests="true" displayDetailsOnPhpunitDeprecations="true" failOnPhpunitDeprecation="false" failOnRisky="true" failOnWarning="true">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd" bootstrap="vendor/autoload.php" executionOrder="depends,defects" requireCoverageMetadata="true" beStrictAboutCoverageMetadata="true" beStrictAboutOutputDuringTests="true" displayDetailsOnPhpunitDeprecations="true" failOnPhpunitDeprecation="false" failOnRisky="true" failOnWarning="true">
33
<testsuites>
44
<testsuite name="Tempest Clock">
55
<directory>tests</directory>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":1,"defects":[],"times":{"Tempest\\Clock\\Tests\\GenericClockTest::test_that_generic_clock_returns_the_current_date_time":0.001,"Tempest\\Clock\\Tests\\GenericClockTest::test_that_generic_clock_returns_the_current_time":0,"Tempest\\Clock\\Tests\\GenericClockTest::test_that_generic_clock_sleeps":1.006,"Tempest\\Clock\\Tests\\MockClockTest::test_mock_clock_returns_the_date_time_we_want":0,"Tempest\\Clock\\Tests\\MockClockTest::test_mock_clock_defaults_to_now":0.001,"Tempest\\Clock\\Tests\\MockClockTest::test_mock_clock_returns_the_time_we_want":0,"Tempest\\Clock\\Tests\\MockClockTest::test_mock_clock_sleeps_time":0,"Tempest\\Clock\\Tests\\MockClockTest::test_mock_clock_can_change_time":0}}

src/Tempest/Clock/phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd" bootstrap="vendor/autoload.php" executionOrder="depends,defects" beStrictAboutOutputDuringTests="true" displayDetailsOnPhpunitDeprecations="true" failOnPhpunitDeprecation="false" failOnRisky="true" failOnWarning="true">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd" bootstrap="vendor/autoload.php" executionOrder="depends,defects" requireCoverageMetadata="true" beStrictAboutCoverageMetadata="true" beStrictAboutOutputDuringTests="true" displayDetailsOnPhpunitDeprecations="true" failOnPhpunitDeprecation="false" failOnRisky="true" failOnWarning="true">
33
<testsuites>
44
<testsuite name="Tempest Clock">
55
<directory>tests</directory>

src/Tempest/Clock/tests/GenericClockTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
namespace Tempest\Clock\Tests;
66

77
use DateTimeImmutable;
8+
use PHPUnit\Framework\Attributes\CoversClass;
89
use PHPUnit\Framework\TestCase;
910
use Tempest\Clock\GenericClock;
1011

1112
/**
1213
* @internal
1314
*/
15+
#[CoversClass(GenericClock::class)]
1416
final class GenericClockTest extends TestCase
1517
{
1618
public function test_that_generic_clock_returns_the_current_date_time(): void

src/Tempest/Clock/tests/MockClockTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
namespace Tempest\Clock\Tests;
66

77
use DateTimeImmutable;
8+
use PHPUnit\Framework\Attributes\CoversClass;
89
use PHPUnit\Framework\TestCase;
910
use Tempest\Clock\MockClock;
1011

1112
/**
1213
* @internal
1314
*/
15+
#[CoversClass(MockClock::class)]
1416
final class MockClockTest extends TestCase
1517
{
1618
public function test_mock_clock_returns_the_date_time_we_want(): void
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":1,"defects":{"Tempest\\CommandBus\\Tests\\GenericCommandBusTest::test_getting_command_handler_that_exists":5,"Tempest\\CommandBus\\Tests\\GenericCommandBusTest::test_exception_is_thrown_when_command_handler_doesnt_exist":5,"Tempest\\CommandBus\\Tests\\GenericCommandBusTest::test_exception_is_thrown_when_command_handler_already_exist":5},"times":{"Tempest\\CommandBus\\Tests\\GenericCommandBusTest::test_getting_command_handler_that_exists":0.001,"Tempest\\CommandBus\\Tests\\GenericCommandBusTest::test_exception_is_thrown_when_command_handler_doesnt_exist":0,"Tempest\\CommandBus\\Tests\\GenericCommandBusTest::test_exception_is_thrown_when_command_handler_already_exist":0}}

0 commit comments

Comments
 (0)