function UpdateRegistryTest::setupBasicExtensions

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

Sets up some extensions with some update functions.

11 calls to UpdateRegistryTest::setupBasicExtensions()
UpdateRegistryTest::testFilterOutInvokedUpdatesByExtension in core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php
@covers ::filterOutInvokedUpdatesByExtension[[api-linebreak]]
UpdateRegistryTest::testGetPendingUpdateFunctionsExistingUpdates in core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php
@covers ::getPendingUpdateFunctions[[api-linebreak]]
UpdateRegistryTest::testGetPendingUpdateFunctionsNoExistingUpdates in core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php
@covers ::getPendingUpdateFunctions[[api-linebreak]]
UpdateRegistryTest::testGetPendingUpdateFunctionsWithLoadedModulesButNotEnabled in core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php
@covers ::getPendingUpdateFunctions[[api-linebreak]]
UpdateRegistryTest::testGetPendingUpdateInformation in core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php
@covers ::getPendingUpdateInformation[[api-linebreak]]

... See full list

File

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

Class

UpdateRegistryTest
@coversDefaultClass \Drupal\Core\Update\UpdateRegistry[[api-linebreak]] @group Update

Namespace

Drupal\Tests\Core\Update

Code

protected function setupBasicExtensions() {
  $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;
  $info_d = <<<'EOS'
  type: theme
  name: Theme D
  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;
  $theme_d = <<<'EOS'
  <?php
  
  /**
   * Theme D update B.
   */
  function theme_d_post_update_b() {
  }
  
  /**
   * Theme D update C.
   */
  function theme_d_post_update_c() {
  }
  
  /**
   * Implements hook_removed_post_updates().
   */
  function theme_d_removed_post_updates() {
    return [
      'theme_d_post_update_a' => '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,
          ],
        ],
        'themes' => [
          'theme_d' => [
            'theme_d.post_update.php' => $theme_d,
            'theme_d.info.yml' => $info_d,
          ],
        ],
      ],
    ],
  ]);
}

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