function BatchBuilderTest::testDefaultValues
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Batch/BatchBuilderTest.php \Drupal\Tests\Core\Batch\BatchBuilderTest::testDefaultValues()
- 8.9.x core/tests/Drupal/Tests/Core/Batch/BatchBuilderTest.php \Drupal\Tests\Core\Batch\BatchBuilderTest::testDefaultValues()
- 10 core/tests/Drupal/Tests/Core/Batch/BatchBuilderTest.php \Drupal\Tests\Core\Batch\BatchBuilderTest::testDefaultValues()
Tests the default values.
@covers ::toArray
File
-
core/
tests/ Drupal/ Tests/ Core/ Batch/ BatchBuilderTest.php, line 25
Class
- BatchBuilderTest
- Tests for the batch builder class.
Namespace
Drupal\Tests\Core\BatchCode
public function testDefaultValues() : void {
$batch = (new BatchBuilder())->toArray();
$this->assertIsArray($batch);
$this->assertArrayHasKey('operations', $batch);
$this->assertIsArray($batch['operations']);
$this->assertEmpty($batch['operations'], 'Operations array is empty.');
$this->assertEquals(new TranslatableMarkup('Processing'), $batch['title']);
$this->assertEquals(new TranslatableMarkup('Initializing.'), $batch['init_message']);
$this->assertEquals(new TranslatableMarkup('Completed @current of @total.'), $batch['progress_message']);
$this->assertEquals(new TranslatableMarkup('An error has occurred.'), $batch['error_message']);
$this->assertNull($batch['finished']);
$this->assertNull($batch['file']);
$this->assertArrayHasKey('library', $batch);
$this->assertIsArray($batch['library']);
$this->assertEmpty($batch['library']);
$this->assertArrayHasKey('url_options', $batch);
$this->assertIsArray($batch['url_options']);
$this->assertEmpty($batch['url_options']);
$this->assertArrayHasKey('progressive', $batch);
$this->assertTrue($batch['progressive']);
$this->assertArrayNotHasKey('queue', $batch);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.