Unverified Commit 8ee22c46 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3455183 by kim.pepper, mstrelan, xjm, mondrake: FileSaveUploadTest...

Issue #3455183 by kim.pepper, mstrelan, xjm, mondrake: FileSaveUploadTest should not write to the app root

(cherry picked from commit 76c2d39a)
parent ff046030
Loading
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@

use Drupal\Core\Messenger\MessengerInterface;
use Drupal\KernelTests\KernelTestBase;
use org\bovigo\vfs\vfsStream;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -32,14 +33,17 @@ class FileSaveUploadTest extends KernelTestBase {
   * {@inheritdoc}
   */
  protected function setUp(): void {
    \file_put_contents('test.bbb', 'test');

    parent::setUp();
    $filename = 'test.bbb';
    vfsStream::newFile($filename)
      ->at($this->vfsRoot)
      ->withContent('test');

    $request = new Request();
    $request->files->set('files', [
      'file' => new UploadedFile(
        path: 'test.bbb',
        originalName: 'test.bbb',
        path: vfsStream::url("root/$filename"),
        originalName: $filename,
        mimeType: 'text/plain',
        error: \UPLOAD_ERR_OK,
        test: TRUE