Unverified Commit 0673bf3e authored by Alex Pott's avatar Alex Pott
Browse files

task: #3589047 Deprecate TestRequirementsTrait::getDrupalRoot()

By: mondrake
parent e6945765
Loading
Loading
Loading
Loading
Loading
+1 −1
Changes for core/modules/media/tests/src/Kernel/OEmbedSourceTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ public function testThumbnailUri(string $remote_thumbnail_url, array $thumbnail_
    // The source plugin will try to fetch the remote thumbnail, so mock the
    // HTTP client to ensure that request returns a response with some valid
    // image data.
    $data = Utils::tryFopen($this->getDrupalRoot() . '/core/misc/druplicon.png', 'r');
    $data = Utils::tryFopen($this->root . '/core/misc/druplicon.png', 'r');
    $response = new Response(200, $thumbnail_headers, Utils::streamFor($data));
    $handler = new MockHandler([$response]);
    $client = new Client([
+3 −1
Changes for core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -89,6 +89,8 @@ public function testSuccessfulCopies(): void {
   */
  #[DataProvider('providerSuccessfulReuse')]
  public function testSuccessfulReuse(string $source_path, string $destination_path): void {
    $source_path = str_replace('{%root%}', $this->root, $source_path);

    $file_reuse = $this->doTransform($source_path, $destination_path);
    clearstatcache(TRUE, $destination_path);

@@ -116,7 +118,7 @@ public function testSuccessfulReuse(string $source_path, string $destination_pat
  public static function providerSuccessfulReuse(): array {
    return [
      [
        'source_path' => static::getDrupalRoot() . '/core/tests/fixtures/files/image-test.jpg',
        'source_path' => '{%root%}/core/tests/fixtures/files/image-test.jpg',
        'destination_path' => 'public://file1.jpg',
      ],
      [
+1 −1
Changes for core/modules/package_manager/tests/src/Build/TemplateProjectTestBase.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -345,7 +345,7 @@ protected function createTestProject(string $template): void {

    // Ensure Package Manager logs Composer Stager's process output to a file
    // named for the current test.
    $log = $this->getDrupalRoot() . '/sites/simpletest/browser_output';
    $log = $this->root . '/sites/simpletest/browser_output';
    @mkdir($log, recursive: TRUE);
    $this->assertDirectoryIsWritable($log);
    $log .= '/' . str_replace('\\', '_', static::class) . '-' . $this->name();
+2 −2
Changes for core/modules/package_manager/tests/src/Kernel/SymlinkValidatorTest.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ public function testSymlinksWithinSamePackage(): void {

    // Switch back to the Drupal root to ensure that the check isn't affected
    // by which directory we happen to be in.
    chdir($this->getDrupalRoot());
    chdir($this->root);
    $this->assertStatusCheckResults([]);
  }

@@ -159,7 +159,7 @@ public function testSymlinkToDirectory(): void {

    // Switch back to the Drupal root to ensure that the check isn't affected
    // by which directory we happen to be in.
    chdir($this->getDrupalRoot());
    chdir($this->root);
    $this->assertStatusCheckResults([]);
  }

+4 −4
Changes for core/tests/Drupal/FunctionalTests/Core/Recipe/RecipeCommandTest.php: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ private function assertCheckpointsExist(array $expected_labels): void {
  }

  public function testPassInput(): void {
    $dir = $this->getDrupalRoot() . '/core/tests/fixtures/recipes/input_test';
    $dir = $this->root . '/core/tests/fixtures/recipes/input_test';
    $this->applyRecipe($dir, options: [
      '--input=input_test.owner=Test Owner',
    ]);
@@ -131,7 +131,7 @@ public function testPassInput(): void {
  }

  public function testPassInvalidInput(): void {
    $dir = $this->getDrupalRoot() . '/core/tests/fixtures/recipes/input_test';
    $dir = $this->root . '/core/tests/fixtures/recipes/input_test';
    $process = $this->applyRecipe($dir, 1, options: [
      '--input=input_test.owner=hack',
    ]);
@@ -140,12 +140,12 @@ public function testPassInvalidInput(): void {

  public function testDefaultInputValueFromConfig(): void {
    // Test that default values are used when no input is provided
    $this->applyRecipe($this->getDrupalRoot() . '/core/tests/fixtures/recipes/input_test');
    $this->applyRecipe($this->root . '/core/tests/fixtures/recipes/input_test');
    $this->assertSame("Dries Buytaert's Turf", $this->config('system.site')->get('name'));
  }

  public function testListInputs(): void {
    $root = $this->getDrupalRoot();
    $root = $this->root;

    $output = $this->applyRecipe($root . '/core/tests/fixtures/recipes/input_test', command: 'recipe:info')->getOutput();
    $this->assertStringContainsString('input_test.owner', $output);
Loading