public function BatchBuilderTest::testSetFile in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Batch/BatchBuilderTest.php \Drupal\Tests\Core\Batch\BatchBuilderTest::testSetFile()
- 9 core/tests/Drupal/Tests/Core/Batch/BatchBuilderTest.php \Drupal\Tests\Core\Batch\BatchBuilderTest::testSetFile()
Tests setFile().
@covers ::setFile
File
- core/
tests/ Drupal/ Tests/ Core/ Batch/ BatchBuilderTest.php, line 115
Class
- BatchBuilderTest
- Tests for the batch builder class.
Namespace
Drupal\Tests\Core\BatchCode
public function testSetFile() {
$filename = dirname(__DIR__, 6) . '/core/modules/system/tests/modules/batch_test/batch_test.callbacks.inc';
$this
->assertIsNotCallable('_batch_test_callback_1');
$this
->assertIsNotCallable('_batch_test_finished_1');
$batch = (new BatchBuilder())
->setFile($filename)
->setFinishCallback('_batch_test_finished_1')
->addOperation('_batch_test_callback_1', [])
->toArray();
$this
->assertEquals($filename, $batch['file']);
$this
->assertEquals([
[
'_batch_test_callback_1',
[],
],
], $batch['operations']);
$this
->assertEquals('_batch_test_finished_1', $batch['finished']);
$this
->assertIsCallable('_batch_test_callback_1');
$this
->assertIsCallable('_batch_test_finished_1');
}