44
55use Generator ;
66use InvalidArgumentException ;
7+ use PHPUnit \Framework \Attributes \DataProvider ;
8+ use PHPUnit \Framework \Attributes \Test ;
79use Symfony \Bundle \FrameworkBundle \Test \KernelTestCase ;
810use Symfony \Component \HttpFoundation \Request ;
911use Symfony \Component \HttpFoundation \RequestStack ;
1820 */
1921class EmbeddedShortcodeHandlerTest extends KernelTestCase
2022{
21- /** @test */
23+ #[Test]
2224 public function paragraphs_wrapping_shortcodes_get_removed (): void
2325 {
2426 self ::assertSame ('test ' , $ this ->processShortcodes ('<p>[test-config-inline]</p> ' ));
2527 }
2628
27- /** @test */
29+ #[Test]
2830 public function content_without_shortcodes_wont_be_changed (): void
2931 {
3032 self ::assertSame ('<p>Content without shortcode</p> ' , $ this ->processShortcodes ('<p>Content without shortcode</p> ' ));
3133 }
3234
33- /**
34- * @test
35- *
36- * @dataProvider provideShortcodeNames
37- */
35+ #[DataProvider('provideShortcodeNames ' )]
36+ #[Test]
3837 public function expand_shortcodes_registered_in_different_ways (string $ shortcodeName ): void
3938 {
4039 // All shortcodes are set up as fixtures and use ShortcodeTestController
@@ -49,11 +48,8 @@ public static function provideShortcodeNames(): Generator
4948 yield 'ESI-based shortcode defined in service definitions ' => ['test-service-esi ' ];
5049 }
5150
52- /**
53- * @test
54- *
55- * @dataProvider provideEsiShortcodes
56- */
51+ #[DataProvider('provideEsiShortcodes ' )]
52+ #[Test]
5753 public function processing_with_esi_fragments (string $ shortcodeName ): void
5854 {
5955 $ request = new Request ([], [], [], [], [], ['SCRIPT_URL ' => '/ ' , 'HTTP_HOST ' => 'localhost ' ]);
@@ -68,17 +64,14 @@ public static function provideEsiShortcodes(): Generator
6864 yield 'ESI-based shortcode defined in service configuration ' => ['test-service-esi ' ];
6965 }
7066
71- /** @test */
67+ #[Test]
7268 public function invokable_controller_can_be_used (): void
7369 {
7470 self ::assertSame ('invokable-controller-response ' , $ this ->processShortcodes ('<p>[test-config-invokable]</p> ' ));
7571 }
7672
77- /**
78- * @test
79- *
80- * @dataProvider provideControllerNames
81- */
73+ #[DataProvider('provideControllerNames ' )]
74+ #[Test]
8275 public function throws_exception_on_invalid_controller_names (string $ controllerName ): void
8376 {
8477 $ this ->expectException (InvalidArgumentException::class);
0 commit comments