RequiresComposerTrait.php

Same filename in other branches
  1. 11.x 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 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.');
        }
    }

}

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.