Commit 5b37bdb1 authored by catch's avatar catch
Browse files

Issue #3376271 by quietone, Spokje, smustgrave: Move non-migration...

Issue #3376271 by quietone, Spokje, smustgrave: Move non-migration book-related tests to the Book module

(cherry picked from commit 30512d2e)
parent 78fbdef2
Loading
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ class BlockConfigSchemaTest extends KernelTestBase {
   */
  protected static $modules = [
    'block',
    'book',
    'block_content',
    'comment',
    'node',
@@ -56,7 +55,6 @@ protected function setUp(): void {
    $this->installEntitySchema('block_content');
    $this->installEntitySchema('taxonomy_term');
    $this->installEntitySchema('node');
    $this->installSchema('book', ['book']);
    $this->container->get('theme_installer')->install(['stark']);
  }

+2 −2
Original line number Diff line number Diff line
<?php

namespace Drupal\Tests\comment\Functional;
namespace Drupal\Tests\book\Functional\Comment;

use Drupal\comment\CommentInterface;
use Drupal\comment\Tests\CommentTestTrait;
@@ -11,7 +11,7 @@
/**
 * Tests visibility of comments on book pages.
 *
 * @group comment
 * @group book
 */
class CommentBookTest extends BrowserTestBase {

+75 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\Tests\book\Kernel\Block;

use Drupal\block\Entity\Block;
use Drupal\Tests\SchemaCheckTestTrait;
use Drupal\KernelTests\KernelTestBase;

/**
 * Tests the block config schema.
 *
 * @group book
 */
class BlockConfigSchemaTest extends KernelTestBase {

  use SchemaCheckTestTrait;

  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'block',
    'book',
    'node',
    // \Drupal\block\Entity\Block->preSave() calls system_region_list().
    'system',
    'user',
  ];

  /**
   * The typed config manager.
   *
   * @var \Drupal\Core\Config\TypedConfigManagerInterface
   */
  protected $typedConfig;

  /**
   * {@inheritdoc}
   */
  protected function setUp(): void {
    parent::setUp();

    $this->typedConfig = \Drupal::service('config.typed');
    $this->installEntitySchema('node');
    $this->installSchema('book', ['book']);
    $this->container->get('theme_installer')->install(['stark']);
  }

  /**
   * Tests the block config schema for block plugins.
   */
  public function testBlockConfigSchema() {
    $id = strtolower($this->randomMachineName());
    $block = Block::create([
      'id' => $id,
      'theme' => 'stark',
      'weight' => 00,
      'status' => TRUE,
      'region' => 'content',
      'plugin' => 'book_navigation',
      'settings' => [
        'label' => $this->randomMachineName(),
        'provider' => 'system',
        'label_display' => FALSE,
      ],
      'visibility' => [],
    ]);
    $block->save();

    $config = $this->config("block.block.$id");
    $this->assertEquals($id, $config->get('id'));
    $this->assertConfigSchema($this->typedConfig, $config->getName(), $config->get());
  }

}
+0 −1
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ class HandlerAllTest extends ViewTestBase {
   * @var array
   */
  protected static $modules = [
    'book',
    'block',
    'comment',
    'contact',
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ public function testConfigSchema() {

    // Optional configuration.
    \Drupal::service('module_installer')->install(
      ['search', 'image', 'book', 'help', 'node']
      ['search', 'image', 'help', 'node']
    );
    $this->rebuildAll();
    $this->drupalLogin(