You are here

public function ManageGitIgnoreTest::testAppendToEmptySettingsIsUnmanaged in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php \Drupal\Tests\Composer\Plugin\Scaffold\Functional\ManageGitIgnoreTest::testAppendToEmptySettingsIsUnmanaged()
  2. 10 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php \Drupal\Tests\Composer\Plugin\Scaffold\Functional\ManageGitIgnoreTest::testAppendToEmptySettingsIsUnmanaged()

Tests appending to an unmanaged file, and confirm it is not .gitignored.

If we append to an unmanaged (not scaffolded) file, and we are managing .gitignore files, then we expect that the unmanaged file should not be added to the .gitignore file, because unmanaged files should be committed.

File

core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php, line 169

Class

ManageGitIgnoreTest
Tests to see whether .gitignore files are correctly managed.

Namespace

Drupal\Tests\Composer\Plugin\Scaffold\Functional

Code

public function testAppendToEmptySettingsIsUnmanaged() {
  $sut = $this
    ->createSutWithGit('drupal-drupal-append-settings');
  $this
    ->assertFileDoesNotExist($sut . '/autoload.php');
  $this
    ->assertFileDoesNotExist($sut . '/index.php');
  $this
    ->assertFileDoesNotExist($sut . '/sites/.gitignore');

  // Run the scaffold command.
  $this->fixtures
    ->runScaffold($sut);
  $this
    ->assertFileExists($sut . '/autoload.php');
  $this
    ->assertFileExists($sut . '/index.php');
  $this
    ->assertScaffoldedFile($sut . '/sites/.gitignore', FALSE, 'example.sites.php');
  $this
    ->assertScaffoldedFileDoesNotContain($sut . '/sites/.gitignore', 'settings.php');
}