class CoreRecipesTest

Same name in this branch
  1. 11.x core/tests/Drupal/FunctionalTests/Core/Recipe/CoreRecipesTest.php \Drupal\FunctionalTests\Core\Recipe\CoreRecipesTest
Same name and namespace in other branches
  1. 10 core/tests/Drupal/FunctionalTests/Core/Recipe/CoreRecipesTest.php \Drupal\FunctionalTests\Core\Recipe\CoreRecipesTest

Tests that all core recipes have a generic test.

@group Recipe

Hierarchy

Expanded class hierarchy of CoreRecipesTest

File

core/tests/Drupal/Tests/Core/Recipe/CoreRecipesTest.php, line 15

Namespace

Drupal\Tests\Core\Recipe
View source
class CoreRecipesTest extends UnitTestCase {
  
  /**
   * Data provider for ::testRecipeHasGenericTest().
   *
   * @return iterable<array<string>>
   *   An iterable containing paths to recipe files.
   */
  public static function providerRecipeHasGenericTest() : iterable {
    $finder = Finder::create()->in([
      dirname(__DIR__, 5) . '/recipes',
    ])
      ->directories()
      ->depth(0)
      ->notName([
      'example',
    ]);
    static::assertGreaterThan(0, count($finder), 'No core recipes were found.');
    $scenarios = [];
    /** @var \Symfony\Component\Finder\SplFileInfo $recipe */
    foreach ($finder as $recipe) {
      $name = $recipe->getBasename();
      $scenarios[$name] = [
        $recipe->getPathname(),
      ];
    }
    return $scenarios;
  }
  
  /**
   * Test that a recipe has a generic test.
   *
   * @param string $path
   *   The path to the recipe file.
   *
   * @dataProvider providerRecipeHasGenericTest
   */
  public function testRecipeHasGenericTest(string $path) : void {
    $this->assertFileExists($path . '/tests/src/Functional/GenericTest.php');
  }

}

Members

Title Sort descending Modifiers Object type Summary Overrides
CoreRecipesTest::providerRecipeHasGenericTest public static function Data provider for ::testRecipeHasGenericTest().
CoreRecipesTest::testRecipeHasGenericTest public function Test that a recipe has a generic test.
ExpectDeprecationTrait::expectDeprecation public function Adds an expected deprecation.
ExpectDeprecationTrait::setUpErrorHandler public function Sets up the test error handler.
ExpectDeprecationTrait::tearDownErrorHandler public function Tears down the test error handler.
RandomGeneratorTrait::getRandomGenerator protected function Gets the random generator for the utility methods.
RandomGeneratorTrait::randomMachineName protected function Generates a unique random string containing letters and numbers.
RandomGeneratorTrait::randomObject public function Generates a random PHP object.
RandomGeneratorTrait::randomString public function Generates a pseudo-random string of ASCII characters of codes 32 to 126.
UnitTestCase::$root protected property The app root.
UnitTestCase::getClassResolverStub protected function Returns a stub class resolver.
UnitTestCase::getConfigFactoryStub public function Returns a stub config factory that behaves according to the passed array.
UnitTestCase::getContainerWithCacheTagsInvalidator protected function Sets up a container with a cache tags invalidator.
UnitTestCase::getStringTranslationStub public function Returns a stub translation manager that just returns the passed string.
UnitTestCase::setDebugDumpHandler public static function Registers the dumper CLI handler when the DebugDump extension is enabled.
UnitTestCase::setUp protected function 374

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