ConfigFilesValidationTest.php
View source
<?php
namespace Drupal\Tests\examples\Unit;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\Yaml\Yaml;
class ConfigFilesValidationTest extends UnitTestCase {
use FilesTestTrait;
use RetrieveConfigFilesTrait;
public static function providerConfigFiles() : array {
$data = [];
$directory = self::projectPathname('modules');
return self::retrieveFiles($directory, 'yml', self::configFilesCallback(...));
}
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.");
}
}