summaryrefslogtreecommitdiffstatshomepage
path: root/core/tests/Drupal/BuildTests/Composer/ComposerValidateTest.php
blob: 661d159bf80650fa506086891595d5dbec165ba7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php

declare(strict_types=1);

namespace Drupal\BuildTests\Composer;

use Drupal\BuildTests\Framework\BuildTestBase;
use Drupal\Tests\Composer\ComposerIntegrationTrait;

/**
 * @group Composer
 */
class ComposerValidateTest extends BuildTestBase {

  use ComposerIntegrationTrait;

  public static function provideComposerJson() {
    $data = [];
    $composer_json_finder = self::getComposerJsonFinder(self::getDrupalRootStatic());
    foreach ($composer_json_finder->getIterator() as $composer_json) {
      $data[] = [$composer_json->getPathname()];
    }
    return $data;
  }

  /**
   * @dataProvider provideComposerJson
   */
  public function testValidateComposer($path): void {
    $this->executeCommand('composer validate --strict --no-check-all ' . $path);
    $this->assertCommandSuccessful();
  }

}