YamlValidationTest::provideYamls() returns .yml files that are not part of the Examples project

Created on 1 July 2024, 10 months ago
Updated 16 July 2024, 9 months ago

Drupal\Tests\examples\Unit\YamlValidationTest contains the following code.

$examples_project_path = realpath(__DIR__ . '/../../..');

$paths = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($examples_project_path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS));
foreach ($paths as $path) {
  $pathname = $path->getPathname();
  if (strpos($pathname, '.yml') !== FALSE) {
    if (strpos($pathname, '/config/') !== FALSE) {
      $yaml_paths[] = [$pathname];
    }
  }
}

It should retrieve only the files that are part of this project, but it retrieves also files contained in directories added by GitLab CI when its pipelines are executed. That is why the project tests fail with the following errors.

YAML in this file contains a uuid key:
/builds/project/examples/web/core/profiles/standard/config/install/system.site.yml
Failed asserting that an array does not have the key 'uuid'.

 

YAML in this file contains a uuid key:
/builds/project/examples/web/core/modules/config/tests/config_test/config/install/config_test.validation.yml
Failed asserting that an array does not have the key 'uuid'.

 
It also retrieves files that are not YAML files, as shown by error messages like the following ones.

2) Drupal\Tests\examples\Unit\YamlValidationTest::testNoUuidsInConfig with
data set #1102 ('/builds/project/examples/vend...l.twig')
 Symfony\Component\Yaml\Exception\ParseException: Malformed inline YAML
string: "{{machine_name }}" at line 1 (near "{{ machine_name }}.{{
entity_type_id }}_type.*:").

 

3) Drupal\Tests\examples\Unit\YamlValidationTest::testNoUuidsInConfig with
data set #1104 ('/builds/project/examples/vend...l.twig')
Symfony\Component\Yaml\Exception\ParseException: Malformed inline YAML
string: "{{machine_name }}" at line 5 (near "- {{ machine_name }}").

 
 

🐛 Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

🇮🇹Italy apaderno Brescia, 🇮🇹

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024