22
33namespace Drupal \Tests \bamboo_twig \Functional ;
44
5+ use Drupal \bamboo_twig_loader \TwigExtension \Loader ;
56use Drupal \Core \StreamWrapper \PublicStream ;
67use Drupal \file \FileInterface ;
78use Drupal \Tests \taxonomy \Traits \TaxonomyTestTrait ;
9+ use PHPUnit \Framework \Attributes \CoversClass ;
10+ use PHPUnit \Framework \Attributes \CoversMethod ;
11+ use PHPUnit \Framework \Attributes \Group ;
812use PHPUnit \Framework \Attributes \RunTestsInSeparateProcesses ;
913
1014/**
1115 * Tests Loaders twig filters and functions.
12- *
13- * @group bamboo_twig
14- * @group bamboo_twig_functional
15- * @group bamboo_twig_loader
1616 */
17+ #[CoversClass(Loader::class)]
18+ #[CoversMethod(Loader::class, 'loadCurrentUser ' )]
19+ #[CoversMethod(Loader::class, 'loadEntity ' )]
20+ #[CoversMethod(Loader::class, 'loadEntityRevision ' )]
21+ #[CoversMethod(Loader::class, 'loadField ' )]
22+ #[CoversMethod(Loader::class, 'loadImage ' )]
23+ #[Group('bamboo_twig ' )]
24+ #[Group('bamboo_twig_functional ' )]
25+ #[Group('bamboo_twig_loader ' )]
1726#[RunTestsInSeparateProcesses]
1827class BambooTwigLoaderTest extends BambooTwigTestBase {
1928 use TaxonomyTestTrait;
@@ -98,7 +107,7 @@ public function setUp(): void {
98107 }
99108
100109 /**
101- * @covers Drupal\bamboo_twig_loader\TwigExtension\Loader:: loadCurrentUser
110+ * Tests loadCurrentUser() loads the current user in templates.
102111 */
103112 public function testCurrentUser () {
104113 $ this ->drupalGet ('/bamboo-twig-loader ' );
@@ -114,7 +123,7 @@ public function testCurrentUser() {
114123 }
115124
116125 /**
117- * @covers Drupal\bamboo_twig_loader\TwigExtension\Loader:: loadEntity
126+ * Tests loadEntity() loads nodes, taxonomy terms, files, and users.
118127 */
119128 public function testEntity () {
120129 $ this ->drupalGet ('/bamboo-twig-loader ' );
@@ -222,7 +231,7 @@ public function testEntity() {
222231 }
223232
224233 /**
225- * @covers Drupal\bamboo_twig_loader\TwigExtension\Loader:: loadEntityRevision
234+ * Tests loadEntityRevision() loads specific revisions of entities.
226235 */
227236 public function testEntityRevision () {
228237 $ this ->drupalGet ('/bamboo-twig-loader-revision ' );
@@ -252,8 +261,7 @@ public function testEntityRevision() {
252261 }
253262
254263 /**
255- * @covers Drupal\bamboo_twig_loader\TwigExtension\Loader::loadEntity
256- * @covers Drupal\bamboo_twig_loader\TwigExtension\Loader::loadEntityRevision
264+ * Tests loadEntity() and loadEntityRevision() load entities from route.
257265 */
258266 public function testEntityFromRoutes () {
259267 // Accessing unpublished revision page required to be authenticated.
@@ -287,7 +295,7 @@ public function testEntityFromRoutes() {
287295 }
288296
289297 /**
290- * @covers Drupal\bamboo_twig_loader\TwigExtension\Loader:: loadField
298+ * Tests loadField() loads individual field values from entities.
291299 */
292300 public function testField () {
293301 $ this ->drupalGet ('/bamboo-twig-loader ' );
@@ -391,7 +399,7 @@ public function testField() {
391399 }
392400
393401 /**
394- * @covers Drupal\bamboo_twig_loader\TwigExtension\Loader:: loadImage
402+ * Tests loadImage() loads an image by URI and by module path.
395403 */
396404 public function testImage () {
397405 $ this ->drupalGet ('/bamboo-twig-loader ' );
0 commit comments