Unverified Commit e93d83ae authored by Alex Pott's avatar Alex Pott
Browse files

task: #3590435 Backport changes to DrupalTestCaseTrait and related classes from 12.x to 11.x

By: kingdutch
By: mondrake
parent 35249448
Loading
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -90,13 +90,6 @@ trait TestSetupTrait {
   */
  protected $databasePrefix;

  /**
   * The app root.
   *
   * @var string
   */
  protected $root;

  /**
   * The temporary file directory for the test environment.
   *
+1 −1
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
Original line number Diff line number Diff line
@@ -89,6 +89,8 @@ public function testSuccessfulCopies(): void {
   */
  #[DataProvider('providerSuccessfulReuse')]
  public function testSuccessfulReuse($source_path, $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($source_path, $destination_path): void {
  public static function providerSuccessfulReuse() {
    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
Original line number Diff line number Diff line
@@ -342,7 +342,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
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([]);
  }

Loading