diff --git a/composer.json b/composer.json
index 50bfc09d..7d42e42a 100644
--- a/composer.json
+++ b/composer.json
@@ -31,7 +31,7 @@
"laminas/laminas-diagnostics": "^1.25",
"matthiasnoback/symfony-dependency-injection-test": "^5.1",
"phpstan/phpstan": "^1.4",
- "phpunit/phpunit": "^9.6.16",
+ "phpunit/phpunit": "^10.5.10",
"symfony/http-client": "^6.4|^7.0",
"symfony/mailer": "^6.4|^7.0",
"symfony/messenger": "^6.4|^7.0",
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 05f150b0..fb2973cd 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,5 +1,4 @@
-
-
-
-
-
-
-
-
+ cacheDirectory=".phpunit.cache">
+
+
+
+
+
+
+
+
+
+
+
+ tests
+
+
-
-
- tests
-
-
+
-
-
- src
-
-
+
-
-
-
diff --git a/tests/Check/CheckContextTest.php b/tests/Check/CheckContextTest.php
index 75eda658..74a53489 100644
--- a/tests/Check/CheckContextTest.php
+++ b/tests/Check/CheckContextTest.php
@@ -15,6 +15,7 @@
use Liip\Monitor\Check\CheckContext;
use Liip\Monitor\Result;
use Liip\Monitor\Tests\CheckTests;
+use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
/**
@@ -32,36 +33,28 @@ public static function checkResultProvider(): iterable
];
}
- /**
- * @test
- */
+ #[Test]
public function id_can_be_overridden(): void
{
$this->assertSame('7e4c0e91', (new CheckContext(new CallbackCheck('name', fn() => null)))->id());
$this->assertSame('override', (new CheckContext(new CallbackCheck('name', fn() => null), id: 'override'))->id());
}
- /**
- * @test
- */
+ #[Test]
public function wrapped_label_is_used_to_calculate_id(): void
{
$this->assertSame('7e4c0e91', (new CheckContext(new CallbackCheck('name', fn() => null)))->id());
$this->assertSame('b22f5367', (new CheckContext(new CallbackCheck('name', fn() => null), label: 'override'))->id());
}
- /**
- * @test
- */
+ #[Test]
public function label_can_be_overridden(): void
{
$this->assertSame('name', (new CheckContext(new CallbackCheck('name', fn() => null)))->label());
$this->assertSame('override', (new CheckContext(new CallbackCheck('name', fn() => null), label: 'override'))->label());
}
- /**
- * @test
- */
+ #[Test]
public function can_set_suites_and_ttl(): void
{
$context = new CheckContext(new CallbackCheck('name', fn() => null));
@@ -77,9 +70,7 @@ public function can_set_suites_and_ttl(): void
$this->assertSame(['foo', 'bar'], (new CheckContext(new CallbackCheck('name', fn() => null), suite: ['foo', 'bar']))->suites());
}
- /**
- * @test
- */
+ #[Test]
public function cannot_create_for_self(): void
{
$this->expectException(\InvalidArgumentException::class);
diff --git a/tests/Check/CheckRunnerTest.php b/tests/Check/CheckRunnerTest.php
index d8102bd7..be66a408 100644
--- a/tests/Check/CheckRunnerTest.php
+++ b/tests/Check/CheckRunnerTest.php
@@ -14,6 +14,7 @@
use Liip\Monitor\Check\CallbackCheck;
use Liip\Monitor\Check\CheckRunner;
use Liip\Monitor\Result\Status;
+use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Psr\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\Cache\CacheInterface;
@@ -23,9 +24,7 @@
*/
final class CheckRunnerTest extends TestCase
{
- /**
- * @test
- */
+ #[Test]
public function exception_thrown(): void
{
$runner = new CheckRunner(
@@ -45,9 +44,7 @@ public function exception_thrown(): void
$this->assertStringContainsString('Liip\Monitor\Tests\Check\CheckRunnerTest->Liip\Monitor\Tests\Check\{closure}()', $result->context()['stack_trace']);
}
- /**
- * @test
- */
+ #[Test]
public function exception_thrown_with_previous(): void
{
$runner = new CheckRunner(
diff --git a/tests/Check/Doctrine/DbalConnectionCheckTest.php b/tests/Check/Doctrine/DbalConnectionCheckTest.php
index 7f2a2c5e..8afe6ca8 100644
--- a/tests/Check/Doctrine/DbalConnectionCheckTest.php
+++ b/tests/Check/Doctrine/DbalConnectionCheckTest.php
@@ -15,6 +15,7 @@
use Liip\Monitor\Check\Doctrine\DbalConnectionCheck;
use Liip\Monitor\Result;
use Liip\Monitor\Result\Status;
+use PHPUnit\Framework\Attributes\Test;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
/**
@@ -22,9 +23,7 @@
*/
final class DbalConnectionCheckTest extends KernelTestCase
{
- /**
- * @test
- */
+ #[Test]
public function can_run(): void
{
$check = new DbalConnectionCheck(self::getContainer()->get('doctrine'), 'default');
@@ -34,9 +33,7 @@ public function can_run(): void
$this->assertSame(Status::SUCCESS, $check->run()->status());
}
- /**
- * @test
- */
+ #[Test]
public function invalid_connection(): void
{
$connectionRegistry = $this->createMock(ConnectionRegistry::class);
diff --git a/tests/Check/LaminasDiagnosticsBridgeCheckTest.php b/tests/Check/LaminasDiagnosticsBridgeCheckTest.php
index bee1a16a..4d6a8efc 100644
--- a/tests/Check/LaminasDiagnosticsBridgeCheckTest.php
+++ b/tests/Check/LaminasDiagnosticsBridgeCheckTest.php
@@ -20,6 +20,7 @@
use Liip\Monitor\Check\LaminasDiagnosticsBridgeCheck;
use Liip\Monitor\Result;
use Liip\Monitor\Tests\CheckTests;
+use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
/**
@@ -64,9 +65,7 @@ public static function checkResultProvider(): iterable
];
}
- /**
- * @test
- */
+ #[Test]
public function invalid(): void
{
$check = self::create(fn() => 'invalid');
diff --git a/tests/Check/Php/ComposerAuditCheckTest.php b/tests/Check/Php/ComposerAuditCheckTest.php
index a765b593..7eea2b47 100644
--- a/tests/Check/Php/ComposerAuditCheckTest.php
+++ b/tests/Check/Php/ComposerAuditCheckTest.php
@@ -14,18 +14,17 @@
use Liip\Monitor\Check\Php\ComposerAuditCheck;
use Liip\Monitor\Result;
use Liip\Monitor\Result\Status;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
/**
* @author Kevin Bond
- *
- * @group slow
*/
+#[Group('slow')]
final class ComposerAuditCheckTest extends TestCase
{
- /**
- * @test
- */
+ #[Test]
public function successful_check(): void
{
$check = new ComposerAuditCheck(__DIR__.'/../../Fixture/project1');
@@ -37,9 +36,7 @@ public function successful_check(): void
$this->assertEquals(Result::success('No advisories'), $result);
}
- /**
- * @test
- */
+ #[Test]
public function failed_check(): void
{
$check = new ComposerAuditCheck(__DIR__.'/../../Fixture/project2');
diff --git a/tests/Check/Php/PhpVersionCheckTest.php b/tests/Check/Php/PhpVersionCheckTest.php
index b996b4df..0a6d25df 100644
--- a/tests/Check/Php/PhpVersionCheckTest.php
+++ b/tests/Check/Php/PhpVersionCheckTest.php
@@ -15,14 +15,14 @@
use Liip\Monitor\Info\Php\PhpVersionInfo;
use Liip\Monitor\Result;
use Liip\Monitor\Tests\CheckTests;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpClient\HttpClient;
/**
* @author Kevin Bond
- *
- * @group slow
*/
+#[Group('slow')]
final class PhpVersionCheckTest extends TestCase
{
use CheckTests;
diff --git a/tests/Check/Symfony/SymfonyVersionCheckTest.php b/tests/Check/Symfony/SymfonyVersionCheckTest.php
index e25e3707..a350e273 100644
--- a/tests/Check/Symfony/SymfonyVersionCheckTest.php
+++ b/tests/Check/Symfony/SymfonyVersionCheckTest.php
@@ -15,14 +15,14 @@
use Liip\Monitor\Info\Symfony\SymfonyVersionInfo;
use Liip\Monitor\Result;
use Liip\Monitor\Tests\CheckTests;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpClient\HttpClient;
/**
* @author Kevin Bond
- *
- * @group slow
*/
+#[Group('slow')]
final class SymfonyVersionCheckTest extends TestCase
{
use CheckTests;
diff --git a/tests/CheckTests.php b/tests/CheckTests.php
index e059118e..c8a5ca6e 100644
--- a/tests/CheckTests.php
+++ b/tests/CheckTests.php
@@ -15,16 +15,16 @@
use Liip\Monitor\Check\CheckContext;
use Liip\Monitor\Result;
use Liip\Monitor\Result\Status;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Test;
/**
* @author Kevin Bond
*/
trait CheckTests
{
- /**
- * @test
- * @dataProvider checkResultProvider
- */
+ #[Test]
+ #[DataProvider('checkResultProvider')]
public function run_check(Check|callable $check, Result|Status|callable $expectedResult, ?string $expectedLabel = null): void
{
if ($check instanceof \Closure) {
diff --git a/tests/Controller/OhDearControllerTest.php b/tests/Controller/OhDearControllerTest.php
index 444e36a8..435182b1 100644
--- a/tests/Controller/OhDearControllerTest.php
+++ b/tests/Controller/OhDearControllerTest.php
@@ -11,6 +11,8 @@
namespace Liip\Monitor\Tests\Controller;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\Test;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Zenstruck\Browser\Test\HasBrowser;
@@ -21,10 +23,8 @@ final class OhDearControllerTest extends KernelTestCase
{
use HasBrowser;
- /**
- * @test
- * @group slow
- */
+ #[Test]
+ #[Group('slow')]
public function run_checks(): void
{
$content = $this->browser()
@@ -43,9 +43,7 @@ public function run_checks(): void
$this->assertSame('ok', $content['checkResults'][0]['status']);
}
- /**
- * @test
- */
+ #[Test]
public function not_found_if_secret_missing(): void
{
$this->browser()
@@ -54,9 +52,7 @@ public function not_found_if_secret_missing(): void
;
}
- /**
- * @test
- */
+ #[Test]
public function not_found_if_secret_mismatch(): void
{
$this->browser()
diff --git a/tests/DependencyInjection/LiipMonitorCompilerPassTest.php b/tests/DependencyInjection/LiipMonitorCompilerPassTest.php
index b792579d..764cb7a3 100644
--- a/tests/DependencyInjection/LiipMonitorCompilerPassTest.php
+++ b/tests/DependencyInjection/LiipMonitorCompilerPassTest.php
@@ -15,6 +15,7 @@
use Liip\Monitor\Check\Doctrine\DbalConnectionCheck;
use Liip\Monitor\DependencyInjection\LiipMonitorExtension;
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractCompilerPassTestCase;
+use PHPUnit\Framework\Attributes\Test;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
@@ -22,9 +23,7 @@
*/
final class LiipMonitorCompilerPassTest extends AbstractCompilerPassTestCase
{
- /**
- * @test
- */
+ #[Test]
public function adds_default_doctrine_connection_checks(): void
{
$this->setParameter('liip_monitor.check.doctrine_dbal_connection.all', []);
diff --git a/tests/DependencyInjection/LiipMonitorExtensionTest.php b/tests/DependencyInjection/LiipMonitorExtensionTest.php
index 388298fb..c7c4ba11 100644
--- a/tests/DependencyInjection/LiipMonitorExtensionTest.php
+++ b/tests/DependencyInjection/LiipMonitorExtensionTest.php
@@ -28,15 +28,15 @@
use Liip\Monitor\DependencyInjection\ConfigurableCheck;
use Liip\Monitor\DependencyInjection\LiipMonitorExtension;
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Test;
/**
* @author Kevin Bond
*/
final class LiipMonitorExtensionTest extends AbstractExtensionTestCase
{
- /**
- * @test
- */
+ #[Test]
public function loads_with_no_config(): void
{
$this->load();
@@ -45,11 +45,10 @@ public function loads_with_no_config(): void
}
/**
- * @test
- * @dataProvider checksThatCanBeEnabled
- *
* @param class-string $check
*/
+ #[Test]
+ #[DataProvider('checksThatCanBeEnabled')]
public function simple_enable_checks(string $check): void
{
$this->loadCheck([$check::configKey() => true]);
@@ -69,9 +68,7 @@ public static function checksThatCanBeEnabled(): iterable
yield [SymfonyVersionCheck::class];
}
- /**
- * @test
- */
+ #[Test]
public function enable_disk_usage(): void
{
$this->loadCheck(['system_disk_usage' => true]);
@@ -79,9 +76,7 @@ public function enable_disk_usage(): void
$this->assertContainerBuilderHasService('.liip_monitor.check.system_disk_usage.2cd3e1ab', DiskUsageCheck::class);
}
- /**
- * @test
- */
+ #[Test]
public function enable_free_disk_space(): void
{
$this->loadCheck(['system_free_disk_space' => [
@@ -92,9 +87,7 @@ public function enable_free_disk_space(): void
$this->assertContainerBuilderHasService('.liip_monitor.check.system_free_disk_space.2cd3e1ab', FreeDiskSpaceCheck::class);
}
- /**
- * @test
- */
+ #[Test]
public function enable_dbal_collection(): void
{
$this->loadCheck(['dbal_connection' => true]);
@@ -121,9 +114,7 @@ public function enable_dbal_collection(): void
$this->assertContainerBuilderHasService('.liip_monitor.check.doctrine_dbal_connection.second', DbalConnectionCheck::class);
}
- /**
- * @test
- */
+ #[Test]
public function enable_ping_url_check(): void
{
$this->loadCheck(['ping_url' => [
@@ -139,9 +130,7 @@ public function enable_ping_url_check(): void
$this->assertContainerBuilderHasService('.liip_monitor.check.ping_url.foo', PingUrlCheck::class);
}
- /**
- * @test
- */
+ #[Test]
public function load_average(): void
{
$this->loadCheck(['system_load_average' => [
diff --git a/tests/Info/Php/PhpVersionInfoTest.php b/tests/Info/Php/PhpVersionInfoTest.php
index 6d4e1c2a..341b1ecd 100644
--- a/tests/Info/Php/PhpVersionInfoTest.php
+++ b/tests/Info/Php/PhpVersionInfoTest.php
@@ -12,19 +12,18 @@
namespace Liip\Monitor\Tests\Info\Php;
use Liip\Monitor\Info\Php\PhpVersionInfo;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpClient\HttpClient;
/**
* @author Kevin Bond
- *
- * @group slow
*/
+#[Group('slow')]
final class PhpVersionInfoTest extends TestCase
{
- /**
- * @test
- */
+ #[Test]
public function system_version(): void
{
$activeVersions = HttpClient::create()->request('GET', 'https://www.php.net/releases/active')->toArray();
@@ -57,9 +56,7 @@ public function system_version(): void
$info->nextMinorVersion();
}
- /**
- * @test
- */
+ #[Test]
public function specific_version(): void
{
$info = new PhpVersionInfo('7.3.2');
diff --git a/tests/Info/Symfony/SymfonyVersionInfoTest.php b/tests/Info/Symfony/SymfonyVersionInfoTest.php
index 61189c96..7ac49e0d 100644
--- a/tests/Info/Symfony/SymfonyVersionInfoTest.php
+++ b/tests/Info/Symfony/SymfonyVersionInfoTest.php
@@ -12,19 +12,18 @@
namespace Liip\Monitor\Tests\Info\Symfony;
use Liip\Monitor\Info\Symfony\SymfonyVersionInfo;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpKernel\Kernel;
/**
* @author Kevin Bond
- *
- * @group slow
*/
+#[Group('slow')]
final class SymfonyVersionInfoTest extends TestCase
{
- /**
- * @test
- */
+ #[Test]
public function installed_version(): void
{
$info = new SymfonyVersionInfo();
@@ -54,9 +53,7 @@ public function installed_version(): void
$info->isLatest();
}
- /**
- * @test
- */
+ #[Test]
public function specific_version(): void
{
$info = new SymfonyVersionInfo('4.3.2');
diff --git a/tests/LiipMonitorBundleTest.php b/tests/LiipMonitorBundleTest.php
index 6b3a179b..d57a53ff 100644
--- a/tests/LiipMonitorBundleTest.php
+++ b/tests/LiipMonitorBundleTest.php
@@ -19,6 +19,8 @@
use Liip\Monitor\Result\ResultSet;
use Liip\Monitor\Result\Status;
use Liip\Monitor\Tests\Fixture\TestService;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\Test;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Messenger\HandleTrait;
use Symfony\Component\Messenger\MessageBusInterface;
@@ -33,9 +35,7 @@ final class LiipMonitorBundleTest extends KernelTestCase
{
use HandleTrait, InteractsWithConsole, InteractsWithMailer;
- /**
- * @test
- */
+ #[Test]
public function services_are_autowired(): void
{
/** @var TestService $service */
@@ -49,9 +49,7 @@ public function services_are_autowired(): void
$this->assertSame($service->system, $service->linuxSystem);
}
- /**
- * @test
- */
+ #[Test]
public function execute_list_command(): void
{
$this->executeConsoleCommand('monitor:list')
@@ -63,10 +61,8 @@ public function execute_list_command(): void
;
}
- /**
- * @test
- * @group slow
- */
+ #[Test]
+ #[Group('slow')]
public function execute_health_command(): void
{
$this->executeConsoleCommand('monitor:health')
@@ -98,10 +94,8 @@ public function execute_health_command(): void
$logger->hasInfoThatContains('Health check "Check Service 1": Success');
}
- /**
- * @test
- * @group slow
- */
+ #[Test]
+ #[Group('slow')]
public function messenger_run_check_suite(): void
{
$this->messageBus = self::getContainer()->get(MessageBusInterface::class);
@@ -112,9 +106,7 @@ public function messenger_run_check_suite(): void
$this->assertCount(21, $results);
}
- /**
- * @test
- */
+ #[Test]
public function messenger_run_check(): void
{
$this->messageBus = self::getContainer()->get(MessageBusInterface::class);
@@ -125,9 +117,7 @@ public function messenger_run_check(): void
$this->assertSame(Status::SUCCESS, $result->status());
}
- /**
- * @test
- */
+ #[Test]
public function messenger_run_checks(): void
{
$this->messageBus = self::getContainer()->get(MessageBusInterface::class);
diff --git a/tests/Result/ResultSetTest.php b/tests/Result/ResultSetTest.php
index 1edc78ab..3b57f381 100644
--- a/tests/Result/ResultSetTest.php
+++ b/tests/Result/ResultSetTest.php
@@ -16,6 +16,7 @@
use Liip\Monitor\Result;
use Liip\Monitor\Result\ResultContext;
use Liip\Monitor\Result\ResultSet;
+use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
/**
@@ -23,9 +24,7 @@
*/
final class ResultSetTest extends TestCase
{
- /**
- * @test
- */
+ #[Test]
public function json_serialize(): void
{
$results = new ResultSet([
diff --git a/tests/System/LinuxSystemTest.php b/tests/System/LinuxSystemTest.php
index 32f99b43..1e8f4945 100644
--- a/tests/System/LinuxSystemTest.php
+++ b/tests/System/LinuxSystemTest.php
@@ -14,6 +14,7 @@
use Liip\Monitor\System\LinuxSystem;
use Liip\Monitor\Tests\RequiresLinux;
use Liip\Monitor\Tests\SystemTest;
+use PHPUnit\Framework\Attributes\Test;
/**
* @author Kevin Bond
@@ -22,25 +23,19 @@ final class LinuxSystemTest extends SystemTest
{
use RequiresLinux;
- /**
- * @test
- */
+ #[Test]
public function stringable(): void
{
$this->assertStringContainsString('Ubuntu', (string) $this->create());
}
- /**
- * @test
- */
+ #[Test]
public function is_reboot_required(): void
{
$this->assertSame(\file_exists('/var/run/reboot-required'), $this->create()->isRebootRequired());
}
- /**
- * @test
- */
+ #[Test]
public function memory(): void
{
$memory = $this->create()->memory();
@@ -50,9 +45,7 @@ public function memory(): void
$this->assertLessThanOrEqual(1.0, $memory->percentUsed()->decimal());
}
- /**
- * @test
- */
+ #[Test]
public function cached_memory(): void
{
$memory = $this->create()->cachedMemory();
@@ -62,9 +55,7 @@ public function cached_memory(): void
$this->assertLessThanOrEqual(1.0, $memory->percentUsed()->decimal());
}
- /**
- * @test
- */
+ #[Test]
public function buffered_memory(): void
{
$memory = $this->create()->bufferedMemory();
@@ -74,9 +65,7 @@ public function buffered_memory(): void
$this->assertLessThanOrEqual(1.0, $memory->percentUsed()->decimal());
}
- /**
- * @test
- */
+ #[Test]
public function swap_memory(): void
{
$memory = $this->create()->swapMemory();
diff --git a/tests/SystemTest.php b/tests/SystemTest.php
index 81ff211d..0e39f6e6 100644
--- a/tests/SystemTest.php
+++ b/tests/SystemTest.php
@@ -12,6 +12,7 @@
namespace Liip\Monitor\Tests;
use Liip\Monitor\System;
+use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
/**
@@ -19,9 +20,7 @@
*/
class SystemTest extends TestCase
{
- /**
- * @test
- */
+ #[Test]
public function is_reboot_required(): void
{
$system = $this->create();
@@ -31,9 +30,7 @@ public function is_reboot_required(): void
$system->isRebootRequired();
}
- /**
- * @test
- */
+ #[Test]
public function load_averages(): void
{
$averages = $this->create()->loadAverages();
@@ -48,9 +45,7 @@ public function load_averages(): void
$this->assertGreaterThanOrEqual(0, $averages[2]->decimal());
}
- /**
- * @test
- */
+ #[Test]
public function disk(): void
{
$disk = $this->create()->disk();
@@ -60,9 +55,7 @@ public function disk(): void
$this->assertLessThanOrEqual(1.0, $disk->percentUsed()->decimal());
}
- /**
- * @test
- */
+ #[Test]
public function memory(): void
{
$system = $this->create();
@@ -72,17 +65,13 @@ public function memory(): void
$system->memory();
}
- /**
- * @test
- */
+ #[Test]
public function stringable(): void
{
$this->assertSame('Linux', (string) $this->create());
}
- /**
- * @test
- */
+ #[Test]
public function webserver(): void
{
$this->assertSame('n/a', (string) $this->create()->webserver());
diff --git a/tests/Utility/PercentTest.php b/tests/Utility/PercentTest.php
index 403a6068..611dad35 100644
--- a/tests/Utility/PercentTest.php
+++ b/tests/Utility/PercentTest.php
@@ -12,6 +12,8 @@
namespace Liip\Monitor\Tests\Utility;
use Liip\Monitor\Utility\Percent;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
/**
@@ -38,10 +40,8 @@ public static function formatsProvider(): iterable
yield [fn() => Percent::from(' 5 % '), 0.05, 5.0, '5%', '5.00%'];
}
- /**
- * @test
- * @dataProvider formatsProvider
- */
+ #[Test]
+ #[DataProvider('formatsProvider')]
public function formats(callable $p, $expectedDecimal, $expectedPercentage, $expectedString, $expectedFormat): void
{
$p = $p();
@@ -52,9 +52,7 @@ public function formats(callable $p, $expectedDecimal, $expectedPercentage, $exp
$this->assertSame($expectedFormat, $p->format(2));
}
- /**
- * @test
- */
+ #[Test]
public function can_constrain(): void
{
$this->assertSame(5.0, Percent::from(5)->constrain()->percentage());
@@ -66,9 +64,7 @@ public function can_constrain(): void
$this->assertSame(120.0, Percent::from(120)->constrainLower()->percentage());
}
- /**
- * @test
- */
+ #[Test]
public function comparisons(): void
{
$this->assertTrue(Percent::from(5)->isEqualTo(Percent::from(5)));
@@ -83,9 +79,7 @@ public function comparisons(): void
$this->assertFalse(Percent::from(5)->isLessThanOrEqualTo(Percent::from(4)));
}
- /**
- * @test
- */
+ #[Test]
public function calculate(): void
{
$this->assertSame(0.5, Percent::calculate(5, 10)->decimal());
@@ -97,10 +91,8 @@ public function calculate(): void
Percent::calculate(5, 0);
}
- /**
- * @test
- * @dataProvider invalidStringProvider
- */
+ #[Test]
+ #[DataProvider('invalidStringProvider')]
public function from_percentage_invalid_string(string $value): void
{
$this->expectException(\InvalidArgumentException::class);