function AssertPreconditionsTrait::assertNoFailureMarker

Asserts that there is no failure marker present.

Parameters

string $when: Either 'before' (before any test methods run) or 'after' (after any test method finishes).

See also

\Drupal\package_manager\FailureMarker

1 call to AssertPreconditionsTrait::assertNoFailureMarker()
AssertPreconditionsTrait::failIfUnmetPreConditions in core/modules/package_manager/tests/src/Traits/AssertPreconditionsTrait.php
Asserts universal test preconditions before any setup is done.

File

core/modules/package_manager/tests/src/Traits/AssertPreconditionsTrait.php, line 74

Class

AssertPreconditionsTrait
Asserts preconditions for tests to function properly.

Namespace

Drupal\Tests\package_manager\Traits

Code

private static function assertNoFailureMarker(string $when) : void {
    // If the failure marker exists, it will be in the project root. The project
    // root is defined as the directory containing the `vendor` directory.
    // @see \Drupal\package_manager\FailureMarker::getPath()
    $failure_marker = static::getProjectRoot() . '/PACKAGE_MANAGER_FAILURE.yml';
    if (file_exists($failure_marker)) {
        $suffix = $when === 'before' ? 'Remove it to continue.' : 'This test method created this marker but failed to clean up after itself.';
        static::fail("The failure marker '{$failure_marker}' is present in the project. {$suffix}");
    }
}

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