function AssertUtilsTrait::assertScaffoldedFile

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Composer/Plugin/Scaffold/AssertUtilsTrait.php \Drupal\Tests\Composer\Plugin\Scaffold\AssertUtilsTrait::assertScaffoldedFile()
  2. 10 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/AssertUtilsTrait.php \Drupal\Tests\Composer\Plugin\Scaffold\AssertUtilsTrait::assertScaffoldedFile()

Asserts that a given file exists and is/is not a symlink.

Parameters

string $path: The path to check exists.

bool $is_link: Checks if the file should be a symlink or not.

string $contents_contains: Regex to check the file contents.

File

core/tests/Drupal/Tests/Composer/Plugin/Scaffold/AssertUtilsTrait.php, line 23

Class

AssertUtilsTrait
Convenience class for creating fixtures.

Namespace

Drupal\Tests\Composer\Plugin\Scaffold

Code

protected function assertScaffoldedFile($path, $is_link, $contents_contains) {
  $this->assertFileExists($path);
  $contents = file_get_contents($path);
  $this->assertStringContainsString($contents_contains, basename($path) . ': ' . $contents);
  $this->assertSame($is_link, is_link($path));
}

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