public function BatchBuilderTest::testDefaultValues in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Batch/BatchBuilderTest.php \Drupal\Tests\Core\Batch\BatchBuilderTest::testDefaultValues()
- 9 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 23
Class
- BatchBuilderTest
- Tests for the batch builder class.
Namespace
Drupal\Tests\Core\BatchCode
public function testDefaultValues() {
$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);
}