function UpdateRegistryTest::testGetUpdateFunctions

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

@covers ::getUpdateFunctions

File

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

Class

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

Namespace

Drupal\Tests\Core\Update

Code

public function testGetUpdateFunctions() : void {
    $this->setupBasicExtensions();
    $key_value = $this->prophesize(KeyValueStoreInterface::class)
        ->reveal();
    $theme_handler = $this->prophesize(ThemeHandlerInterface::class);
    $theme_handler->listInfo()
        ->willReturn([
        'theme_d' => [
            'type' => 'theme_d',
            'pathname' => 'core/themes/theme_d/theme_d.info.yml',
        ],
    ]);
    $theme_handler = $theme_handler->reveal();
    $update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
        'module_a' => [
            'type' => 'module',
            'pathname' => 'core/modules/module_a/module_a.info.yml',
            'filename' => 'module_a.module',
        ],
        'module_b' => [
            'type' => 'module',
            'pathname' => 'core/modules/module_b/module_b.info.yml',
            'filename' => 'module_b.module',
        ],
    ], $key_value, $theme_handler, 'post_update');
    $this->assertEquals([
        'module_a_post_update_a',
        'module_a_post_update_b',
    ], array_values($update_registry->getUpdateFunctions('module_a')));
    $this->assertEquals([
        'module_b_post_update_a',
    ], array_values($update_registry->getUpdateFunctions('module_b')));
    $this->assertEquals([
        'theme_d_post_update_b',
        'theme_d_post_update_c',
    ], array_values($update_registry->getUpdateFunctions('theme_d')));
}

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