Skip to content

Commit

Permalink
add Cover notation
Browse files Browse the repository at this point in the history
  • Loading branch information
mimmi20 committed Jan 18, 2025
1 parent 9bc9de7 commit 96d56f0
Show file tree
Hide file tree
Showing 114 changed files with 260 additions and 550 deletions.
1 change: 1 addition & 0 deletions phpunit-integration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
enforceTimeLimit="false"
executionOrder="default"
resolveDependencies="true"
requireCoverageMetadata="false"
colors="true"
cacheDirectory="./.reports/.coverage-cache"
columns="123"
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
enforceTimeLimit="false"
executionOrder="default"
resolveDependencies="true"
requireCoverageMetadata="true"
colors="true"
cacheDirectory="./.reports/.coverage-cache"
columns="119"
Expand Down
8 changes: 5 additions & 3 deletions src/Detector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -60,8 +60,6 @@
use function str_contains;
use function trim;

use const CASE_LOWER;

final readonly class Detector implements DetectorInterface
{
/**
Expand Down Expand Up @@ -557,6 +555,10 @@ private function getPlatformData(array $filteredHeaders, string | null $platform
}
}

if (!$platformVersion instanceof VersionInterface) {

Check warning on line 558 in src/Detector.php

View workflow job for this annotation

GitHub Actions / UnitTests / Code Coverage with PHPUnit (ubuntu-24.04, 8.3, lowest)

Escaped Mutant for Mutator "InstanceOf_": @@ @@ $this->logger->info($e); } } - if (!$platformVersion instanceof VersionInterface) { + if (!true) { $platformVersion = null; } return new Os(name: null, marketingName: null, manufacturer: new Company(type: 'unknown', name: null, brandname: null), version: $platformVersion ?? new NullVersion());

Check warning on line 558 in src/Detector.php

View workflow job for this annotation

GitHub Actions / UnitTests / Code Coverage with PHPUnit (ubuntu-24.04, 8.3, lowest)

Escaped Mutant for Mutator "InstanceOf_": @@ @@ $this->logger->info($e); } } - if (!$platformVersion instanceof VersionInterface) { + if (!true) { $platformVersion = null; } return new Os(name: null, marketingName: null, manufacturer: new Company(type: 'unknown', name: null, brandname: null), version: $platformVersion ?? new NullVersion());
$platformVersion = null;
}

return new Os(
name: null,
marketingName: null,
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Bits/BrowserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Bits/OsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Cache/CacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -23,6 +24,7 @@
use function assert;
use function serialize;

#[CoversClass(Cache::class)]
final class CacheTest extends TestCase
{
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Detector10Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -39,6 +40,7 @@
use UaResult\Os\Os;
use UnexpectedValueException;

#[CoversClass(Detector::class)]
final class Detector10Test extends TestCase
{
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Detector1Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -29,6 +30,7 @@
use UaRequest\RequestBuilderInterface;
use UnexpectedValueException;

#[CoversClass(Detector::class)]
final class Detector1Test extends TestCase
{
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Detector2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -44,6 +45,7 @@
use function assert;
use function sprintf;

#[CoversClass(Detector::class)]
final class Detector2Test extends TestCase
{
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Detector3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -30,6 +31,7 @@
use UaRequest\RequestBuilderInterface;
use UnexpectedValueException;

#[CoversClass(Detector::class)]
final class Detector3Test extends TestCase
{
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Detector4Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -44,6 +45,7 @@
use UaResult\Os\Os;
use UnexpectedValueException;

#[CoversClass(Detector::class)]
final class Detector4Test extends TestCase
{
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Detector5Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -41,6 +42,7 @@
use UaResult\Os\Os;
use UnexpectedValueException;

#[CoversClass(Detector::class)]
final class Detector5Test extends TestCase
{
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Detector6Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -37,6 +38,7 @@
use UaResult\Os\Os;
use UnexpectedValueException;

#[CoversClass(Detector::class)]
final class Detector6Test extends TestCase
{
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Detector7Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -40,6 +41,7 @@
use UaResult\Os\Os;
use UnexpectedValueException;

#[CoversClass(Detector::class)]
final class Detector7Test extends TestCase
{
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Detector8Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -40,6 +41,7 @@
use UaResult\Os\Os;
use UnexpectedValueException;

#[CoversClass(Detector::class)]
final class Detector8Test extends TestCase
{
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Detector9Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -43,6 +44,7 @@
use UaResult\Os\Os;
use UnexpectedValueException;

#[CoversClass(Detector::class)]
final class Detector9Test extends TestCase
{
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/DetectorFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -24,6 +25,7 @@

use function assert;

#[CoversClass(DetectorFactory::class)]
final class DetectorFactoryTest extends TestCase
{
/**
Expand Down
3 changes: 3 additions & 0 deletions tests/DetectorTest/DetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -24,6 +26,7 @@
use RuntimeException;
use UnexpectedValueException;

#[CoversClass(Detector::class)]
final class DetectorTest extends TestCase
{
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Helper/DesktopTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Helper/MobileDeviceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Helper/TvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Loader/BrowserLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -31,6 +32,7 @@
use UaLoader\Exception\NotFoundException;
use UnexpectedValueException;

#[CoversClass(BrowserLoader::class)]
final class BrowserLoaderTest extends TestCase
{
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Loader/CompanyLoaderFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/**
Expand Down
5 changes: 2 additions & 3 deletions tests/DetectorTest/Loader/CompanyLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,9 +27,7 @@
use RuntimeException;
use UaLoader\Exception\NotFoundException;

/**
* Test class for \BrowserDetector\Loader\CompanyLoader
*/
#[CoversClass(CompanyLoader::class)]
final class CompanyLoaderTest extends TestCase
{
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/DetectorTest/Loader/DeviceLoaderFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@

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;
use Psr\Log\LoggerInterface;
use RuntimeException;
use UaLoader\DeviceLoaderInterface;

#[CoversClass(DeviceLoaderFactory::class)]
final class DeviceLoaderFactoryTest extends TestCase
{
/**
Expand Down
Loading

0 comments on commit 96d56f0

Please sign in to comment.