Skip to content
Snippets Groups Projects
Verified Commit ea6a45ed authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3439836 by pooja_sharma, thebumik, FeyP, vensires, smustgrave,...

Issue #3439836 by pooja_sharma, thebumik, FeyP, vensires, smustgrave, kim.pepper, quietone: Fix File tests that rely on UID1's super user behavior

(cherry picked from commit 35dbb2d4)
parent 963de909
Branches
Tags
5 merge requests!122353526426-warning-for-missing,!11958Issue #3490507 by alexpott, smustgrave: Fix bogus mocking in...,!11769Issue #3517987: Add option to contextual filters to encode slashes in query parameter.,!11185Issue #3477324 by andypost, alexpott: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4,!9944Issue #3483353: Consider making the createCopy config action optionally fail...
Pipeline #237423 passed
Pipeline: drupal

#237426

    ......@@ -5,6 +5,7 @@
    namespace Drupal\Tests\file\Kernel;
    use Drupal\file\Entity\File;
    use Drupal\Tests\user\Traits\UserCreationTrait;
    /**
    * File saving tests.
    ......@@ -13,18 +14,13 @@
    */
    class SaveTest extends FileManagedUnitTestBase {
    /**
    * {@inheritdoc}
    *
    * @todo Remove and fix test to not rely on super user.
    * @see https://www.drupal.org/project/drupal/issues/3437620
    */
    protected bool $usesSuperUserAccessPolicy = TRUE;
    use UserCreationTrait;
    public function testFileSave(): void {
    $account = $this->createUser();
    // Create a new file entity.
    $file = File::create([
    'uid' => 1,
    'uid' => $account->id(),
    'filename' => 'druplicon.txt',
    'uri' => 'public://druplicon.txt',
    'filemime' => 'text/plain',
    ......@@ -67,7 +63,7 @@ public function testFileSave(): void {
    // Try to insert a second file with the same name apart from case insensitivity
    // to ensure the 'uri' index allows for filenames with different cases.
    $uppercase_values = [
    'uid' => 1,
    'uid' => $account->id(),
    'filename' => 'DRUPLICON.txt',
    'uri' => 'public://DRUPLICON.txt',
    'filemime' => 'text/plain',
    ......@@ -96,7 +92,7 @@ public function testFileSave(): void {
    // Save a file with zero bytes.
    $file = File::create([
    'uid' => 1,
    'uid' => $account->id(),
    'filename' => 'no-druplicon.txt',
    'uri' => 'public://no-druplicon.txt',
    'filemime' => 'text/plain',
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment