Commit 794bea68 authored by catch's avatar catch
Browse files

Issue #3414499 by Spokje, smustgrave: Convert NodeTemplateSuggestionsTest into a Kernel test

(cherry picked from commit 57d7fba7)
parent 48b93f6f
Loading
Loading
Loading
Loading
Loading
+28 −6
Original line number Diff line number Diff line
<?php

namespace Drupal\Tests\node\Functional;
namespace Drupal\Tests\node\Kernel;

use Drupal\KernelTests\KernelTestBase;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\node\Traits\NodeCreationTrait;

/**
 * Tests node template suggestions.
 *
 * @group node
 */
class NodeTemplateSuggestionsTest extends NodeTestBase {
class NodeTemplateSuggestionsTest extends KernelTestBase {

  use NodeCreationTrait;

  /**
   * {@inheritdoc}
   * Modules to enable.
   *
   * @var array
   */
  protected $defaultTheme = 'stark';
  protected static $modules = [
    'node',
    'user',
    'system',
  ];

  /**
   * Tests if template_preprocess_node() generates the correct suggestions.
   */
  public function testNodeThemeHookSuggestions() {
  public function testNodeThemeHookSuggestions(): void {
    $this->installEntitySchema('user');
    $this->installEntitySchema('node');

    $this->installConfig(['system']);

    NodeType::create([
      'type' => 'page',
      'name' => 'Page',
    ])->save();

    // Create node to be rendered.
    $node = $this->drupalCreateNode();
    $node = $this->createNode();
    $view_mode = 'full';

    // Simulate theming of the node.