You are here

protected function AssertUtilsTrait::assertScaffoldedFile in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/AssertUtilsTrait.php \Drupal\Tests\Composer\Plugin\Scaffold\AssertUtilsTrait::assertScaffoldedFile()
  2. 9 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.

7 calls to AssertUtilsTrait::assertScaffoldedFile()
ComposerHookTest::testComposerHooks in core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ComposerHookTest.php
Tests to see if scaffold operation runs at the correct times.
ManageGitIgnoreTest::testAppendToEmptySettingsIsUnmanaged in core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php
Tests appending to an unmanaged file, and confirm it is not .gitignored.
ManageGitIgnoreTest::testManageGitIgnore in core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php
Tests scaffold command correctly manages the .gitignore file.
ScaffoldTest::assertCommonDrupalAssetsWereScaffolded in core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php
Asserts that the scaffold files from drupal/assets are placed as expected.
ScaffoldTest::assertDefaultSettingsFromScaffoldOverride in core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php
Asserts that the default settings file was overridden by the test.

... See full list

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));
}