As Drupal 11 uses PHPUnit 10, we can now use the #[Test] attribute instead of the /** @test */ annotation for our test methods.
#[Test]
/** @test */
For example:
// Before. /** @test */ public function it_returns_the_endpoint() // After. #[Test] public function it_returns_the_endpoint()
Annotations have started to be replaced in parts of Drupal since 10.2, so it's nice to be able to do it with tests, too.
Which do you prefer?
- Oliver
Sign up here and get more like this delivered straight to your inbox every day.
I'm an Acquia-certified Drupal Triple Expert with 17 years of experience, an open-source software maintainer and Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.