class ThemeProceduralTest
Same name and namespace in other branches
- 11.x core/modules/system/tests/src/Functional/Theme/ThemeProceduralTest.php \Drupal\Tests\system\Functional\Theme\ThemeProceduralTest
Tests low-level theme functions.
Attributes
#[Group('Theme')]
#[RunTestsInSeparateProcesses]
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Tests\DrupalTestCaseTrait, \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\system\Functional\Theme\ThemeProceduralTest extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of ThemeProceduralTest
File
-
core/
modules/ system/ tests/ src/ Functional/ Theme/ ThemeProceduralTest.php, line 16
Namespace
Drupal\Tests\system\Functional\ThemeView source
class ThemeProceduralTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'node',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'procedural_hook_theme';
/**
* Ensures preprocess functions run from procedural implementations.
*/
public function testPreprocess() : void {
$node_article_type = NodeType::create([
'type' => 'article',
'name' => 'Article',
]);
$node_article_type->save();
$node_basic_type = NodeType::create([
'type' => 'basic',
'name' => 'Basic',
]);
$node_basic_type->save();
$node = Node::create([
'title' => 'placeholder_title',
'type' => 'article',
'uid' => 1,
]);
$node->save();
$node = Node::create([
'title' => 'placeholder_title',
'type' => 'basic',
'uid' => 1,
]);
$node->save();
$this->drupalGet('node/1');
$items = $this->cssSelect('.title');
$this->assertEquals('Procedural Article Node Preprocess', $items[0]->getText());
$this->drupalGet('node/2');
$items = $this->cssSelect('.title');
$this->assertEquals('Procedural Node Preprocess', $items[0]->getText());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.