summaryrefslogtreecommitdiffstatshomepage
path: root/core/tests/Drupal/TestTools/Extension/RequiresComposerTrait.php
blob: 8166cd9a05a5f31c32d7d9d5a1b8dc1a54c4d200 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

declare(strict_types=1);

namespace Drupal\TestTools\Extension;

use PHPUnit\Framework\Attributes\BeforeClass;
use Symfony\Component\Process\ExecutableFinder;

/**
 * Ensures Composer executable is available, skips test otherwise.
 */
trait RequiresComposerTrait {

  #[BeforeClass]
  public static function requiresComposer(): void {
    if (!((new ExecutableFinder())->find('composer'))) {
      static::markTestSkipped('This test requires the Composer executable to be accessible.');
    }
  }

}