function FailureMarkerTest::testExceptionForInvalidYaml

Tests that an exception is thrown if the marker file contains invalid YAML.

@covers ::assertNotExists

File

core/modules/package_manager/tests/src/Kernel/FailureMarkerTest.php, line 62

Class

FailureMarkerTest
@coversDefaultClass \Drupal\package_manager\FailureMarker @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testExceptionForInvalidYaml() : void {
    $failure_marker = $this->container
        ->get(FailureMarker::class);
    // Write the failure marker with invalid YAML.
    file_put_contents($failure_marker->getPath(), 'message : something message : something1');
    $this->expectException(StageFailureMarkerException::class);
    $this->expectExceptionMessage('Failure marker file exists but cannot be decoded.');
    $failure_marker->assertNotExists();
}

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