BatchKernelTest.php

Same filename and directory in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Batch/BatchKernelTest.php
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Batch/BatchKernelTest.php
  3. 10 core/tests/Drupal/KernelTests/Core/Batch/BatchKernelTest.php

Namespace

Drupal\KernelTests\Core\Batch

File

core/tests/Drupal/KernelTests/Core/Batch/BatchKernelTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\KernelTests\Core\Batch;

use Drupal\KernelTests\KernelTestBase;

/**
 * Tests batch functionality.
 *
 * @group Batch
 */
class BatchKernelTest extends KernelTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() : void {
        parent::setUp();
        require_once $this->root . '/core/includes/batch.inc';
    }
    
    /**
     * Tests _batch_needs_update().
     */
    public function testNeedsUpdate() : void {
        // Before ever being called, the return value should be FALSE.
        $this->assertEquals(FALSE, _batch_needs_update());
        // Set the value to TRUE.
        $this->assertEquals(TRUE, _batch_needs_update(TRUE));
        // Check that without a parameter TRUE is returned.
        $this->assertEquals(TRUE, _batch_needs_update());
        // Set the value to FALSE.
        $this->assertEquals(FALSE, _batch_needs_update(FALSE));
        $this->assertEquals(FALSE, _batch_needs_update());
    }

}

Classes

Title Deprecated Summary
BatchKernelTest Tests batch functionality.

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