You are here

protected function ModifiedFilesTest::assertModifications in Automatic Updates 8

Assert modified files.

Parameters

string $project_type: The project type.

string $project: The project to assert.

array $modifications: The modified files to assert.

2 calls to ModifiedFilesTest::assertModifications()
ModifiedFilesTest::testContribModified in tests/src/Build/ModifiedFilesTest.php
@covers ::getModifiedFiles @dataProvider contribProjectsProvider
ModifiedFilesTest::testCoreModified in tests/src/Build/ModifiedFilesTest.php
@covers ::getModifiedFiles @dataProvider coreProjectProvider

File

tests/src/Build/ModifiedFilesTest.php, line 111

Class

ModifiedFilesTest
@coversDefaultClass \Drupal\automatic_updates\Services\ModifiedFiles

Namespace

Drupal\Tests\automatic_updates\Build

Code

protected function assertModifications($project_type, $project, array $modifications) {

  // Validate project is not modified.
  $this
    ->visit("/automatic_updates/modified-files/{$project_type}/{$project}");
  $assert = $this
    ->getMink()
    ->assertSession();
  $assert
    ->statusCodeEquals(200);
  $assert
    ->pageTextContains('No modified files!');

  // Assert modifications.
  $this
    ->assertNotEmpty($modifications);
  foreach ($modifications as $modification) {
    $file = $this
      ->getWorkspaceDirectory() . DIRECTORY_SEPARATOR . $modification;
    $this
      ->fileExists($file);
    $this->symfonyFileSystem
      ->appendToFile($file, PHP_EOL . '// file is modified' . PHP_EOL);
  }
  $this
    ->visit("/automatic_updates/modified-files/{$project_type}/{$project}");
  $assert
    ->pageTextContains('Modified files include:');
  foreach ($modifications as $modification) {
    $assert
      ->pageTextContains($modification);
  }
}