function BatchBuilderTest::testAddingLibraries

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

Tests setting and adding libraries.

@covers ::setLibraries

File

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

Class

BatchBuilderTest
Tests for the batch builder class.

Namespace

Drupal\Tests\Core\Batch

Code

public function testAddingLibraries() : void {
    $batch = (new BatchBuilder())->setLibraries([
        'only/library',
    ])
        ->toArray();
    $this->assertEquals([
        'only/library',
    ], $batch['library']);
}

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