function BatchBuilderTest::testSetErrorMessage

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Batch/BatchBuilderTest.php \Drupal\Tests\Core\Batch\BatchBuilderTest::testSetErrorMessage()
  2. 8.9.x core/tests/Drupal/Tests/Core/Batch/BatchBuilderTest.php \Drupal\Tests\Core\Batch\BatchBuilderTest::testSetErrorMessage()
  3. 10 core/tests/Drupal/Tests/Core/Batch/BatchBuilderTest.php \Drupal\Tests\Core\Batch\BatchBuilderTest::testSetErrorMessage()

Tests setErrorMessage().

File

core/tests/Drupal/Tests/Core/Batch/BatchBuilderTest.php, line 104

Class

BatchBuilderTest
Tests for the batch builder class.

Namespace

Drupal\Tests\Core\Batch

Code

public function testSetErrorMessage() : void {
    $batch = (new BatchBuilder())->setErrorMessage(new TranslatableMarkup('Oops. An error has occurred :('))
        ->toArray();
    $this->assertEquals(new TranslatableMarkup('Oops. An error has occurred :('), $batch['error_message']);
}

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