You are here

KernelTestBase.php in XML sitemap 2.x

Same filename and directory in other branches
  1. 8 tests/src/Kernel/KernelTestBase.php

File

tests/src/Kernel/KernelTestBase.php
View source
<?php

namespace Drupal\Tests\xmlsitemap\Kernel;

use Drupal\KernelTests\KernelTestBase as CoreKernelTestBase;

/**
 * Base class for xmlsitemap kernel tests.
 */
abstract class KernelTestBase extends CoreKernelTestBase {

  /**
   * {@inheritdoc}
   */
  public static $modules = [
    'system',
    'xmlsitemap',
  ];

  /**
   * {@inheritdoc}
   */
  public static function setUpBeforeClass() {
    parent::setUpBeforeClass();

    // This is required to not fail the @covers for global functions.
    // @todo Once xmlsitemap_clear_directory() is refactored to auto-loadable code, remove this require statement.
    require_once __DIR__ . '/../../../xmlsitemap.module';
  }

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();
    $this
      ->installConfig([
      'xmlsitemap',
    ]);
    $this
      ->installSchema('xmlsitemap', [
      'xmlsitemap',
    ]);

    // Install hooks are not run with kernel tests.
    xmlsitemap_install();
    $this
      ->assertDirectoryExists('public://xmlsitemap');
  }

}

Classes

Namesort descending Description
KernelTestBase Base class for xmlsitemap kernel tests.