ModuleInstallBatchTest.php

Same filename and directory in other branches
  1. 8.9.x core/tests/Drupal/FunctionalTests/Core/Test/ModuleInstallBatchTest.php
  2. 10 core/tests/Drupal/FunctionalTests/Core/Test/ModuleInstallBatchTest.php
  3. 11.x core/tests/Drupal/FunctionalTests/Core/Test/ModuleInstallBatchTest.php

Namespace

Drupal\FunctionalTests\Core\Test

File

core/tests/Drupal/FunctionalTests/Core/Test/ModuleInstallBatchTest.php

View source
<?php

namespace Drupal\FunctionalTests\Core\Test;

use Drupal\entity_test\Entity\EntityTest;
use Drupal\Tests\BrowserTestBase;

/**
 * Tests batch operations during tests execution.
 *
 * This demonstrates that a batch will be successfully executed during module
 * installation when running tests.
 *
 * @group Test
 * @group FunctionalTestSetupTrait
 *
 * @see \Drupal\simpletest\Tests\SimpleTestInstallBatchTest
 */
class ModuleInstallBatchTest extends BrowserTestBase {
    
    /**
     * Modules to enable.
     *
     * @var array
     */
    protected static $modules = [
        'test_batch_test',
        'entity_test',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * Tests loading entities created in a batch in test_batch_test_install().
     */
    public function testLoadingEntitiesCreatedInBatch() {
        foreach ([
            1,
            2,
        ] as $id) {
            $this->assertNotNull(EntityTest::load($id), 'Successfully loaded entity ' . $id);
        }
    }

}

Classes

Title Deprecated Summary
ModuleInstallBatchTest Tests batch operations during tests execution.

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