You are here

protected function UpdateRegistryTest::setupBasicModules in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php \Drupal\Tests\Core\Update\UpdateRegistryTest::setupBasicModules()

Sets up some modules with some update functions.

11 calls to UpdateRegistryTest::setupBasicModules()
UpdateRegistryTest::testFilterOutInvokedUpdatesByModule in core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php
@covers ::filterOutInvokedUpdatesByModule
UpdateRegistryTest::testGetModuleUpdateFunctions in core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php
@covers ::getModuleUpdateFunctions
UpdateRegistryTest::testGetPendingUpdateFunctionsExistingUpdates in core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php
@covers ::getPendingUpdateFunctions
UpdateRegistryTest::testGetPendingUpdateFunctionsNoExistingUpdates in core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php
@covers ::getPendingUpdateFunctions
UpdateRegistryTest::testGetPendingUpdateFunctionsWithLoadedModulesButNotEnabled in core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php
@covers ::getPendingUpdateFunctions

... See full list

File

core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php, line 37

Class

UpdateRegistryTest
@coversDefaultClass \Drupal\Core\Update\UpdateRegistry @group Update

Namespace

Drupal\Tests\Core\Update

Code

protected function setupBasicModules() {
  $info_a = <<<'EOS'
type: module
name: Module A
core_version_requirement: '*'
EOS;
  $info_b = <<<'EOS'
type: module
name: Module B
core_version_requirement: '*'
EOS;
  $info_c = <<<'EOS'
type: module
name: Module C
core_version_requirement: '*'
EOS;
  $module_a = <<<'EOS'
<?php

/**
 * Module A update B.
 */
function module_a_post_update_b() {
}

/**
 * Module A update A.
 */
function module_a_post_update_a() {
}

EOS;
  $module_b = <<<'EOS'
<?php

/**
 * Module B update A.
 */
function module_b_post_update_a() {
}

/**
 * Implements hook_removed_post_updates().
 */
function module_b_removed_post_updates() {
  return [
    'module_b_post_update_b' => '8.9.0',
    'module_b_post_update_c' => '8.9.0',
  ];
}

EOS;
  $module_c = <<<'EOS'
<?php

/**
 * Module C update A.
 */
function module_c_post_update_a() {
}

/**
 * Module C update B.
 */
function module_c_post_update_b() {
}

/**
 * Implements hook_removed_post_updates().
 */
function module_c_removed_post_updates() {
  return [
    'module_c_post_update_b' => '8.9.0',
    'module_c_post_update_c' => '8.9.0',
  ];
}

EOS;
  vfsStream::setup('drupal');
  vfsStream::create([
    'sites' => [
      'default' => [
        'modules' => [
          'module_a' => [
            'module_a.post_update.php' => $module_a,
            'module_a.info.yml' => $info_a,
          ],
          'module_b' => [
            'module_b.post_update.php' => $module_b,
            'module_b.info.yml' => $info_b,
          ],
          'module_c' => [
            'module_c.post_update.php' => $module_c,
            'module_c.info.yml' => $info_c,
          ],
        ],
      ],
    ],
  ]);
}