RequiresComposerTrait.php

Same filename in other branches
  1. 10 core/tests/Drupal/TestTools/Extension/RequiresComposerTrait.php

Namespace

Drupal\TestTools\Extension

File

core/tests/Drupal/TestTools/Extension/RequiresComposerTrait.php

View source
<?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 {
    public static function requiresComposer() : void {
        if (!(new ExecutableFinder())->find('composer')) {
            static::markTestSkipped('This test requires the Composer executable to be accessible.');
        }
    }

}

Traits

Title Deprecated Summary
RequiresComposerTrait Ensures Composer executable is available, skips test otherwise.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.