function ProcessOutputCallbackTest::testInvalidJson

Tests what happens when the output buffer has invalid JSON.

File

core/modules/package_manager/tests/src/Unit/ProcessOutputCallbackTest.php, line 21

Class

ProcessOutputCallbackTest
@covers \Drupal\package_manager\ProcessOutputCallback @group package_manager

Namespace

Drupal\Tests\package_manager\Unit

Code

public function testInvalidJson() : void {
    $callback = new ProcessOutputCallback();
    $callback(OutputTypeEnum::OUT, '{A string of invalid JSON! 😈');
    $this->expectException(\JsonException::class);
    $this->expectExceptionMessage('Syntax error');
    $callback->parseJsonOutput();
}

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