GenericTestExistsTest.php

Same filename and directory in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Extension/GenericTestExistsTest.php
  2. 10 core/tests/Drupal/Tests/Core/Extension/GenericTestExistsTest.php

Namespace

Drupal\Tests\Core\Extension

File

core/tests/Drupal/Tests/Core/Extension/GenericTestExistsTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\Core\Extension;

use Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait;
use Drupal\Tests\UnitTestCase;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;

/**
 * Tests that the Generic module test exists for all modules.
 */
class GenericTestExistsTest extends UnitTestCase {
  use FileSystemModuleDiscoveryDataProviderTrait;
  
  /**
   * Lists module that do not require a Generic test.
   *
   * @var string[]
   */
  protected $modulesNoTest = [
    'help_topics',
    'sdc',
  ];
  
  /**
   * Tests that the Generic module test exists for all modules.
   */
  public function testGenericTestExists(string $module_name) : void {
    if (in_array($module_name, $this->modulesNoTest, TRUE)) {
      $this->markTestSkipped();
    }
    $this->assertFileExists("{$this->root}/core/modules/{$module_name}/tests/src/Functional/GenericTest.php");
  }

}

Classes

Title Deprecated Summary
GenericTestExistsTest Tests that the Generic module test exists for all modules.

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