ModuleInstallBatchTest.php 942 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Drupal\FunctionalTests\Core\Test;
  3. use Drupal\entity_test\Entity\EntityTest;
  4. use Drupal\Tests\BrowserTestBase;
  5. /**
  6. * Tests batch operations during tests execution.
  7. *
  8. * This demonstrates that a batch will be successfully executed during module
  9. * installation when running tests.
  10. *
  11. * @group Test
  12. * @group FunctionalTestSetupTrait
  13. *
  14. * @see \Drupal\simpletest\Tests\SimpleTestInstallBatchTest
  15. */
  16. class ModuleInstallBatchTest extends BrowserTestBase {
  17. /**
  18. * Modules to enable.
  19. *
  20. * @var array
  21. */
  22. public static $modules = ['test_batch_test', 'entity_test'];
  23. /**
  24. * {@inheritdoc}
  25. */
  26. protected $defaultTheme = 'stark';
  27. /**
  28. * Tests loading entities created in a batch in test_batch_test_install().
  29. */
  30. public function testLoadingEntitiesCreatedInBatch() {
  31. foreach ([1, 2] as $id) {
  32. $this->assertNotNull(EntityTest::load($id), 'Successfully loaded entity ' . $id);
  33. }
  34. }
  35. }