diff --git a/src/Test/Attributes/Test.php b/src/Test/Attributes/Test.php new file mode 100644 index 00000000..ff1819da --- /dev/null +++ b/src/Test/Attributes/Test.php @@ -0,0 +1,6 @@ +getNativeReflection(); foreach ($reflected->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { - if (preg_match('/^(test)[A-Za-z0-9_\x80-\xff]*/', $method->getName()) + if ( + !empty($method->getAttributes(Test::class)) + || preg_match('/^(test)[A-Za-z0-9_\x80-\xff]*/', $method->getName()) ) { $methods[] = $method->getName(); } diff --git a/tests/architecture/ConfigurationTest.php b/tests/architecture/ConfigurationTest.php index fd5e44c6..ddb844c8 100644 --- a/tests/architecture/ConfigurationTest.php +++ b/tests/architecture/ConfigurationTest.php @@ -4,12 +4,14 @@ use PHPat\Configuration; use PHPat\Selector\Selector; +use PHPat\Test\Attributes\Test; use PHPat\Test\Builder\Rule; use PHPat\Test\PHPat; final class ConfigurationTest { - public function test_configuration_does_not_have_dependencies(): Rule + #[Test] + public function configuration_does_not_have_dependencies(): Rule { return PHPat::rule() ->classes(Selector::classname(Configuration::class)) @@ -18,7 +20,8 @@ public function test_configuration_does_not_have_dependencies(): Rule ; } - public function test_configuration_is_final(): Rule + #[Test] + public function configuration_is_final(): Rule { return PHPat::rule() ->classes(Selector::classname(Configuration::class))