Package: php-matomo-device-detector Version: 6.3.2-1.1 Severity: important Tags: patch Control: block 1099656 by -1 X-Debbugs-Cc: Debian PHP PEAR Maintainers <pkg-php-p...@lists.alioth.debian.org>
Hi, Please consider applying the attached patch in order to allow PHPUnit 12, currently in experimental, to be uploaded to unstable before the freeze. The syntax change is already compatible with PHPUnit 11 currently in unstable and testing. I also submitted this patch as an MR in salsa. https://salsa.debian.org/matomo-team/matomo-device-detector/-/merge_requests/1 Thanks in advance. Regards, taffit
From: =?utf-8?q?David_Pr=C3=A9vot?= <taf...@debian.org> Date: Sun, 9 Mar 2025 17:58:44 +0100 Subject: Modernize PHPUnit syntax --- Tests/DeviceDetectorTest.php | 25 +++++++------------------ Tests/Parser/Client/BrowserTest.php | 9 +++------ Tests/Parser/Client/FeedReaderTest.php | 5 ++--- Tests/Parser/Client/LibraryTest.php | 5 ++--- Tests/Parser/Client/MediaPlayerTest.php | 5 ++--- Tests/Parser/Client/MobileAppTest.php | 5 ++--- Tests/Parser/Client/PIMTest.php | 5 ++--- Tests/Parser/Device/CameraTest.php | 5 ++--- Tests/Parser/Device/CarBrowserTest.php | 5 ++--- Tests/Parser/Device/ConsoleTest.php | 5 ++--- Tests/Parser/Device/NotebookTest.php | 5 ++--- Tests/Parser/OperatingSystemTest.php | 17 +++++------------ Tests/Parser/VendorFragmentTest.php | 5 ++--- 13 files changed, 35 insertions(+), 66 deletions(-) diff --git a/Tests/DeviceDetectorTest.php b/Tests/DeviceDetectorTest.php index de0ffd4..cd72ba5 100644 --- a/Tests/DeviceDetectorTest.php +++ b/Tests/DeviceDetectorTest.php @@ -23,6 +23,7 @@ use DeviceDetector\Parser\Device\AbstractDeviceParser; use DeviceDetector\Parser\Device\Mobile; use DeviceDetector\Yaml\Symfony; use Doctrine\Common\Cache\MemcachedCache; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class DeviceDetectorTest extends TestCase @@ -216,9 +217,7 @@ class DeviceDetectorTest extends TestCase $this->assertTrue($dd->isParsed()); } - /** - * @dataProvider getFixtures - */ + #[DataProvider('getFixtures')] public function testParse(array $fixtureData): void { $ua = $fixtureData['user_agent']; @@ -268,9 +267,7 @@ class DeviceDetectorTest extends TestCase return $fixtures; } - /** - * @dataProvider getFixturesClient - */ + #[DataProvider('getFixturesClient')] public function testParseClient(array $fixtureData): void { $ua = $fixtureData['user_agent']; @@ -317,9 +314,7 @@ class DeviceDetectorTest extends TestCase return $fixtures; } - /** - * @dataProvider getFixturesDevice - */ + #[DataProvider('getFixturesDevice')] public function testParseDevice(array $fixtureData): void { $ua = $fixtureData['user_agent']; @@ -390,9 +385,7 @@ class DeviceDetectorTest extends TestCase } } - /** - * @dataProvider getVersionTruncationFixtures - */ + #[DataProvider('getVersionTruncationFixtures')] public function testVersionTruncation(string $useragent, int $truncationType, string $osVersion, string $clientVersion): void { AbstractParser::setVersionTruncation($truncationType); @@ -479,9 +472,7 @@ class DeviceDetectorTest extends TestCase AbstractParser::setVersionTruncation(AbstractParser::VERSION_TRUNCATION_NONE); } - /** - * @dataProvider getBotFixtures - */ + #[DataProvider('getBotFixtures')] public function testParseBots(array $fixtureData): void { $ua = $fixtureData['user_agent']; @@ -635,9 +626,7 @@ class DeviceDetectorTest extends TestCase return \Spyc::YAMLLoad($fixturePath); } - /** - * @dataProvider getTypeMethodFixtures - */ + #[DataProvider('getTypeMethodFixtures')] public function testTypeMethods(string $user_agent, array $check): void { try { diff --git a/Tests/Parser/Client/BrowserTest.php b/Tests/Parser/Client/BrowserTest.php index 1048455..ee140d8 100644 --- a/Tests/Parser/Client/BrowserTest.php +++ b/Tests/Parser/Client/BrowserTest.php @@ -16,6 +16,7 @@ use DeviceDetector\ClientHints; use DeviceDetector\Parser\Client\Browser; use DeviceDetector\Parser\Client\Browser\Engine; use DeviceDetector\Parser\Client\Hints\BrowserHints; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Spyc; @@ -23,9 +24,7 @@ class BrowserTest extends TestCase { protected static $browsersTested = []; - /** - * @dataProvider getFixtures - */ + #[DataProvider('getFixtures')] public function testParse(string $user_agent, array $client, ?array $headers = null): void { $browserParser = new Browser(); @@ -122,9 +121,7 @@ class BrowserTest extends TestCase return $fixtures; } - /** - * @dataProvider getFixturesBrowserHints - */ + #[DataProvider('getFixturesBrowserHints')] public function testBrowserHintsForAvailableBrowsers(string $name): void { $browserShort = Browser::getBrowserShortName($name); diff --git a/Tests/Parser/Client/FeedReaderTest.php b/Tests/Parser/Client/FeedReaderTest.php index 4939d76..4d6107c 100644 --- a/Tests/Parser/Client/FeedReaderTest.php +++ b/Tests/Parser/Client/FeedReaderTest.php @@ -13,14 +13,13 @@ declare(strict_types=1); namespace DeviceDetector\Tests\Parser\Client; use DeviceDetector\Parser\Client\FeedReader; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Spyc; class FeedReaderTest extends TestCase { - /** - * @dataProvider getFixtures - */ + #[DataProvider('getFixtures')] public function testParse(string $user_agent, array $client): void { $feedReaderParser = new FeedReader(); diff --git a/Tests/Parser/Client/LibraryTest.php b/Tests/Parser/Client/LibraryTest.php index 5465078..54ead37 100644 --- a/Tests/Parser/Client/LibraryTest.php +++ b/Tests/Parser/Client/LibraryTest.php @@ -13,14 +13,13 @@ declare(strict_types=1); namespace DeviceDetector\Tests\Parser\Client; use DeviceDetector\Parser\Client\Library; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Spyc; class LibraryTest extends TestCase { - /** - * @dataProvider getFixtures - */ + #[DataProvider('getFixtures')] public function testParse(string $user_agent, array $client): void { $libraryParser = new Library(); diff --git a/Tests/Parser/Client/MediaPlayerTest.php b/Tests/Parser/Client/MediaPlayerTest.php index f5b736e..d4211b7 100644 --- a/Tests/Parser/Client/MediaPlayerTest.php +++ b/Tests/Parser/Client/MediaPlayerTest.php @@ -13,14 +13,13 @@ declare(strict_types=1); namespace DeviceDetector\Tests\Parser\Client; use DeviceDetector\Parser\Client\MediaPlayer; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Spyc; class MediaPlayerTest extends TestCase { - /** - * @dataProvider getFixtures - */ + #[DataProvider('getFixtures')] public function testParse(string $user_agent, array $client): void { $mediaPlayerParser = new MediaPlayer(); diff --git a/Tests/Parser/Client/MobileAppTest.php b/Tests/Parser/Client/MobileAppTest.php index c38317b..fa52d50 100644 --- a/Tests/Parser/Client/MobileAppTest.php +++ b/Tests/Parser/Client/MobileAppTest.php @@ -13,14 +13,13 @@ declare(strict_types=1); namespace DeviceDetector\Tests\Parser\Client; use DeviceDetector\Parser\Client\MobileApp; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Spyc; class MobileAppTest extends TestCase { - /** - * @dataProvider getFixtures - */ + #[DataProvider('getFixtures')] public function testParse(string $user_agent, array $client): void { $mobileAppParser = new MobileApp(); diff --git a/Tests/Parser/Client/PIMTest.php b/Tests/Parser/Client/PIMTest.php index 5dd68aa..c7a8550 100644 --- a/Tests/Parser/Client/PIMTest.php +++ b/Tests/Parser/Client/PIMTest.php @@ -13,14 +13,13 @@ declare(strict_types=1); namespace DeviceDetector\Tests\Parser\Client; use DeviceDetector\Parser\Client\PIM; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Spyc; class PIMTest extends TestCase { - /** - * @dataProvider getFixtures - */ + #[DataProvider('getFixtures')] public function testParse(string $user_agent, array $client): void { $PIMParser = new PIM(); diff --git a/Tests/Parser/Device/CameraTest.php b/Tests/Parser/Device/CameraTest.php index 8285de4..19e3b43 100644 --- a/Tests/Parser/Device/CameraTest.php +++ b/Tests/Parser/Device/CameraTest.php @@ -13,14 +13,13 @@ declare(strict_types=1); namespace DeviceDetector\Tests\Parser\Device; use DeviceDetector\Parser\Device\Camera; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Spyc; class CameraTest extends TestCase { - /** - * @dataProvider getFixtures - */ + #[DataProvider('getFixtures')] public function testParse(string $user_agent, array $device): void { $consoleParser = new Camera(); diff --git a/Tests/Parser/Device/CarBrowserTest.php b/Tests/Parser/Device/CarBrowserTest.php index 606a329..da47410 100644 --- a/Tests/Parser/Device/CarBrowserTest.php +++ b/Tests/Parser/Device/CarBrowserTest.php @@ -13,14 +13,13 @@ declare(strict_types=1); namespace DeviceDetector\Tests\Parser\Device; use DeviceDetector\Parser\Device\CarBrowser; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Spyc; class CarBrowserTest extends TestCase { - /** - * @dataProvider getFixtures - */ + #[DataProvider('getFixtures')] public function testParse(string $user_agent, array $device): void { $consoleParser = new CarBrowser(); diff --git a/Tests/Parser/Device/ConsoleTest.php b/Tests/Parser/Device/ConsoleTest.php index 52ff1d6..7b7d246 100644 --- a/Tests/Parser/Device/ConsoleTest.php +++ b/Tests/Parser/Device/ConsoleTest.php @@ -13,14 +13,13 @@ declare(strict_types=1); namespace DeviceDetector\Tests\Parser\Device; use DeviceDetector\Parser\Device\Console; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Spyc; class ConsoleTest extends TestCase { - /** - * @dataProvider getFixtures - */ + #[DataProvider('getFixtures')] public function testParse(string $user_agent, array $device): void { $consoleParser = new Console(); diff --git a/Tests/Parser/Device/NotebookTest.php b/Tests/Parser/Device/NotebookTest.php index 26db01a..450c57e 100644 --- a/Tests/Parser/Device/NotebookTest.php +++ b/Tests/Parser/Device/NotebookTest.php @@ -13,14 +13,13 @@ declare(strict_types=1); namespace DeviceDetector\Tests\Parser\Device; use DeviceDetector\Parser\Device\Notebook; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Spyc; class NotebookTest extends TestCase { - /** - * @dataProvider getFixtures - */ + #[DataProvider('getFixtures')] public function testParse(string $user_agent, array $device): void { $notebookParser = new Notebook(); diff --git a/Tests/Parser/OperatingSystemTest.php b/Tests/Parser/OperatingSystemTest.php index b71fb57..c4c6e31 100644 --- a/Tests/Parser/OperatingSystemTest.php +++ b/Tests/Parser/OperatingSystemTest.php @@ -14,6 +14,7 @@ namespace DeviceDetector\Tests\Parser; use DeviceDetector\ClientHints; use DeviceDetector\Parser\OperatingSystem; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Spyc; @@ -21,9 +22,7 @@ class OperatingSystemTest extends TestCase { protected static $osTested = []; - /** - * @dataProvider getFixtures - */ + #[DataProvider('getFixtures')] public function testParse(string $user_agent, array $os, ?array $headers = null): void { $osParser = new OperatingSystem(); @@ -44,9 +43,7 @@ class OperatingSystemTest extends TestCase return $fixtureData; } - /** - * @dataProvider getAllOs - */ + #[DataProvider('getAllOs')] public function testOSInGroup(string $os): void { $familyOs = \call_user_func_array('array_merge', \array_values(OperatingSystem::getAvailableOperatingSystemFamilies())); @@ -63,9 +60,7 @@ class OperatingSystemTest extends TestCase return $allOs; } - /** - * @dataProvider getAllFamilyOs - */ + #[DataProvider('getAllFamilyOs')] public function testFamilyOSExists(string $os): void { $allOs = \array_keys(OperatingSystem::getAvailableOperatingSystems()); @@ -87,9 +82,7 @@ class OperatingSystemTest extends TestCase $this->assertGreaterThan(70, OperatingSystem::getAvailableOperatingSystems()); } - /** - * @dataProvider getNameFromIds - */ + #[DataProvider('getNameFromIds')] public function testGetNameFromId(string $os, string $version, ?string $expected): void { $this->assertEquals($expected, OperatingSystem::getNameFromId($os, $version)); diff --git a/Tests/Parser/VendorFragmentTest.php b/Tests/Parser/VendorFragmentTest.php index af7f294..d1f5813 100644 --- a/Tests/Parser/VendorFragmentTest.php +++ b/Tests/Parser/VendorFragmentTest.php @@ -13,6 +13,7 @@ declare(strict_types=1); namespace DeviceDetector\Tests\Parser; use DeviceDetector\Parser\VendorFragment; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Spyc; @@ -20,9 +21,7 @@ class VendorFragmentTest extends TestCase { protected static $regexesTested = []; - /** - * @dataProvider getFixtures - */ + #[DataProvider('getFixtures')] public function testParse(string $useragent, string $vendor): void { $vfParser = new VendorFragment();
signature.asc
Description: PGP signature