
| Current Path : /var/www/html/rocksensor/web/core/modules/system/tests/src/Functional/Batch/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor/web/core/modules/system/tests/src/Functional/Batch/BatchNotFoundTest.php |
<?php
declare(strict_types=1);
namespace Drupal\Tests\system\Functional\Batch;
use Drupal\Core\Batch\BatchStorageInterface;
use Drupal\Tests\BrowserTestBase;
/**
* Tests if a page not found error is returned when a batch ID does not exist.
*
* @group Batch
*/
class BatchNotFoundTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = ['batch_test'];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests for page not found error if batch ID does not exist.
*/
public function testBatchNotFound(): void {
$edit = ['batch' => 'batch_0'];
$this->drupalGet('batch-test');
$this->submitForm($edit, 'Submit');
$this->assertSession()->statusCodeEquals(200);
$batch_id = \Drupal::service(BatchStorageInterface::class)->getId();
$this->drupalGet('batch', [
'query' => [
'op' => 'start',
'id' => $batch_id,
],
]);
$this->assertSession()->statusCodeEquals(404);
}
}