Skip to content

Commit fb559b2

Browse files
committed
Add package contract tests
1 parent 97032c0 commit fb559b2

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

tests/CompatibilityTest.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Boson\Component\OsInfo\Tests;
6+
7+
use Boson\Component\OsInfo\StandardInterface;
8+
use Boson\Component\OsInfo\FamilyInterface;
9+
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
10+
use PHPUnit\Framework\Attributes\Group;
11+
12+
/**
13+
* Note: Changing the behavior of these tests is allowed ONLY when updating
14+
* a MAJOR version of the package.
15+
*/
16+
#[Group('boson-php/os-info')]
17+
final class CompatibilityTest extends TestCase
18+
{
19+
#[DoesNotPerformAssertions]
20+
public function testStandardInterfaceCompatibility(): void
21+
{
22+
new class implements StandardInterface {
23+
public string $name {
24+
get {}
25+
}
26+
public ?StandardInterface $parent {
27+
get {}
28+
}
29+
public function isSupports(StandardInterface $standard): bool {}
30+
public function __toString(): string {}
31+
};
32+
}
33+
34+
#[DoesNotPerformAssertions]
35+
public function testFamilyInterfaceCompatibility(): void
36+
{
37+
new class implements FamilyInterface {
38+
public string $name {
39+
get {}
40+
}
41+
public ?FamilyInterface $parent {
42+
get {}
43+
}
44+
public function is(FamilyInterface $family): bool {}
45+
public function __toString(): string {}
46+
};
47+
}
48+
}

0 commit comments

Comments
 (0)