class ConfigFilesValidationTest
Verifies the configuration files are valid.
Configuration files are considered valid if they do not contain an uuid key.
@group examples
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\RandomGeneratorTrait
- class \Drupal\Tests\examples\Unit\ConfigFilesValidationTest extends \Drupal\Tests\UnitTestCase uses \Drupal\Tests\examples\Unit\FilesTestTrait, \Drupal\Tests\examples\Unit\RetrieveConfigFilesTrait
Expanded class hierarchy of ConfigFilesValidationTest
File
-
tests/
src/ Unit/ ConfigFilesValidationTest.php, line 15
Namespace
Drupal\Tests\examples\UnitView source
class ConfigFilesValidationTest extends UnitTestCase {
use FilesTestTrait;
use RetrieveConfigFilesTrait;
/**
* Provides test data for testNoUuidInConfig().
*
* @return array
* The test data.
*/
public static function providerConfigFiles() : array {
$data = [];
$directory = self::projectPathname('modules');
return self::retrieveFiles($directory, 'yml', self::configFilesCallback(...));
}
/**
* Tests that the configuration files do not contain any uuid key.
*
* @dataProvider providerConfigFiles
*/
public function testNoUuidInConfig(string $filename, string $path, string $pathname) : void {
$yaml = Yaml::parse(file_get_contents($pathname));
$this->assertArrayNotHasKey('uuid', $yaml, "{$filename} in {$path} contains an uuid key.");
}
}
Members
Title Sort descending | Deprecated | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|---|
ConfigFilesValidationTest::providerConfigFiles | public static | function | Provides test data for testNoUuidInConfig(). | ||
ConfigFilesValidationTest::testNoUuidInConfig | public | function | Tests that the configuration files do not contain any uuid key. | ||
FilesTestTrait::projectPathname | protected static | function | Gets the absolute pathname for a project directory. | ||
FilesTestTrait::retrieveFiles | protected static | function | Retrieves files in a project directory. | ||
PhpUnitWarnings::$deprecationWarnings | private static | property | Deprecation warnings from PHPUnit to raise with @trigger_error(). | ||
PhpUnitWarnings::addWarning | public | function | Converts PHPUnit deprecation warnings to E_USER_DEPRECATED. | ||
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. | ||
RandomGeneratorTrait::randomStringValidate | Deprecated | public | function | Callback for random string validation. | |
RetrieveConfigFilesTrait::configFilesCallback | protected static | function | Callback to filter Drupal configuration files. | ||
UnitTestCase::$root | protected | property | The app root. | 1 | |
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::getConfigStorageStub | public | function | Returns a stub config storage that returns the supplied configuration. | ||
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::setUp | protected | function | 358 | ||
UnitTestCase::setUpBeforeClass | public static | function | |||
UnitTestCase::__get | public | function |