From 96d56f0e32c7ed23d27a0dba7d4dab643f5bcfca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 18 Jan 2025 20:16:00 +0100 Subject: [PATCH] add Cover notation --- phpunit-integration.xml | 1 + phpunit.xml | 1 + src/Detector.php | 8 +- tests/DetectorTest/Bits/BrowserTest.php | 2 + tests/DetectorTest/Bits/OsTest.php | 2 + tests/DetectorTest/Cache/CacheTest.php | 2 + tests/DetectorTest/Detector10Test.php | 2 + tests/DetectorTest/Detector1Test.php | 2 + tests/DetectorTest/Detector2Test.php | 2 + tests/DetectorTest/Detector3Test.php | 2 + tests/DetectorTest/Detector4Test.php | 2 + tests/DetectorTest/Detector5Test.php | 2 + tests/DetectorTest/Detector6Test.php | 2 + tests/DetectorTest/Detector7Test.php | 2 + tests/DetectorTest/Detector8Test.php | 2 + tests/DetectorTest/Detector9Test.php | 2 + tests/DetectorTest/DetectorFactoryTest.php | 2 + tests/DetectorTest/DetectorTest.php | 3 + tests/DetectorTest/Helper/DesktopTest.php | 2 + .../DetectorTest/Helper/MobileDeviceTest.php | 2 + tests/DetectorTest/Helper/TvTest.php | 2 + .../DetectorTest/Loader/BrowserLoaderTest.php | 2 + .../Loader/CompanyLoaderFactoryTest.php | 2 + .../DetectorTest/Loader/CompanyLoaderTest.php | 5 +- .../Loader/DeviceLoaderFactoryTest.php | 2 + .../DetectorTest/Loader/DeviceLoaderTest.php | 2 + .../DetectorTest/Loader/EngineLoaderTest.php | 2 + .../Loader/PlatformLoaderTest.php | 2 + .../Parser/BrowserParserFactoryTest.php | 2 + .../DetectorTest/Parser/BrowserParserTest.php | 2 + .../Parser/Device/DarwinParserTest.php | 2 + .../Parser/Device/DesktopParserTest.php | 2 + .../Parser/Device/MobileParserTest.php | 2 + .../Parser/Device/TvParserTest.php | 2 + .../Parser/DeviceParserFactoryTest.php | 2 + .../DetectorTest/Parser/DeviceParserTest.php | 2 + .../Parser/EngineParserFactoryTest.php | 2 + .../DetectorTest/Parser/EngineParserTest.php | 2 + .../Parser/Header/DeviceStockUaTest.php | 8 ++ .../Parser/Header/FlyFlowHeaderTest.php | 2 + .../Parser/Header/HeaderLoaderTest.php | 2 + .../Parser/Header/SecChUaArchTest.php | 126 ----------------- .../Parser/Header/SecChUaBitnessTest.php | 125 ----------------- .../Parser/Header/SecChUaFullVersionTest.php | 125 ----------------- .../Parser/Header/SecChUaMobileTest.php | 129 ------------------ .../Parser/Header/SecChUaModelTest.php | 2 + .../Parser/Header/SecChUaPlatformTest.php | 2 + .../Header/SecChUaPlatformVersionTest.php | 2 + .../Parser/Header/SecChUaTest.php | 3 + tests/DetectorTest/Parser/Header/UaOsTest.php | 3 + .../Parser/Header/UseragentTest.php | 8 ++ .../Parser/Header/XDeviceUseragentTest.php | 2 + .../Parser/Header/XOperaminiPhoneTest.php | 2 + .../Parser/Header/XOperaminiPhoneUaTest.php | 6 + .../Parser/Header/XPuffinUaTest.php | 3 + .../Parser/Header/XRequestedWithTest.php | 3 + .../Parser/Header/XUcbrowserDeviceTest.php | 2 + .../Parser/Header/XUcbrowserDeviceUaTest.php | 3 + .../Parser/Header/XUcbrowserPhoneTest.php | 3 + .../Parser/Header/XUcbrowserPhoneUaTest.php | 3 + .../Parser/Header/XUcbrowserUaTest.php | 8 ++ .../Parser/Helper/RulefileParserTest.php | 2 + .../Parser/PlatformParserFactoryTest.php | 2 + .../Parser/PlatformParserTest.php | 2 + .../Version/AndroidOsFactoryTest.php | 2 + tests/DetectorTest/Version/AndroidOsTest.php | 2 + .../Version/ChromeOsFactoryTest.php | 2 + tests/DetectorTest/Version/ChromeOsTest.php | 2 + .../Version/CoreMediaFactoryTest.php | 2 + tests/DetectorTest/Version/CoreMediaTest.php | 2 + .../Version/DebianFactoryTest.php | 2 + tests/DetectorTest/Version/DebianTest.php | 2 + .../ErrorVersionCreatorFactoryTest.php | 2 + .../Version/ErrorVersionCreatorTest.php | 2 + .../Version/FirefoxOsFactoryTest.php | 2 + tests/DetectorTest/Version/FirefoxOsTest.php | 2 + .../Version/FriendicaFactoryTest.php | 2 + tests/DetectorTest/Version/FriendicaTest.php | 2 + .../DetectorTest/Version/GeckoFactoryTest.php | 2 + tests/DetectorTest/Version/GeckoTest.php | 2 + .../Version/GoannaFactoryTest.php | 2 + tests/DetectorTest/Version/GoannaTest.php | 2 + .../Version/Helper/SafariTest.php | 2 + tests/DetectorTest/Version/IosFactoryTest.php | 2 + tests/DetectorTest/Version/IosTest.php | 2 + .../DetectorTest/Version/MacosFactoryTest.php | 2 + tests/DetectorTest/Version/MacosTest.php | 2 + .../Version/MaxthonFactoryTest.php | 2 + tests/DetectorTest/Version/MaxthonTest.php | 2 + .../MicrosoftInternetExplorerFactoryTest.php | 2 + .../Version/MicrosoftInternetExplorerTest.php | 2 + .../Version/ObigoQFactoryTest.php | 2 + tests/DetectorTest/Version/ObigoQTest.php | 2 + .../Version/PuffinFactoryTest.php | 2 + tests/DetectorTest/Version/PuffinTest.php | 2 + .../Version/RaspbianFactoryTest.php | 2 + tests/DetectorTest/Version/RaspbianTest.php | 2 + .../DetectorTest/Version/RimOsFactoryTest.php | 2 + tests/DetectorTest/Version/RimOsTest.php | 2 + .../Version/SafariFactoryTest.php | 2 + tests/DetectorTest/Version/SafariTest.php | 2 + .../Version/ScreamingFrogFactoryTest.php | 2 + .../Version/ScreamingFrogTest.php | 2 + .../Version/TestErrorFactoryTest.php | 2 + .../DetectorTest/Version/TestFactoryTest.php | 2 + tests/DetectorTest/Version/TestTest.php | 2 + ...orTest.php => TestUnexpectedErrorTest.php} | 4 +- .../Version/TridentFactoryTest.php | 2 + tests/DetectorTest/Version/TridentTest.php | 2 + .../Version/WindowsMobileOsFactoryTest.php | 2 + .../Version/WindowsMobileOsTest.php | 2 + .../Version/WindowsPhoneOsFactoryTest.php | 2 + .../Version/WindowsPhoneOsTest.php | 2 + tests/UserAgentsTest/DetectorTest.php | 48 ++----- 114 files changed, 260 insertions(+), 550 deletions(-) delete mode 100644 tests/DetectorTest/Parser/Header/SecChUaArchTest.php delete mode 100644 tests/DetectorTest/Parser/Header/SecChUaBitnessTest.php delete mode 100644 tests/DetectorTest/Parser/Header/SecChUaFullVersionTest.php delete mode 100644 tests/DetectorTest/Parser/Header/SecChUaMobileTest.php rename tests/DetectorTest/Version/{TestErrorTest.php => TestUnexpectedErrorTest.php} (86%) diff --git a/phpunit-integration.xml b/phpunit-integration.xml index 24b59af603..5185328816 100644 --- a/phpunit-integration.xml +++ b/phpunit-integration.xml @@ -28,6 +28,7 @@ enforceTimeLimit="false" executionOrder="default" resolveDependencies="true" + requireCoverageMetadata="false" colors="true" cacheDirectory="./.reports/.coverage-cache" columns="123" diff --git a/phpunit.xml b/phpunit.xml index df7ad6f235..88a0745078 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -27,6 +27,7 @@ enforceTimeLimit="false" executionOrder="default" resolveDependencies="true" + requireCoverageMetadata="true" colors="true" cacheDirectory="./.reports/.coverage-cache" columns="119" diff --git a/src/Detector.php b/src/Detector.php index 0771fc2940..f09f2e6bea 100644 --- a/src/Detector.php +++ b/src/Detector.php @@ -45,12 +45,12 @@ use UaResult\Os\OsInterface; use UnexpectedValueException; -use function array_change_key_case; use function array_filter; use function array_map; use function assert; use function explode; use function is_array; +use function is_int; use function is_string; use function mb_strpos; use function mb_strtolower; @@ -60,8 +60,6 @@ use function str_contains; use function trim; -use const CASE_LOWER; - final readonly class Detector implements DetectorInterface { /** @@ -557,6 +555,10 @@ private function getPlatformData(array $filteredHeaders, string | null $platform } } + if (!$platformVersion instanceof VersionInterface) { + $platformVersion = null; + } + return new Os( name: null, marketingName: null, diff --git a/tests/DetectorTest/Bits/BrowserTest.php b/tests/DetectorTest/Bits/BrowserTest.php index da4e931fdd..c5be217489 100644 --- a/tests/DetectorTest/Bits/BrowserTest.php +++ b/tests/DetectorTest/Bits/BrowserTest.php @@ -15,10 +15,12 @@ use BrowserDetector\Bits\Browser; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; +#[CoversClass(Browser::class)] final class BrowserTest extends TestCase { private Browser $object; diff --git a/tests/DetectorTest/Bits/OsTest.php b/tests/DetectorTest/Bits/OsTest.php index 335105b935..dce836a020 100644 --- a/tests/DetectorTest/Bits/OsTest.php +++ b/tests/DetectorTest/Bits/OsTest.php @@ -15,11 +15,13 @@ use BrowserDetector\Bits\Os; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; +#[CoversClass(Os::class)] final class OsTest extends TestCase { private Os $object; diff --git a/tests/DetectorTest/Cache/CacheTest.php b/tests/DetectorTest/Cache/CacheTest.php index c74e42c208..11e622e5ae 100644 --- a/tests/DetectorTest/Cache/CacheTest.php +++ b/tests/DetectorTest/Cache/CacheTest.php @@ -14,6 +14,7 @@ namespace BrowserDetectorTest\Cache; use BrowserDetector\Cache\Cache; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function serialize; +#[CoversClass(Cache::class)] final class CacheTest extends TestCase { /** diff --git a/tests/DetectorTest/Detector10Test.php b/tests/DetectorTest/Detector10Test.php index 40d68fa458..0e02dfc63e 100644 --- a/tests/DetectorTest/Detector10Test.php +++ b/tests/DetectorTest/Detector10Test.php @@ -21,6 +21,7 @@ use BrowserDetector\Version\VersionBuilderFactoryInterface; use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -39,6 +40,7 @@ use UaResult\Os\Os; use UnexpectedValueException; +#[CoversClass(Detector::class)] final class Detector10Test extends TestCase { /** diff --git a/tests/DetectorTest/Detector1Test.php b/tests/DetectorTest/Detector1Test.php index 7b67b82015..97020ab17a 100644 --- a/tests/DetectorTest/Detector1Test.php +++ b/tests/DetectorTest/Detector1Test.php @@ -17,6 +17,7 @@ use BrowserDetector\Detector; use BrowserDetector\Loader\DeviceLoaderFactoryInterface; use BrowserDetector\Version\VersionBuilderFactoryInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -29,6 +30,7 @@ use UaRequest\RequestBuilderInterface; use UnexpectedValueException; +#[CoversClass(Detector::class)] final class Detector1Test extends TestCase { /** diff --git a/tests/DetectorTest/Detector2Test.php b/tests/DetectorTest/Detector2Test.php index 9e9c0649aa..15436c54c2 100644 --- a/tests/DetectorTest/Detector2Test.php +++ b/tests/DetectorTest/Detector2Test.php @@ -21,6 +21,7 @@ use BrowserDetector\Version\VersionBuilderFactoryInterface; use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -44,6 +45,7 @@ use function assert; use function sprintf; +#[CoversClass(Detector::class)] final class Detector2Test extends TestCase { /** diff --git a/tests/DetectorTest/Detector3Test.php b/tests/DetectorTest/Detector3Test.php index 6514a953af..1871d39ef9 100644 --- a/tests/DetectorTest/Detector3Test.php +++ b/tests/DetectorTest/Detector3Test.php @@ -17,6 +17,7 @@ use BrowserDetector\Detector; use BrowserDetector\Loader\DeviceLoaderFactoryInterface; use BrowserDetector\Version\VersionBuilderFactoryInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -30,6 +31,7 @@ use UaRequest\RequestBuilderInterface; use UnexpectedValueException; +#[CoversClass(Detector::class)] final class Detector3Test extends TestCase { /** diff --git a/tests/DetectorTest/Detector4Test.php b/tests/DetectorTest/Detector4Test.php index 6971c7e424..4294378d50 100644 --- a/tests/DetectorTest/Detector4Test.php +++ b/tests/DetectorTest/Detector4Test.php @@ -24,6 +24,7 @@ use BrowserDetector\Version\VersionBuilderFactoryInterface; use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -44,6 +45,7 @@ use UaResult\Os\Os; use UnexpectedValueException; +#[CoversClass(Detector::class)] final class Detector4Test extends TestCase { /** diff --git a/tests/DetectorTest/Detector5Test.php b/tests/DetectorTest/Detector5Test.php index b5b36b0d47..a2a4d8344e 100644 --- a/tests/DetectorTest/Detector5Test.php +++ b/tests/DetectorTest/Detector5Test.php @@ -23,6 +23,7 @@ use BrowserDetector\Version\VersionBuilderFactoryInterface; use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -41,6 +42,7 @@ use UaResult\Os\Os; use UnexpectedValueException; +#[CoversClass(Detector::class)] final class Detector5Test extends TestCase { /** diff --git a/tests/DetectorTest/Detector6Test.php b/tests/DetectorTest/Detector6Test.php index 08dab86a6d..8d2bb32b56 100644 --- a/tests/DetectorTest/Detector6Test.php +++ b/tests/DetectorTest/Detector6Test.php @@ -19,6 +19,7 @@ use BrowserDetector\Loader\DeviceLoaderFactoryInterface; use BrowserDetector\Version\NullVersion; use BrowserDetector\Version\VersionBuilderFactoryInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -37,6 +38,7 @@ use UaResult\Os\Os; use UnexpectedValueException; +#[CoversClass(Detector::class)] final class Detector6Test extends TestCase { /** diff --git a/tests/DetectorTest/Detector7Test.php b/tests/DetectorTest/Detector7Test.php index 83c02387ba..091b6e1c79 100644 --- a/tests/DetectorTest/Detector7Test.php +++ b/tests/DetectorTest/Detector7Test.php @@ -21,6 +21,7 @@ use BrowserDetector\Version\VersionBuilderFactoryInterface; use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -40,6 +41,7 @@ use UaResult\Os\Os; use UnexpectedValueException; +#[CoversClass(Detector::class)] final class Detector7Test extends TestCase { /** diff --git a/tests/DetectorTest/Detector8Test.php b/tests/DetectorTest/Detector8Test.php index f24a8b6443..787fb876a6 100644 --- a/tests/DetectorTest/Detector8Test.php +++ b/tests/DetectorTest/Detector8Test.php @@ -21,6 +21,7 @@ use BrowserDetector\Version\VersionBuilderFactoryInterface; use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -40,6 +41,7 @@ use UaResult\Os\Os; use UnexpectedValueException; +#[CoversClass(Detector::class)] final class Detector8Test extends TestCase { /** diff --git a/tests/DetectorTest/Detector9Test.php b/tests/DetectorTest/Detector9Test.php index ce6471f7de..c5fe3c1931 100644 --- a/tests/DetectorTest/Detector9Test.php +++ b/tests/DetectorTest/Detector9Test.php @@ -23,6 +23,7 @@ use BrowserDetector\Version\VersionBuilderFactoryInterface; use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -43,6 +44,7 @@ use UaResult\Os\Os; use UnexpectedValueException; +#[CoversClass(Detector::class)] final class Detector9Test extends TestCase { /** diff --git a/tests/DetectorTest/DetectorFactoryTest.php b/tests/DetectorTest/DetectorFactoryTest.php index 3f73899e83..352c4b7c61 100644 --- a/tests/DetectorTest/DetectorFactoryTest.php +++ b/tests/DetectorTest/DetectorFactoryTest.php @@ -15,6 +15,7 @@ use BrowserDetector\Detector; use BrowserDetector\DetectorFactory; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -24,6 +25,7 @@ use function assert; +#[CoversClass(DetectorFactory::class)] final class DetectorFactoryTest extends TestCase { /** diff --git a/tests/DetectorTest/DetectorTest.php b/tests/DetectorTest/DetectorTest.php index 4b2085006f..4f22733b38 100644 --- a/tests/DetectorTest/DetectorTest.php +++ b/tests/DetectorTest/DetectorTest.php @@ -13,7 +13,9 @@ namespace BrowserDetectorTest; +use BrowserDetector\Detector; use BrowserDetector\DetectorFactory; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -24,6 +26,7 @@ use RuntimeException; use UnexpectedValueException; +#[CoversClass(Detector::class)] final class DetectorTest extends TestCase { /** diff --git a/tests/DetectorTest/Helper/DesktopTest.php b/tests/DetectorTest/Helper/DesktopTest.php index a92a8905bb..9259956a87 100644 --- a/tests/DetectorTest/Helper/DesktopTest.php +++ b/tests/DetectorTest/Helper/DesktopTest.php @@ -15,12 +15,14 @@ use BrowserDetector\Helper\Desktop; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use function sprintf; +#[CoversClass(Desktop::class)] final class DesktopTest extends TestCase { private Desktop $object; diff --git a/tests/DetectorTest/Helper/MobileDeviceTest.php b/tests/DetectorTest/Helper/MobileDeviceTest.php index 43378e1d55..ddc7891c3a 100644 --- a/tests/DetectorTest/Helper/MobileDeviceTest.php +++ b/tests/DetectorTest/Helper/MobileDeviceTest.php @@ -15,12 +15,14 @@ use BrowserDetector\Helper\MobileDevice; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use function sprintf; +#[CoversClass(MobileDevice::class)] final class MobileDeviceTest extends TestCase { private MobileDevice $object; diff --git a/tests/DetectorTest/Helper/TvTest.php b/tests/DetectorTest/Helper/TvTest.php index 00dab3e840..27fec82ac4 100644 --- a/tests/DetectorTest/Helper/TvTest.php +++ b/tests/DetectorTest/Helper/TvTest.php @@ -15,12 +15,14 @@ use BrowserDetector\Helper\Tv; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use function sprintf; +#[CoversClass(Tv::class)] final class TvTest extends TestCase { private Tv $object; diff --git a/tests/DetectorTest/Loader/BrowserLoaderTest.php b/tests/DetectorTest/Loader/BrowserLoaderTest.php index 2e9d3f94e6..ff790f5a16 100644 --- a/tests/DetectorTest/Loader/BrowserLoaderTest.php +++ b/tests/DetectorTest/Loader/BrowserLoaderTest.php @@ -21,6 +21,7 @@ use BrowserDetector\Version\VersionBuilderInterface; use Laminas\Hydrator\Strategy\StrategyInterface; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -31,6 +32,7 @@ use UaLoader\Exception\NotFoundException; use UnexpectedValueException; +#[CoversClass(BrowserLoader::class)] final class BrowserLoaderTest extends TestCase { /** diff --git a/tests/DetectorTest/Loader/CompanyLoaderFactoryTest.php b/tests/DetectorTest/Loader/CompanyLoaderFactoryTest.php index 29a6ad7788..419e9f1c27 100644 --- a/tests/DetectorTest/Loader/CompanyLoaderFactoryTest.php +++ b/tests/DetectorTest/Loader/CompanyLoaderFactoryTest.php @@ -16,11 +16,13 @@ use BrowserDetector\Loader\CompanyLoaderFactory; use BrowserDetector\Loader\CompanyLoaderInterface; use Laminas\Hydrator\Strategy\StrategyInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use RuntimeException; +#[CoversClass(CompanyLoaderFactory::class)] final class CompanyLoaderFactoryTest extends TestCase { /** diff --git a/tests/DetectorTest/Loader/CompanyLoaderTest.php b/tests/DetectorTest/Loader/CompanyLoaderTest.php index 9e42f8b713..ff52a779cc 100644 --- a/tests/DetectorTest/Loader/CompanyLoaderTest.php +++ b/tests/DetectorTest/Loader/CompanyLoaderTest.php @@ -18,6 +18,7 @@ use BrowserDetector\Loader\InitData\Company as DataCompany; use Laminas\Hydrator\Strategy\StrategyInterface; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -26,9 +27,7 @@ use RuntimeException; use UaLoader\Exception\NotFoundException; -/** - * Test class for \BrowserDetector\Loader\CompanyLoader - */ +#[CoversClass(CompanyLoader::class)] final class CompanyLoaderTest extends TestCase { /** diff --git a/tests/DetectorTest/Loader/DeviceLoaderFactoryTest.php b/tests/DetectorTest/Loader/DeviceLoaderFactoryTest.php index fa598df3ad..03b3024411 100644 --- a/tests/DetectorTest/Loader/DeviceLoaderFactoryTest.php +++ b/tests/DetectorTest/Loader/DeviceLoaderFactoryTest.php @@ -15,6 +15,7 @@ use BrowserDetector\Loader\CompanyLoaderInterface; use BrowserDetector\Loader\DeviceLoaderFactory; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -22,6 +23,7 @@ use RuntimeException; use UaLoader\DeviceLoaderInterface; +#[CoversClass(DeviceLoaderFactory::class)] final class DeviceLoaderFactoryTest extends TestCase { /** diff --git a/tests/DetectorTest/Loader/DeviceLoaderTest.php b/tests/DetectorTest/Loader/DeviceLoaderTest.php index 1153bd8086..148e05a8b5 100644 --- a/tests/DetectorTest/Loader/DeviceLoaderTest.php +++ b/tests/DetectorTest/Loader/DeviceLoaderTest.php @@ -18,12 +18,14 @@ use BrowserDetector\Loader\DeviceLoader; use Laminas\Hydrator\Strategy\StrategyInterface; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use RuntimeException; use UaLoader\Exception\NotFoundException; use UnexpectedValueException; +#[CoversClass(DeviceLoader::class)] final class DeviceLoaderTest extends TestCase { /** diff --git a/tests/DetectorTest/Loader/EngineLoaderTest.php b/tests/DetectorTest/Loader/EngineLoaderTest.php index 3d1e4b5035..da9b29488d 100644 --- a/tests/DetectorTest/Loader/EngineLoaderTest.php +++ b/tests/DetectorTest/Loader/EngineLoaderTest.php @@ -25,6 +25,7 @@ use BrowserDetector\Version\VersionBuilderInterface; use Laminas\Hydrator\Strategy\StrategyInterface; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -37,6 +38,7 @@ use UaResult\Engine\Engine; use UnexpectedValueException; +#[CoversClass(EngineLoader::class)] final class EngineLoaderTest extends TestCase { /** diff --git a/tests/DetectorTest/Loader/PlatformLoaderTest.php b/tests/DetectorTest/Loader/PlatformLoaderTest.php index bda75efd8a..a12e9e5eea 100644 --- a/tests/DetectorTest/Loader/PlatformLoaderTest.php +++ b/tests/DetectorTest/Loader/PlatformLoaderTest.php @@ -29,6 +29,7 @@ use BrowserDetector\Version\VersionInterface; use Laminas\Hydrator\Strategy\StrategyInterface; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Constraint\IsInstanceOf; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -42,6 +43,7 @@ use UaResult\Os\Os; use UnexpectedValueException; +#[CoversClass(PlatformLoader::class)] final class PlatformLoaderTest extends TestCase { /** diff --git a/tests/DetectorTest/Parser/BrowserParserFactoryTest.php b/tests/DetectorTest/Parser/BrowserParserFactoryTest.php index 88f714023f..4376759558 100644 --- a/tests/DetectorTest/Parser/BrowserParserFactoryTest.php +++ b/tests/DetectorTest/Parser/BrowserParserFactoryTest.php @@ -15,12 +15,14 @@ use BrowserDetector\Parser\BrowserParser; use BrowserDetector\Parser\BrowserParserFactory; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use UaParser\BrowserParserInterface; +#[CoversClass(BrowserParserFactory::class)] final class BrowserParserFactoryTest extends TestCase { /** diff --git a/tests/DetectorTest/Parser/BrowserParserTest.php b/tests/DetectorTest/Parser/BrowserParserTest.php index ecf87eba7a..77494e361a 100644 --- a/tests/DetectorTest/Parser/BrowserParserTest.php +++ b/tests/DetectorTest/Parser/BrowserParserTest.php @@ -15,9 +15,11 @@ use BrowserDetector\Parser\BrowserParser; use BrowserDetector\Parser\Helper\RulefileParserInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; +#[CoversClass(BrowserParser::class)] final class BrowserParserTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/Device/DarwinParserTest.php b/tests/DetectorTest/Parser/Device/DarwinParserTest.php index 801297c04a..e8d71e00b8 100644 --- a/tests/DetectorTest/Parser/Device/DarwinParserTest.php +++ b/tests/DetectorTest/Parser/Device/DarwinParserTest.php @@ -15,10 +15,12 @@ use BrowserDetector\Parser\Device\DarwinParser; use BrowserDetector\Parser\Helper\RulefileParserInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use UaLoader\DeviceLoaderInterface; +#[CoversClass(DarwinParser::class)] final class DarwinParserTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/Device/DesktopParserTest.php b/tests/DetectorTest/Parser/Device/DesktopParserTest.php index f6487c2667..3c8639c02a 100644 --- a/tests/DetectorTest/Parser/Device/DesktopParserTest.php +++ b/tests/DetectorTest/Parser/Device/DesktopParserTest.php @@ -15,10 +15,12 @@ use BrowserDetector\Parser\Device\DesktopParser; use BrowserDetector\Parser\Helper\RulefileParserInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use UaLoader\DeviceLoaderInterface; +#[CoversClass(DesktopParser::class)] final class DesktopParserTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/Device/MobileParserTest.php b/tests/DetectorTest/Parser/Device/MobileParserTest.php index e29f62c53d..0614886ffa 100644 --- a/tests/DetectorTest/Parser/Device/MobileParserTest.php +++ b/tests/DetectorTest/Parser/Device/MobileParserTest.php @@ -15,10 +15,12 @@ use BrowserDetector\Parser\Device\MobileParser; use BrowserDetector\Parser\Helper\RulefileParserInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use UaLoader\DeviceLoaderInterface; +#[CoversClass(MobileParser::class)] final class MobileParserTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/Device/TvParserTest.php b/tests/DetectorTest/Parser/Device/TvParserTest.php index 9d990212a3..fabe4cb94d 100644 --- a/tests/DetectorTest/Parser/Device/TvParserTest.php +++ b/tests/DetectorTest/Parser/Device/TvParserTest.php @@ -15,9 +15,11 @@ use BrowserDetector\Parser\Device\TvParser; use BrowserDetector\Parser\Helper\RulefileParserInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; +#[CoversClass(TvParser::class)] final class TvParserTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/DeviceParserFactoryTest.php b/tests/DetectorTest/Parser/DeviceParserFactoryTest.php index 625002f9ad..015118f9eb 100644 --- a/tests/DetectorTest/Parser/DeviceParserFactoryTest.php +++ b/tests/DetectorTest/Parser/DeviceParserFactoryTest.php @@ -15,12 +15,14 @@ use BrowserDetector\Parser\DeviceParser; use BrowserDetector\Parser\DeviceParserFactory; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use UaParser\DeviceParserInterface; +#[CoversClass(DeviceParserFactory::class)] final class DeviceParserFactoryTest extends TestCase { /** diff --git a/tests/DetectorTest/Parser/DeviceParserTest.php b/tests/DetectorTest/Parser/DeviceParserTest.php index 4404a0c727..f219f4b010 100644 --- a/tests/DetectorTest/Parser/DeviceParserTest.php +++ b/tests/DetectorTest/Parser/DeviceParserTest.php @@ -21,9 +21,11 @@ use BrowserDetector\Parser\Device\MobileParserInterface; use BrowserDetector\Parser\Device\TvParserInterface; use BrowserDetector\Parser\DeviceParser; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; +#[CoversClass(DeviceParser::class)] final class DeviceParserTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/EngineParserFactoryTest.php b/tests/DetectorTest/Parser/EngineParserFactoryTest.php index 953a7ee6ea..24bbb078dd 100644 --- a/tests/DetectorTest/Parser/EngineParserFactoryTest.php +++ b/tests/DetectorTest/Parser/EngineParserFactoryTest.php @@ -15,12 +15,14 @@ use BrowserDetector\Parser\EngineParser; use BrowserDetector\Parser\EngineParserFactory; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use UaParser\EngineParserInterface; +#[CoversClass(EngineParserFactory::class)] final class EngineParserFactoryTest extends TestCase { /** diff --git a/tests/DetectorTest/Parser/EngineParserTest.php b/tests/DetectorTest/Parser/EngineParserTest.php index 53dee4aa7b..cb55088c48 100644 --- a/tests/DetectorTest/Parser/EngineParserTest.php +++ b/tests/DetectorTest/Parser/EngineParserTest.php @@ -15,10 +15,12 @@ use BrowserDetector\Parser\EngineParser; use BrowserDetector\Parser\Helper\RulefileParserInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; +#[CoversClass(EngineParser::class)] final class EngineParserTest extends TestCase { /** diff --git a/tests/DetectorTest/Parser/Header/DeviceStockUaTest.php b/tests/DetectorTest/Parser/Header/DeviceStockUaTest.php index b44452afd6..e431d8f972 100644 --- a/tests/DetectorTest/Parser/Header/DeviceStockUaTest.php +++ b/tests/DetectorTest/Parser/Header/DeviceStockUaTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Parser\Header\DeviceStockUaEngineVersion; use BrowserDetector\Parser\Header\DeviceStockUaPlatformCode; use BrowserDetector\Parser\Header\DeviceStockUaPlatformVersion; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -29,6 +30,13 @@ use function preg_match; use function sprintf; +#[CoversClass(DeviceStockUaClientCode::class)] +#[CoversClass(DeviceStockUaClientVersion::class)] +#[CoversClass(DeviceStockUaPlatformCode::class)] +#[CoversClass(DeviceStockUaPlatformVersion::class)] +#[CoversClass(DeviceStockUaEngineCode::class)] +#[CoversClass(DeviceStockUaEngineVersion::class)] +#[CoversClass(DeviceStockUaDeviceCode::class)] final class DeviceStockUaTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/Header/FlyFlowHeaderTest.php b/tests/DetectorTest/Parser/Header/FlyFlowHeaderTest.php index 65378a91d9..945f092c51 100644 --- a/tests/DetectorTest/Parser/Header/FlyFlowHeaderTest.php +++ b/tests/DetectorTest/Parser/Header/FlyFlowHeaderTest.php @@ -14,6 +14,7 @@ namespace Parser\Header; use BrowserDetector\Parser\Header\BaiduFlyflow; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function preg_match; use function sprintf; +#[CoversClass(BaiduFlyflow::class)] final class FlyFlowHeaderTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/Header/HeaderLoaderTest.php b/tests/DetectorTest/Parser/Header/HeaderLoaderTest.php index f6d4e58807..a7b2ba20be 100644 --- a/tests/DetectorTest/Parser/Header/HeaderLoaderTest.php +++ b/tests/DetectorTest/Parser/Header/HeaderLoaderTest.php @@ -14,6 +14,7 @@ namespace BrowserDetectorTest\Parser\Header; use BrowserDetector\Parser\Header\HeaderLoader; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -32,6 +33,7 @@ use function sprintf; +#[CoversClass(HeaderLoader::class)] final class HeaderLoaderTest extends TestCase { /** @throws NotFoundException */ diff --git a/tests/DetectorTest/Parser/Header/SecChUaArchTest.php b/tests/DetectorTest/Parser/Header/SecChUaArchTest.php deleted file mode 100644 index 6a0dca9c1e..0000000000 --- a/tests/DetectorTest/Parser/Header/SecChUaArchTest.php +++ /dev/null @@ -1,126 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -declare(strict_types = 1); - -namespace BrowserDetectorTest\Parser\Header; - -use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\ExpectationFailedException; -use PHPUnit\Framework\TestCase; -use UaRequest\Header\SecChUaArch; - -use function sprintf; - -final class SecChUaArchTest extends TestCase -{ - /** @throws ExpectationFailedException */ - #[DataProvider('providerUa')] - public function testData(string $ua, bool $hasArch, string | null $arch): void - { - $header = new SecChUaArch($ua); - - self::assertSame($ua, $header->getValue(), sprintf('value mismatch for ua "%s"', $ua)); - self::assertSame( - $ua, - $header->getNormalizedValue(), - sprintf('value mismatch for ua "%s"', $ua), - ); - self::assertSame( - $hasArch, - $header->hasDeviceArchitecture(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertSame( - $arch, - $header->getDeviceArchitecture(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasDeviceBitness(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getDeviceBitness(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasDeviceIsMobile(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getDeviceIsMobile(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertFalse($header->hasDeviceCode(), sprintf('device info mismatch for ua "%s"', $ua)); - self::assertNull( - $header->getDeviceCode(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertFalse($header->hasClientCode(), sprintf('browser info mismatch for ua "%s"', $ua)); - self::assertNull( - $header->getClientCode(), - sprintf('browser info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasClientVersion(), - sprintf('browser info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getClientVersion(), - sprintf('browser info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasPlatformCode(), - sprintf('platform info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getPlatformCode(), - sprintf('platform info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasPlatformVersion(), - sprintf('platform info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getPlatformVersion(), - sprintf('platform info mismatch for ua "%s"', $ua), - ); - self::assertFalse($header->hasEngineCode(), sprintf('engine info mismatch for ua "%s"', $ua)); - self::assertNull( - $header->getEngineCode(), - sprintf('engine info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasEngineVersion(), - sprintf('engine info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getEngineVersion(), - sprintf('engine info mismatch for ua "%s"', $ua), - ); - } - - /** - * @return array> - * - * @throws void - */ - public static function providerUa(): array - { - return [ - ['arm', true, 'arm'], - ['"arm"', true, 'arm'], - ['"x86"', true, 'x86'], - ['""', false, null], - ]; - } -} diff --git a/tests/DetectorTest/Parser/Header/SecChUaBitnessTest.php b/tests/DetectorTest/Parser/Header/SecChUaBitnessTest.php deleted file mode 100644 index c87e523807..0000000000 --- a/tests/DetectorTest/Parser/Header/SecChUaBitnessTest.php +++ /dev/null @@ -1,125 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -declare(strict_types = 1); - -namespace BrowserDetectorTest\Parser\Header; - -use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\ExpectationFailedException; -use PHPUnit\Framework\TestCase; -use UaRequest\Header\SecChUaBitness; - -use function sprintf; - -final class SecChUaBitnessTest extends TestCase -{ - /** @throws ExpectationFailedException */ - #[DataProvider('providerUa')] - public function testData(string $ua, bool $hasBits, int | null $bits): void - { - $header = new SecChUaBitness($ua); - - self::assertSame($ua, $header->getValue(), sprintf('value mismatch for ua "%s"', $ua)); - self::assertSame( - $ua, - $header->getNormalizedValue(), - sprintf('value mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasDeviceArchitecture(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getDeviceArchitecture(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertSame( - $hasBits, - $header->hasDeviceBitness(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertSame( - $bits, - $header->getDeviceBitness(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasDeviceIsMobile(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getDeviceIsMobile(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertFalse($header->hasDeviceCode(), sprintf('device info mismatch for ua "%s"', $ua)); - self::assertNull( - $header->getDeviceCode(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertFalse($header->hasClientCode(), sprintf('browser info mismatch for ua "%s"', $ua)); - self::assertNull( - $header->getClientCode(), - sprintf('browser info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasClientVersion(), - sprintf('browser info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getClientVersion(), - sprintf('browser info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasPlatformCode(), - sprintf('platform info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getPlatformCode(), - sprintf('platform info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasPlatformVersion(), - sprintf('platform info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getPlatformVersion(), - sprintf('platform info mismatch for ua "%s"', $ua), - ); - self::assertFalse($header->hasEngineCode(), sprintf('engine info mismatch for ua "%s"', $ua)); - self::assertNull( - $header->getEngineCode(), - sprintf('engine info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasEngineVersion(), - sprintf('engine info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getEngineVersion(), - sprintf('engine info mismatch for ua "%s"', $ua), - ); - } - - /** - * @return array> - * - * @throws void - */ - public static function providerUa(): array - { - return [ - ['64', true, 64], - ['"64"', true, 64], - ['""', false, null], - ]; - } -} diff --git a/tests/DetectorTest/Parser/Header/SecChUaFullVersionTest.php b/tests/DetectorTest/Parser/Header/SecChUaFullVersionTest.php deleted file mode 100644 index bcad683c2b..0000000000 --- a/tests/DetectorTest/Parser/Header/SecChUaFullVersionTest.php +++ /dev/null @@ -1,125 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -declare(strict_types = 1); - -namespace BrowserDetectorTest\Parser\Header; - -use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\ExpectationFailedException; -use PHPUnit\Framework\TestCase; -use UaRequest\Header\SecChUaFullVersion; - -use function sprintf; - -final class SecChUaFullVersionTest extends TestCase -{ - /** @throws ExpectationFailedException */ - #[DataProvider('providerUa')] - public function testData(string $ua, bool $hasVersion, string | null $version): void - { - $header = new SecChUaFullVersion($ua); - - self::assertSame($ua, $header->getValue(), sprintf('value mismatch for ua "%s"', $ua)); - self::assertSame( - $ua, - $header->getNormalizedValue(), - sprintf('value mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasDeviceArchitecture(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getDeviceArchitecture(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasDeviceBitness(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getDeviceBitness(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasDeviceIsMobile(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getDeviceIsMobile(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertFalse($header->hasDeviceCode(), sprintf('device info mismatch for ua "%s"', $ua)); - self::assertNull( - $header->getDeviceCode(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertFalse($header->hasClientCode(), sprintf('browser info mismatch for ua "%s"', $ua)); - self::assertNull( - $header->getClientCode(), - sprintf('browser info mismatch for ua "%s"', $ua), - ); - self::assertSame( - $hasVersion, - $header->hasClientVersion(), - sprintf('browser info mismatch for ua "%s"', $ua), - ); - self::assertSame( - $version, - $header->getClientVersion(), - sprintf('browser info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasPlatformCode(), - sprintf('platform info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getPlatformCode(), - sprintf('platform info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasPlatformVersion(), - sprintf('platform info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getPlatformVersion(), - sprintf('platform info mismatch for ua "%s"', $ua), - ); - self::assertFalse($header->hasEngineCode(), sprintf('engine info mismatch for ua "%s"', $ua)); - self::assertNull( - $header->getEngineCode(), - sprintf('engine info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasEngineVersion(), - sprintf('engine info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getEngineVersion(), - sprintf('engine info mismatch for ua "%s"', $ua), - ); - } - - /** - * @return array> - * - * @throws void - */ - public static function providerUa(): array - { - return [ - ['98.0.4758.102', true, '98.0.4758.102'], - ['"98.0.4758.102"', true, '98.0.4758.102'], - ['""', false, null], - ]; - } -} diff --git a/tests/DetectorTest/Parser/Header/SecChUaMobileTest.php b/tests/DetectorTest/Parser/Header/SecChUaMobileTest.php deleted file mode 100644 index 67b57f837e..0000000000 --- a/tests/DetectorTest/Parser/Header/SecChUaMobileTest.php +++ /dev/null @@ -1,129 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -declare(strict_types = 1); - -namespace BrowserDetectorTest\Parser\Header; - -use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\ExpectationFailedException; -use PHPUnit\Framework\TestCase; -use UaRequest\Header\SecChUaMobile; - -use function sprintf; - -final class SecChUaMobileTest extends TestCase -{ - /** @throws ExpectationFailedException */ - #[DataProvider('providerUa')] - public function testData(string $ua, bool | null $isMobile): void - { - $header = new SecChUaMobile($ua); - - self::assertSame($ua, $header->getValue(), sprintf('value mismatch for ua "%s"', $ua)); - self::assertSame( - $ua, - $header->getNormalizedValue(), - sprintf('value mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasDeviceArchitecture(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getDeviceArchitecture(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasDeviceBitness(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getDeviceBitness(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertTrue( - $header->hasDeviceIsMobile(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertSame( - $isMobile, - $header->getDeviceIsMobile(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertFalse($header->hasDeviceCode(), sprintf('device info mismatch for ua "%s"', $ua)); - self::assertNull( - $header->getDeviceCode(), - sprintf('device info mismatch for ua "%s"', $ua), - ); - self::assertFalse($header->hasClientCode(), sprintf('browser info mismatch for ua "%s"', $ua)); - self::assertNull( - $header->getClientCode(), - sprintf('browser info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasClientVersion(), - sprintf('browser info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getClientVersion(), - sprintf('browser info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasPlatformCode(), - sprintf('platform info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getPlatformCode(), - sprintf('platform info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasPlatformVersion(), - sprintf('platform info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getPlatformVersion(), - sprintf('platform info mismatch for ua "%s"', $ua), - ); - self::assertFalse($header->hasEngineCode(), sprintf('engine info mismatch for ua "%s"', $ua)); - self::assertNull( - $header->getEngineCode(), - sprintf('engine info mismatch for ua "%s"', $ua), - ); - self::assertFalse( - $header->hasEngineVersion(), - sprintf('engine info mismatch for ua "%s"', $ua), - ); - self::assertNull( - $header->getEngineVersion(), - sprintf('engine info mismatch for ua "%s"', $ua), - ); - } - - /** - * @return array> - * - * @throws void - */ - public static function providerUa(): array - { - return [ - ['?0', false], - ['"?0"', false], - ['"?1"', true], - ['?1', true], - ['1', true], - ['0', false], - ['', false], - ['""', false], - ]; - } -} diff --git a/tests/DetectorTest/Parser/Header/SecChUaModelTest.php b/tests/DetectorTest/Parser/Header/SecChUaModelTest.php index 9dd2682de0..d310853f19 100644 --- a/tests/DetectorTest/Parser/Header/SecChUaModelTest.php +++ b/tests/DetectorTest/Parser/Header/SecChUaModelTest.php @@ -14,6 +14,7 @@ namespace BrowserDetectorTest\Parser\Header; use BrowserDetector\Parser\Header\SecChUaModel; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -21,6 +22,7 @@ use function sprintf; +#[CoversClass(SecChUaModel::class)] final class SecChUaModelTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/Header/SecChUaPlatformTest.php b/tests/DetectorTest/Parser/Header/SecChUaPlatformTest.php index 041522f628..7bb946ca8a 100644 --- a/tests/DetectorTest/Parser/Header/SecChUaPlatformTest.php +++ b/tests/DetectorTest/Parser/Header/SecChUaPlatformTest.php @@ -14,6 +14,7 @@ namespace BrowserDetectorTest\Parser\Header; use BrowserDetector\Parser\Header\SecChUaPlatform; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -21,6 +22,7 @@ use function sprintf; +#[CoversClass(SecChUaPlatform::class)] final class SecChUaPlatformTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/Header/SecChUaPlatformVersionTest.php b/tests/DetectorTest/Parser/Header/SecChUaPlatformVersionTest.php index a86d82dcb3..e047b80f35 100644 --- a/tests/DetectorTest/Parser/Header/SecChUaPlatformVersionTest.php +++ b/tests/DetectorTest/Parser/Header/SecChUaPlatformVersionTest.php @@ -14,6 +14,7 @@ namespace BrowserDetectorTest\Parser\Header; use BrowserDetector\Parser\Header\SecChUaPlatformVersion; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -21,6 +22,7 @@ use function sprintf; +#[CoversClass(SecChUaPlatformVersion::class)] final class SecChUaPlatformVersionTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/Header/SecChUaTest.php b/tests/DetectorTest/Parser/Header/SecChUaTest.php index 86c1fd6680..cc051ddc94 100644 --- a/tests/DetectorTest/Parser/Header/SecChUaTest.php +++ b/tests/DetectorTest/Parser/Header/SecChUaTest.php @@ -15,6 +15,7 @@ use BrowserDetector\Parser\Header\SecChUaClientCode; use BrowserDetector\Parser\Header\SecChUaClientVersion; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -22,6 +23,8 @@ use function sprintf; +#[CoversClass(SecChUaClientCode::class)] +#[CoversClass(SecChUaClientVersion::class)] final class SecChUaTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/Header/UaOsTest.php b/tests/DetectorTest/Parser/Header/UaOsTest.php index 16865b5eba..2e028d2b5e 100644 --- a/tests/DetectorTest/Parser/Header/UaOsTest.php +++ b/tests/DetectorTest/Parser/Header/UaOsTest.php @@ -15,6 +15,7 @@ use BrowserDetector\Parser\Header\UaOsPlatformCode; use BrowserDetector\Parser\Header\UaOsPlatformVersion; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -22,6 +23,8 @@ use function sprintf; +#[CoversClass(UaOsPlatformCode::class)] +#[CoversClass(UaOsPlatformVersion::class)] final class UaOsTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/Header/UseragentTest.php b/tests/DetectorTest/Parser/Header/UseragentTest.php index 9ccbb98797..04d94bb418 100644 --- a/tests/DetectorTest/Parser/Header/UseragentTest.php +++ b/tests/DetectorTest/Parser/Header/UseragentTest.php @@ -24,6 +24,7 @@ use BrowserDetector\Version\Exception\NotNumericException; use BrowserDetector\Version\NullVersion; use BrowserDetector\Version\VersionBuilder; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -46,6 +47,13 @@ use function sprintf; +#[CoversClass(UseragentClientCode::class)] +#[CoversClass(UseragentClientVersion::class)] +#[CoversClass(UseragentDeviceCode::class)] +#[CoversClass(UseragentEngineCode::class)] +#[CoversClass(UseragentEngineVersion::class)] +#[CoversClass(UseragentPlatformCode::class)] +#[CoversClass(UseragentPlatformVersion::class)] final class UseragentTest extends TestCase { /** diff --git a/tests/DetectorTest/Parser/Header/XDeviceUseragentTest.php b/tests/DetectorTest/Parser/Header/XDeviceUseragentTest.php index 3970ea1bb8..ff16e91fec 100644 --- a/tests/DetectorTest/Parser/Header/XDeviceUseragentTest.php +++ b/tests/DetectorTest/Parser/Header/XDeviceUseragentTest.php @@ -14,6 +14,7 @@ namespace BrowserDetectorTest\Parser\Header; use BrowserDetector\Parser\Header\XDeviceUseragent; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -24,6 +25,7 @@ use function sprintf; +#[CoversClass(XDeviceUseragent::class)] final class XDeviceUseragentTest extends TestCase { /** diff --git a/tests/DetectorTest/Parser/Header/XOperaminiPhoneTest.php b/tests/DetectorTest/Parser/Header/XOperaminiPhoneTest.php index 0ba60ea6aa..0d6b4c18ea 100644 --- a/tests/DetectorTest/Parser/Header/XOperaminiPhoneTest.php +++ b/tests/DetectorTest/Parser/Header/XOperaminiPhoneTest.php @@ -14,6 +14,7 @@ namespace BrowserDetectorTest\Parser\Header; use BrowserDetector\Parser\Header\XOperaminiPhone; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -21,6 +22,7 @@ use function sprintf; +#[CoversClass(XOperaminiPhone::class)] final class XOperaminiPhoneTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/Header/XOperaminiPhoneUaTest.php b/tests/DetectorTest/Parser/Header/XOperaminiPhoneUaTest.php index 268538cb52..1ce117c278 100644 --- a/tests/DetectorTest/Parser/Header/XOperaminiPhoneUaTest.php +++ b/tests/DetectorTest/Parser/Header/XOperaminiPhoneUaTest.php @@ -18,6 +18,7 @@ use BrowserDetector\Parser\Header\XOperaminiPhoneUaDeviceCode; use BrowserDetector\Parser\Header\XOperaminiPhoneUaEngineCode; use BrowserDetector\Parser\Header\XOperaminiPhoneUaPlatformCode; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -29,6 +30,11 @@ use function sprintf; +#[CoversClass(XOperaminiPhoneUaClientCode::class)] +#[CoversClass(XOperaminiPhoneUaClientVersion::class)] +#[CoversClass(XOperaminiPhoneUaDeviceCode::class)] +#[CoversClass(XOperaminiPhoneUaEngineCode::class)] +#[CoversClass(XOperaminiPhoneUaPlatformCode::class)] final class XOperaminiPhoneUaTest extends TestCase { /** diff --git a/tests/DetectorTest/Parser/Header/XPuffinUaTest.php b/tests/DetectorTest/Parser/Header/XPuffinUaTest.php index 4d4bb571ac..bd1fe6be01 100644 --- a/tests/DetectorTest/Parser/Header/XPuffinUaTest.php +++ b/tests/DetectorTest/Parser/Header/XPuffinUaTest.php @@ -15,6 +15,7 @@ use BrowserDetector\Parser\Header\XPuffinUaDeviceCode; use BrowserDetector\Parser\Header\XPuffinUaPlatformCode; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -22,6 +23,8 @@ use function sprintf; +#[CoversClass(XPuffinUaDeviceCode::class)] +#[CoversClass(XPuffinUaPlatformCode::class)] final class XPuffinUaTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/Header/XRequestedWithTest.php b/tests/DetectorTest/Parser/Header/XRequestedWithTest.php index a3326ac177..85fb636f83 100644 --- a/tests/DetectorTest/Parser/Header/XRequestedWithTest.php +++ b/tests/DetectorTest/Parser/Header/XRequestedWithTest.php @@ -15,6 +15,7 @@ use BrowserDetector\Parser\Header\XRequestedWithClientCode; use BrowserDetector\Parser\Header\XRequestedWithClientVersion; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -22,6 +23,8 @@ use function sprintf; +#[CoversClass(XRequestedWithClientCode::class)] +#[CoversClass(XRequestedWithClientVersion::class)] final class XRequestedWithTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/Header/XUcbrowserDeviceTest.php b/tests/DetectorTest/Parser/Header/XUcbrowserDeviceTest.php index 63d46c390c..c6e5835f71 100644 --- a/tests/DetectorTest/Parser/Header/XUcbrowserDeviceTest.php +++ b/tests/DetectorTest/Parser/Header/XUcbrowserDeviceTest.php @@ -14,6 +14,7 @@ namespace BrowserDetectorTest\Parser\Header; use BrowserDetector\Parser\Header\XUcbrowserDevice; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -26,6 +27,7 @@ use function mb_strtolower; use function sprintf; +#[CoversClass(XUcbrowserDevice::class)] final class XUcbrowserDeviceTest extends TestCase { /** diff --git a/tests/DetectorTest/Parser/Header/XUcbrowserDeviceUaTest.php b/tests/DetectorTest/Parser/Header/XUcbrowserDeviceUaTest.php index c40225ea82..13ee35adb9 100644 --- a/tests/DetectorTest/Parser/Header/XUcbrowserDeviceUaTest.php +++ b/tests/DetectorTest/Parser/Header/XUcbrowserDeviceUaTest.php @@ -15,6 +15,7 @@ use BrowserDetector\Parser\Header\XUcbrowserDeviceUaDeviceCode; use BrowserDetector\Parser\Header\XUcbrowserDeviceUaPlatformCode; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -26,6 +27,8 @@ use function sprintf; +#[CoversClass(XUcbrowserDeviceUaDeviceCode::class)] +#[CoversClass(XUcbrowserDeviceUaPlatformCode::class)] final class XUcbrowserDeviceUaTest extends TestCase { /** diff --git a/tests/DetectorTest/Parser/Header/XUcbrowserPhoneTest.php b/tests/DetectorTest/Parser/Header/XUcbrowserPhoneTest.php index 5a32a146be..1c9e662e21 100644 --- a/tests/DetectorTest/Parser/Header/XUcbrowserPhoneTest.php +++ b/tests/DetectorTest/Parser/Header/XUcbrowserPhoneTest.php @@ -15,6 +15,7 @@ use BrowserDetector\Parser\Header\XUcbrowserPhoneClientCode; use BrowserDetector\Parser\Header\XUcbrowserPhoneDeviceCode; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -22,6 +23,8 @@ use function sprintf; +#[CoversClass(XUcbrowserPhoneClientCode::class)] +#[CoversClass(XUcbrowserPhoneDeviceCode::class)] final class XUcbrowserPhoneTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/Header/XUcbrowserPhoneUaTest.php b/tests/DetectorTest/Parser/Header/XUcbrowserPhoneUaTest.php index 7c9e65160a..1e4994a570 100644 --- a/tests/DetectorTest/Parser/Header/XUcbrowserPhoneUaTest.php +++ b/tests/DetectorTest/Parser/Header/XUcbrowserPhoneUaTest.php @@ -15,6 +15,7 @@ use BrowserDetector\Parser\Header\XUcbrowserPhoneClientCode; use BrowserDetector\Parser\Header\XUcbrowserPhoneDeviceCode; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -22,6 +23,8 @@ use function sprintf; +#[CoversClass(XUcbrowserPhoneClientCode::class)] +#[CoversClass(XUcbrowserPhoneDeviceCode::class)] final class XUcbrowserPhoneUaTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/Header/XUcbrowserUaTest.php b/tests/DetectorTest/Parser/Header/XUcbrowserUaTest.php index aa97b71449..75b31b6a5d 100644 --- a/tests/DetectorTest/Parser/Header/XUcbrowserUaTest.php +++ b/tests/DetectorTest/Parser/Header/XUcbrowserUaTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Parser\Header\XUcbrowserUaEngineVersion; use BrowserDetector\Parser\Header\XUcbrowserUaPlatformCode; use BrowserDetector\Parser\Header\XUcbrowserUaPlatformVersion; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -29,6 +30,13 @@ use function preg_match; use function sprintf; +#[CoversClass(XUcbrowserUaClientCode::class)] +#[CoversClass(XUcbrowserUaClientVersion::class)] +#[CoversClass(XUcbrowserUaDeviceCode::class)] +#[CoversClass(XUcbrowserUaEngineCode::class)] +#[CoversClass(XUcbrowserUaEngineVersion::class)] +#[CoversClass(XUcbrowserUaPlatformCode::class)] +#[CoversClass(XUcbrowserUaPlatformVersion::class)] final class XUcbrowserUaTest extends TestCase { /** @throws ExpectationFailedException */ diff --git a/tests/DetectorTest/Parser/Helper/RulefileParserTest.php b/tests/DetectorTest/Parser/Helper/RulefileParserTest.php index 2dc1e74822..3290ac3783 100644 --- a/tests/DetectorTest/Parser/Helper/RulefileParserTest.php +++ b/tests/DetectorTest/Parser/Helper/RulefileParserTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Parser\Helper\RulefileParser; use JsonException; use org\bovigo\vfs\vfsStream; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -25,6 +26,7 @@ use function assert; use function sprintf; +#[CoversClass(RulefileParser::class)] final class RulefileParserTest extends TestCase { private const string DATA_PATH = 'root'; diff --git a/tests/DetectorTest/Parser/PlatformParserFactoryTest.php b/tests/DetectorTest/Parser/PlatformParserFactoryTest.php index 07c332deab..e92d504ffc 100644 --- a/tests/DetectorTest/Parser/PlatformParserFactoryTest.php +++ b/tests/DetectorTest/Parser/PlatformParserFactoryTest.php @@ -15,12 +15,14 @@ use BrowserDetector\Parser\PlatformParser; use BrowserDetector\Parser\PlatformParserFactory; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use UaParser\PlatformParserInterface; +#[CoversClass(PlatformParserFactory::class)] final class PlatformParserFactoryTest extends TestCase { /** diff --git a/tests/DetectorTest/Parser/PlatformParserTest.php b/tests/DetectorTest/Parser/PlatformParserTest.php index dbc02600dc..89553df187 100644 --- a/tests/DetectorTest/Parser/PlatformParserTest.php +++ b/tests/DetectorTest/Parser/PlatformParserTest.php @@ -15,10 +15,12 @@ use BrowserDetector\Parser\Helper\RulefileParserInterface; use BrowserDetector\Parser\PlatformParser; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; +#[CoversClass(PlatformParser::class)] final class PlatformParserTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/AndroidOsFactoryTest.php b/tests/DetectorTest/Version/AndroidOsFactoryTest.php index 37e305149f..a468ad7d61 100644 --- a/tests/DetectorTest/Version/AndroidOsFactoryTest.php +++ b/tests/DetectorTest/Version/AndroidOsFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\AndroidOs; use BrowserDetector\Version\AndroidOsFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(AndroidOsFactory::class)] final class AndroidOsFactoryTest extends TestCase { private AndroidOsFactory $object; diff --git a/tests/DetectorTest/Version/AndroidOsTest.php b/tests/DetectorTest/Version/AndroidOsTest.php index 4811a86c5d..666349f5b1 100644 --- a/tests/DetectorTest/Version/AndroidOsTest.php +++ b/tests/DetectorTest/Version/AndroidOsTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionFactoryInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -27,6 +28,7 @@ use function assert; +#[CoversClass(AndroidOs::class)] final class AndroidOsTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/ChromeOsFactoryTest.php b/tests/DetectorTest/Version/ChromeOsFactoryTest.php index 297d39d31c..47487fe731 100644 --- a/tests/DetectorTest/Version/ChromeOsFactoryTest.php +++ b/tests/DetectorTest/Version/ChromeOsFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\ChromeOs; use BrowserDetector\Version\ChromeOsFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(ChromeOsFactory::class)] final class ChromeOsFactoryTest extends TestCase { private ChromeOsFactory $object; diff --git a/tests/DetectorTest/Version/ChromeOsTest.php b/tests/DetectorTest/Version/ChromeOsTest.php index bc5d4fa9fa..136fb72e56 100644 --- a/tests/DetectorTest/Version/ChromeOsTest.php +++ b/tests/DetectorTest/Version/ChromeOsTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionFactoryInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -28,6 +29,7 @@ use function assert; +#[CoversClass(ChromeOs::class)] final class ChromeOsTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/CoreMediaFactoryTest.php b/tests/DetectorTest/Version/CoreMediaFactoryTest.php index 1845f8da3f..cc735e8775 100644 --- a/tests/DetectorTest/Version/CoreMediaFactoryTest.php +++ b/tests/DetectorTest/Version/CoreMediaFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\CoreMedia; use BrowserDetector\Version\CoreMediaFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(CoreMediaFactory::class)] final class CoreMediaFactoryTest extends TestCase { private CoreMediaFactory $object; diff --git a/tests/DetectorTest/Version/CoreMediaTest.php b/tests/DetectorTest/Version/CoreMediaTest.php index 50b10354d2..efa36c4309 100644 --- a/tests/DetectorTest/Version/CoreMediaTest.php +++ b/tests/DetectorTest/Version/CoreMediaTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionFactoryInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -28,6 +29,7 @@ use function assert; +#[CoversClass(CoreMedia::class)] final class CoreMediaTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/DebianFactoryTest.php b/tests/DetectorTest/Version/DebianFactoryTest.php index 05faae9f5a..53b3c7cba4 100644 --- a/tests/DetectorTest/Version/DebianFactoryTest.php +++ b/tests/DetectorTest/Version/DebianFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\Debian; use BrowserDetector\Version\DebianFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(DebianFactory::class)] final class DebianFactoryTest extends TestCase { private DebianFactory $object; diff --git a/tests/DetectorTest/Version/DebianTest.php b/tests/DetectorTest/Version/DebianTest.php index b5292bbb0d..c468dac559 100644 --- a/tests/DetectorTest/Version/DebianTest.php +++ b/tests/DetectorTest/Version/DebianTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionFactoryInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -28,6 +29,7 @@ use function assert; +#[CoversClass(Debian::class)] final class DebianTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/ErrorVersionCreatorFactoryTest.php b/tests/DetectorTest/Version/ErrorVersionCreatorFactoryTest.php index 945136541c..0a2651aeff 100644 --- a/tests/DetectorTest/Version/ErrorVersionCreatorFactoryTest.php +++ b/tests/DetectorTest/Version/ErrorVersionCreatorFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\ErrorVersionCreator; use BrowserDetector\Version\ErrorVersionCreatorFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(ErrorVersionCreatorFactory::class)] final class ErrorVersionCreatorFactoryTest extends TestCase { private ErrorVersionCreatorFactory $object; diff --git a/tests/DetectorTest/Version/ErrorVersionCreatorTest.php b/tests/DetectorTest/Version/ErrorVersionCreatorTest.php index 35c4d95d60..a39dcb4da3 100644 --- a/tests/DetectorTest/Version/ErrorVersionCreatorTest.php +++ b/tests/DetectorTest/Version/ErrorVersionCreatorTest.php @@ -17,10 +17,12 @@ use BrowserDetector\Version\NullVersion; use BrowserDetector\Version\VersionInterface; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\TestCase; use UnexpectedValueException; +#[CoversClass(ErrorVersionCreator::class)] final class ErrorVersionCreatorTest extends TestCase { private ErrorVersionCreator $object; diff --git a/tests/DetectorTest/Version/FirefoxOsFactoryTest.php b/tests/DetectorTest/Version/FirefoxOsFactoryTest.php index d5c668e8ff..9e24f42984 100644 --- a/tests/DetectorTest/Version/FirefoxOsFactoryTest.php +++ b/tests/DetectorTest/Version/FirefoxOsFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\FirefoxOs; use BrowserDetector\Version\FirefoxOsFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(FirefoxOsFactory::class)] final class FirefoxOsFactoryTest extends TestCase { private FirefoxOsFactory $object; diff --git a/tests/DetectorTest/Version/FirefoxOsTest.php b/tests/DetectorTest/Version/FirefoxOsTest.php index dc2f098e98..167371273a 100644 --- a/tests/DetectorTest/Version/FirefoxOsTest.php +++ b/tests/DetectorTest/Version/FirefoxOsTest.php @@ -19,12 +19,14 @@ use BrowserDetector\Version\VersionBuilder; use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use UnexpectedValueException; +#[CoversClass(FirefoxOs::class)] final class FirefoxOsTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/FriendicaFactoryTest.php b/tests/DetectorTest/Version/FriendicaFactoryTest.php index 05f56397b9..b1f77fde2a 100644 --- a/tests/DetectorTest/Version/FriendicaFactoryTest.php +++ b/tests/DetectorTest/Version/FriendicaFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\Friendica; use BrowserDetector\Version\FriendicaFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(FriendicaFactory::class)] final class FriendicaFactoryTest extends TestCase { private FriendicaFactory $object; diff --git a/tests/DetectorTest/Version/FriendicaTest.php b/tests/DetectorTest/Version/FriendicaTest.php index 62c0ddf5bd..b3b5b8032a 100644 --- a/tests/DetectorTest/Version/FriendicaTest.php +++ b/tests/DetectorTest/Version/FriendicaTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionFactoryInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -28,6 +29,7 @@ use function assert; +#[CoversClass(Friendica::class)] final class FriendicaTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/GeckoFactoryTest.php b/tests/DetectorTest/Version/GeckoFactoryTest.php index da65ddd59a..fa52d25b70 100644 --- a/tests/DetectorTest/Version/GeckoFactoryTest.php +++ b/tests/DetectorTest/Version/GeckoFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\Gecko; use BrowserDetector\Version\GeckoFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(GeckoFactory::class)] final class GeckoFactoryTest extends TestCase { private GeckoFactory $object; diff --git a/tests/DetectorTest/Version/GeckoTest.php b/tests/DetectorTest/Version/GeckoTest.php index f7b2e15c36..4407693a0c 100644 --- a/tests/DetectorTest/Version/GeckoTest.php +++ b/tests/DetectorTest/Version/GeckoTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionFactoryInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -28,6 +29,7 @@ use function assert; +#[CoversClass(Gecko::class)] final class GeckoTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/GoannaFactoryTest.php b/tests/DetectorTest/Version/GoannaFactoryTest.php index 8601382d1d..a5942c4958 100644 --- a/tests/DetectorTest/Version/GoannaFactoryTest.php +++ b/tests/DetectorTest/Version/GoannaFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\Goanna; use BrowserDetector\Version\GoannaFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(GoannaFactory::class)] final class GoannaFactoryTest extends TestCase { private GoannaFactory $object; diff --git a/tests/DetectorTest/Version/GoannaTest.php b/tests/DetectorTest/Version/GoannaTest.php index ee06a2d78d..86e9a29957 100644 --- a/tests/DetectorTest/Version/GoannaTest.php +++ b/tests/DetectorTest/Version/GoannaTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionFactoryInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -28,6 +29,7 @@ use function assert; +#[CoversClass(Goanna::class)] final class GoannaTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/Helper/SafariTest.php b/tests/DetectorTest/Version/Helper/SafariTest.php index 1b07c652d4..0a95989865 100644 --- a/tests/DetectorTest/Version/Helper/SafariTest.php +++ b/tests/DetectorTest/Version/Helper/SafariTest.php @@ -17,11 +17,13 @@ use BrowserDetector\Version\Helper\Safari; use BrowserDetector\Version\VersionBuilder; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use UnexpectedValueException; +#[CoversClass(Safari::class)] final class SafariTest extends TestCase { private Safari $object; diff --git a/tests/DetectorTest/Version/IosFactoryTest.php b/tests/DetectorTest/Version/IosFactoryTest.php index 153b91fe31..a382d0918d 100644 --- a/tests/DetectorTest/Version/IosFactoryTest.php +++ b/tests/DetectorTest/Version/IosFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\Ios; use BrowserDetector\Version\IosFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(IosFactory::class)] final class IosFactoryTest extends TestCase { private IosFactory $object; diff --git a/tests/DetectorTest/Version/IosTest.php b/tests/DetectorTest/Version/IosTest.php index 3288e75e2c..fc053f26da 100644 --- a/tests/DetectorTest/Version/IosTest.php +++ b/tests/DetectorTest/Version/IosTest.php @@ -23,11 +23,13 @@ use IosBuild\Exception\NotFoundException; use IosBuild\IosBuild; use IosBuild\IosBuildInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use UnexpectedValueException; +#[CoversClass(Ios::class)] final class IosTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/MacosFactoryTest.php b/tests/DetectorTest/Version/MacosFactoryTest.php index 742b755eb2..5c5086e37e 100644 --- a/tests/DetectorTest/Version/MacosFactoryTest.php +++ b/tests/DetectorTest/Version/MacosFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\Macos; use BrowserDetector\Version\MacosFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(MacosFactory::class)] final class MacosFactoryTest extends TestCase { private MacosFactory $object; diff --git a/tests/DetectorTest/Version/MacosTest.php b/tests/DetectorTest/Version/MacosTest.php index de1b29d618..aadd31acfd 100644 --- a/tests/DetectorTest/Version/MacosTest.php +++ b/tests/DetectorTest/Version/MacosTest.php @@ -23,11 +23,13 @@ use MacosBuild\Exception\NotFoundException; use MacosBuild\MacosBuild; use MacosBuild\MacosBuildInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use UnexpectedValueException; +#[CoversClass(Macos::class)] final class MacosTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/MaxthonFactoryTest.php b/tests/DetectorTest/Version/MaxthonFactoryTest.php index 9faf2c679b..c918d2333a 100644 --- a/tests/DetectorTest/Version/MaxthonFactoryTest.php +++ b/tests/DetectorTest/Version/MaxthonFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\Maxthon; use BrowserDetector\Version\MaxthonFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(MaxthonFactory::class)] final class MaxthonFactoryTest extends TestCase { private MaxthonFactory $object; diff --git a/tests/DetectorTest/Version/MaxthonTest.php b/tests/DetectorTest/Version/MaxthonTest.php index 05b2d6f0b1..f5757fde94 100644 --- a/tests/DetectorTest/Version/MaxthonTest.php +++ b/tests/DetectorTest/Version/MaxthonTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionFactoryInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -28,6 +29,7 @@ use function assert; +#[CoversClass(Maxthon::class)] final class MaxthonTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/MicrosoftInternetExplorerFactoryTest.php b/tests/DetectorTest/Version/MicrosoftInternetExplorerFactoryTest.php index 96beca0170..67dc65ee17 100644 --- a/tests/DetectorTest/Version/MicrosoftInternetExplorerFactoryTest.php +++ b/tests/DetectorTest/Version/MicrosoftInternetExplorerFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\MicrosoftInternetExplorer; use BrowserDetector\Version\MicrosoftInternetExplorerFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(MicrosoftInternetExplorerFactory::class)] final class MicrosoftInternetExplorerFactoryTest extends TestCase { private MicrosoftInternetExplorerFactory $object; diff --git a/tests/DetectorTest/Version/MicrosoftInternetExplorerTest.php b/tests/DetectorTest/Version/MicrosoftInternetExplorerTest.php index bee0377ab8..e109eabb48 100644 --- a/tests/DetectorTest/Version/MicrosoftInternetExplorerTest.php +++ b/tests/DetectorTest/Version/MicrosoftInternetExplorerTest.php @@ -21,12 +21,14 @@ use BrowserDetector\Version\VersionBuilder; use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use UnexpectedValueException; +#[CoversClass(MicrosoftInternetExplorer::class)] final class MicrosoftInternetExplorerTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/ObigoQFactoryTest.php b/tests/DetectorTest/Version/ObigoQFactoryTest.php index 0534683ea9..9e7d953dc2 100644 --- a/tests/DetectorTest/Version/ObigoQFactoryTest.php +++ b/tests/DetectorTest/Version/ObigoQFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\ObigoQ; use BrowserDetector\Version\ObigoQFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(ObigoQFactory::class)] final class ObigoQFactoryTest extends TestCase { private ObigoQFactory $object; diff --git a/tests/DetectorTest/Version/ObigoQTest.php b/tests/DetectorTest/Version/ObigoQTest.php index b83ee35ff3..da71285626 100644 --- a/tests/DetectorTest/Version/ObigoQTest.php +++ b/tests/DetectorTest/Version/ObigoQTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionFactoryInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -28,6 +29,7 @@ use function assert; +#[CoversClass(ObigoQ::class)] final class ObigoQTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/PuffinFactoryTest.php b/tests/DetectorTest/Version/PuffinFactoryTest.php index 8b1f47daba..c67842c70a 100644 --- a/tests/DetectorTest/Version/PuffinFactoryTest.php +++ b/tests/DetectorTest/Version/PuffinFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\Puffin; use BrowserDetector\Version\PuffinFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(PuffinFactory::class)] final class PuffinFactoryTest extends TestCase { private PuffinFactory $object; diff --git a/tests/DetectorTest/Version/PuffinTest.php b/tests/DetectorTest/Version/PuffinTest.php index 32ca13084e..41b5bd859c 100644 --- a/tests/DetectorTest/Version/PuffinTest.php +++ b/tests/DetectorTest/Version/PuffinTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionFactoryInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -28,6 +29,7 @@ use function assert; +#[CoversClass(Puffin::class)] final class PuffinTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/RaspbianFactoryTest.php b/tests/DetectorTest/Version/RaspbianFactoryTest.php index c32dd5caf5..ac741e93a6 100644 --- a/tests/DetectorTest/Version/RaspbianFactoryTest.php +++ b/tests/DetectorTest/Version/RaspbianFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\Raspbian; use BrowserDetector\Version\RaspbianFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(RaspbianFactory::class)] final class RaspbianFactoryTest extends TestCase { private RaspbianFactory $object; diff --git a/tests/DetectorTest/Version/RaspbianTest.php b/tests/DetectorTest/Version/RaspbianTest.php index 17077fb1f2..a5b9e3c691 100644 --- a/tests/DetectorTest/Version/RaspbianTest.php +++ b/tests/DetectorTest/Version/RaspbianTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionFactoryInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -28,6 +29,7 @@ use function assert; +#[CoversClass(Raspbian::class)] final class RaspbianTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/RimOsFactoryTest.php b/tests/DetectorTest/Version/RimOsFactoryTest.php index 0429a8d4b9..a36df3ad1e 100644 --- a/tests/DetectorTest/Version/RimOsFactoryTest.php +++ b/tests/DetectorTest/Version/RimOsFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\RimOs; use BrowserDetector\Version\RimOsFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(RimOsFactory::class)] final class RimOsFactoryTest extends TestCase { private RimOsFactory $object; diff --git a/tests/DetectorTest/Version/RimOsTest.php b/tests/DetectorTest/Version/RimOsTest.php index 186bf4cbda..d1224ba36a 100644 --- a/tests/DetectorTest/Version/RimOsTest.php +++ b/tests/DetectorTest/Version/RimOsTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionFactoryInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -28,6 +29,7 @@ use function assert; +#[CoversClass(RimOs::class)] final class RimOsTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/SafariFactoryTest.php b/tests/DetectorTest/Version/SafariFactoryTest.php index 47fd83db78..1c96bcc705 100644 --- a/tests/DetectorTest/Version/SafariFactoryTest.php +++ b/tests/DetectorTest/Version/SafariFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\Safari; use BrowserDetector\Version\SafariFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(SafariFactory::class)] final class SafariFactoryTest extends TestCase { private SafariFactory $object; diff --git a/tests/DetectorTest/Version/SafariTest.php b/tests/DetectorTest/Version/SafariTest.php index b4ff518102..1acddca096 100644 --- a/tests/DetectorTest/Version/SafariTest.php +++ b/tests/DetectorTest/Version/SafariTest.php @@ -23,6 +23,7 @@ use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionFactoryInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -30,6 +31,7 @@ use function assert; +#[CoversClass(Safari::class)] final class SafariTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/ScreamingFrogFactoryTest.php b/tests/DetectorTest/Version/ScreamingFrogFactoryTest.php index cd93c4a6dd..c60134ff63 100644 --- a/tests/DetectorTest/Version/ScreamingFrogFactoryTest.php +++ b/tests/DetectorTest/Version/ScreamingFrogFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\ScreamingFrog; use BrowserDetector\Version\ScreamingFrogFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(ScreamingFrogFactory::class)] final class ScreamingFrogFactoryTest extends TestCase { private ScreamingFrogFactory $object; diff --git a/tests/DetectorTest/Version/ScreamingFrogTest.php b/tests/DetectorTest/Version/ScreamingFrogTest.php index 8a619fb9be..660eac5c38 100644 --- a/tests/DetectorTest/Version/ScreamingFrogTest.php +++ b/tests/DetectorTest/Version/ScreamingFrogTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionFactoryInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -28,6 +29,7 @@ use function assert; +#[CoversClass(ScreamingFrog::class)] final class ScreamingFrogTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/TestErrorFactoryTest.php b/tests/DetectorTest/Version/TestErrorFactoryTest.php index d867ea2d64..3066290479 100644 --- a/tests/DetectorTest/Version/TestErrorFactoryTest.php +++ b/tests/DetectorTest/Version/TestErrorFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\TestUnexpectedError; use BrowserDetector\Version\TestUnexpectedFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(TestUnexpectedFactory::class)] final class TestErrorFactoryTest extends TestCase { private TestUnexpectedFactory $object; diff --git a/tests/DetectorTest/Version/TestFactoryTest.php b/tests/DetectorTest/Version/TestFactoryTest.php index 6cb36bfa4a..1122efe4bd 100644 --- a/tests/DetectorTest/Version/TestFactoryTest.php +++ b/tests/DetectorTest/Version/TestFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\Test; use BrowserDetector\Version\TestFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(TestFactory::class)] final class TestFactoryTest extends TestCase { private TestFactory $object; diff --git a/tests/DetectorTest/Version/TestTest.php b/tests/DetectorTest/Version/TestTest.php index 41f5a1db1a..78711678ac 100644 --- a/tests/DetectorTest/Version/TestTest.php +++ b/tests/DetectorTest/Version/TestTest.php @@ -16,11 +16,13 @@ use BrowserDetector\Version\Exception\NotNumericException; use BrowserDetector\Version\Test; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use UnexpectedValueException; +#[CoversClass(Test::class)] final class TestTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/TestErrorTest.php b/tests/DetectorTest/Version/TestUnexpectedErrorTest.php similarity index 86% rename from tests/DetectorTest/Version/TestErrorTest.php rename to tests/DetectorTest/Version/TestUnexpectedErrorTest.php index 248674bd13..9442a0f790 100644 --- a/tests/DetectorTest/Version/TestErrorTest.php +++ b/tests/DetectorTest/Version/TestUnexpectedErrorTest.php @@ -14,10 +14,12 @@ namespace BrowserDetectorTest\Version; use BrowserDetector\Version\TestUnexpectedError; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use UnexpectedValueException; -final class TestErrorTest extends TestCase +#[CoversClass(TestUnexpectedError::class)] +final class TestUnexpectedErrorTest extends TestCase { /** @throws UnexpectedValueException */ public function testDetectVersion(): void diff --git a/tests/DetectorTest/Version/TridentFactoryTest.php b/tests/DetectorTest/Version/TridentFactoryTest.php index 2a849c1862..7474e77155 100644 --- a/tests/DetectorTest/Version/TridentFactoryTest.php +++ b/tests/DetectorTest/Version/TridentFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\Trident; use BrowserDetector\Version\TridentFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(TridentFactory::class)] final class TridentFactoryTest extends TestCase { private TridentFactory $object; diff --git a/tests/DetectorTest/Version/TridentTest.php b/tests/DetectorTest/Version/TridentTest.php index b264601c94..b731d0502a 100644 --- a/tests/DetectorTest/Version/TridentTest.php +++ b/tests/DetectorTest/Version/TridentTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Version\VersionBuilderInterface; use BrowserDetector\Version\VersionFactoryInterface; use BrowserDetector\Version\VersionInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -28,6 +29,7 @@ use function assert; +#[CoversClass(Trident::class)] final class TridentTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/WindowsMobileOsFactoryTest.php b/tests/DetectorTest/Version/WindowsMobileOsFactoryTest.php index ad13d3b479..bac141ac00 100644 --- a/tests/DetectorTest/Version/WindowsMobileOsFactoryTest.php +++ b/tests/DetectorTest/Version/WindowsMobileOsFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\WindowsMobileOs; use BrowserDetector\Version\WindowsMobileOsFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(WindowsMobileOsFactory::class)] final class WindowsMobileOsFactoryTest extends TestCase { private WindowsMobileOsFactory $object; diff --git a/tests/DetectorTest/Version/WindowsMobileOsTest.php b/tests/DetectorTest/Version/WindowsMobileOsTest.php index 15b0745b38..23d52d8501 100644 --- a/tests/DetectorTest/Version/WindowsMobileOsTest.php +++ b/tests/DetectorTest/Version/WindowsMobileOsTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Version\VersionFactoryInterface; use BrowserDetector\Version\VersionInterface; use BrowserDetector\Version\WindowsMobileOs; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -28,6 +29,7 @@ use function assert; +#[CoversClass(WindowsMobileOs::class)] final class WindowsMobileOsTest extends TestCase { /** diff --git a/tests/DetectorTest/Version/WindowsPhoneOsFactoryTest.php b/tests/DetectorTest/Version/WindowsPhoneOsFactoryTest.php index fbd58ab0bf..c6207e0531 100644 --- a/tests/DetectorTest/Version/WindowsPhoneOsFactoryTest.php +++ b/tests/DetectorTest/Version/WindowsPhoneOsFactoryTest.php @@ -16,6 +16,7 @@ use BrowserDetector\Version\WindowsPhoneOs; use BrowserDetector\Version\WindowsPhoneOsFactory; use Override; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ use function assert; use function sprintf; +#[CoversClass(WindowsPhoneOsFactory::class)] final class WindowsPhoneOsFactoryTest extends TestCase { private WindowsPhoneOsFactory $object; diff --git a/tests/DetectorTest/Version/WindowsPhoneOsTest.php b/tests/DetectorTest/Version/WindowsPhoneOsTest.php index 17aeb72dc9..01b3137fe9 100644 --- a/tests/DetectorTest/Version/WindowsPhoneOsTest.php +++ b/tests/DetectorTest/Version/WindowsPhoneOsTest.php @@ -20,6 +20,7 @@ use BrowserDetector\Version\VersionFactoryInterface; use BrowserDetector\Version\VersionInterface; use BrowserDetector\Version\WindowsPhoneOs; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Exception; use PHPUnit\Framework\ExpectationFailedException; @@ -28,6 +29,7 @@ use function assert; +#[CoversClass(WindowsPhoneOs::class)] final class WindowsPhoneOsTest extends TestCase { /** diff --git a/tests/UserAgentsTest/DetectorTest.php b/tests/UserAgentsTest/DetectorTest.php index 78cf289a88..400b02ce7f 100644 --- a/tests/UserAgentsTest/DetectorTest.php +++ b/tests/UserAgentsTest/DetectorTest.php @@ -50,6 +50,7 @@ use function json_encode; use function sprintf; use function str_replace; +use function var_export; use const JSON_THROW_ON_ERROR; use const JSON_UNESCAPED_SLASHES; @@ -57,6 +58,7 @@ use const PHP_EOL; /** @infection-ignore-all */ +#[CoversNothing] final class DetectorTest extends TestCase { private static DetectorFactory $factory; @@ -300,53 +302,23 @@ public function testGetBrowser(array $headers, array $expectedResult): void $expectedResult['headers'], $result['headers'], sprintf( - 'detection header result mismatch for headers %s', + "detection header result mismatch for headers %s\ntest headers:%s\nexpected result: %s\nactual result: %s", $encodedHeaders, + var_export($headers, true), + var_export($expectedResult['headers'], true), + var_export($result['headers'], true), ), ); -// self::assertEquals( -// $expectedResult['os'], -// $result['os'], -// sprintf( -// 'detection os result mismatch for headers %s', -// $encodedHeaders, -// ), -// ); -// -// self::assertEquals( -// $expectedResult['browser'], -// $result['client'], -// sprintf( -// 'detection client result mismatch for headers %s', -// $encodedHeaders, -// ), -// ); -// -// self::assertEquals( -// $expectedResult['device'], -// $result['device'], -// sprintf( -// 'detection device result mismatch for headers %s', -// $encodedHeaders, -// ), -// ); -// -// self::assertEquals( -// $expectedResult['engine'], -// $result['engine'], -// sprintf( -// 'detection engine result mismatch for headers %s', -// $encodedHeaders, -// ), -// ); - self::assertEquals( $expectedResult, $result, sprintf( - 'detection result mismatch for headers %s', + "detection result mismatch for headers %s\ntest headers:%s\nexpected result: %s\nactual result: %s", $encodedHeaders, + var_export($headers, true), + var_export($expectedResult, true), + var_export($result, true), ), ); }