function GitExcluderTest::testGitDirectoriesExcludedActive

Tests that Git directories are excluded from stage during PreCreate.

File

core/modules/package_manager/tests/src/Kernel/PathExcluder/GitExcluderTest.php, line 64

Class

GitExcluderTest
@covers \Drupal\package_manager\PathExcluder\GitExcluder[[api-linebreak]] @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel\PathExcluder

Code

public function testGitDirectoriesExcludedActive() : void {
  // Ensure we have an up-to-date container.
  $this->container = $this->container
    ->get('kernel')
    ->rebuildContainer();
  $stage = $this->createStage();
  $stage->create();
  /** @var \Drupal\package_manager_bypass\LoggingBeginner $beginner */
  $beginner = $this->container
    ->get(BeginnerInterface::class);
  $beginner_args = $beginner->getInvocationArguments();
  $excluded_paths = [
    '.git',
    'modules/module_not_known_to_composer_in_active/.git',
    'modules/example/.git',
  ];
  foreach ($excluded_paths as $excluded_path) {
    $this->assertContains($excluded_path, $beginner_args[0][2]);
  }
  $not_excluded_paths = [
    'modules/contrib/package_known_to_composer_removed_later/.git',
    'modules/custom/custom_package_known_to_composer/.git',
    'different_installer_path/package_known_to_composer/.git',
  ];
  foreach ($not_excluded_paths as $not_excluded_path) {
    $this->assertNotContains($not_excluded_path, $beginner_args[0][2]);
  }
}

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