function RegistryTest::testPostProcessExtension

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Theme/RegistryTest.php \Drupal\Tests\Core\Theme\RegistryTest::testPostProcessExtension()
  2. 8.9.x core/tests/Drupal/Tests/Core/Theme/RegistryTest.php \Drupal\Tests\Core\Theme\RegistryTest::testPostProcessExtension()
  3. 10 core/tests/Drupal/Tests/Core/Theme/RegistryTest.php \Drupal\Tests\Core\Theme\RegistryTest::testPostProcessExtension()

@covers ::postProcessExtension @covers ::completeSuggestion @covers ::mergePreprocessFunctions

@dataProvider providerTestPostProcessExtension

Parameters

array $defined_functions: An array of functions to be used in place of get_defined_functions().

array $hooks: An array of theme hooks to process.

array $expected: The expected results.

File

core/tests/Drupal/Tests/Core/Theme/RegistryTest.php, line 208

Class

RegistryTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Theme%21Registry.php/class/Registry/11.x" title="Defines the theme registry service." class="local">\Drupal\Core\Theme\Registry</a> @group Theme

Namespace

Drupal\Tests\Core\Theme

Code

public function testPostProcessExtension($defined_functions, $hooks, $expected) : void {
    static::$functions['user'] = $defined_functions;
    $theme = $this->prophesize(ActiveTheme::class);
    $theme->getBaseThemeExtensions()
        ->willReturn([]);
    $theme->getName()
        ->willReturn('test');
    $theme->getEngine()
        ->willReturn('twig');
    $this->moduleHandler
        ->expects($this->atLeastOnce())
        ->method('getModuleList')
        ->willReturn([]);
    $class = new \ReflectionClass(Registry::class);
    $reflection_method = $class->getMethod('postProcessExtension');
    $reflection_method->invokeArgs($this->registry, [
        &$hooks,
        $theme->reveal(),
    ]);
    $this->assertEquals($expected, $hooks);
}

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