function ManagedFileFidValidationTest::testOtherUserCannotAccessOwnerFile

Same name and namespace in other branches
  1. 11.x core/modules/file/tests/src/Functional/ManagedFileFidValidationTest.php \Drupal\Tests\file\Functional\ManagedFileFidValidationTest::testOtherUserCannotAccessOwnerFile()

Tests that another user cannot access the owner's temporary file.

File

core/modules/file/tests/src/Functional/ManagedFileFidValidationTest.php, line 73

Class

ManagedFileFidValidationTest
Tests the file validation in the ManagedFile element for private files.

Namespace

Drupal\Tests\file\Functional

Code

public function testOtherUserCannotAccessOwnerFile() : void {
  $this->assertFalse($this->ownerFile
    ->access('download', $this->anotherUser));
  $this->assertEquals($this->fileOwner
    ->id(), $this->ownerFile
    ->getOwnerId());
  $this->assertTrue($this->ownerFile
    ->isTemporary());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.