function PrivateFileOnTranslatedEntityTest::setUp
Same name in other branches
- 9 core/modules/file/tests/src/Functional/PrivateFileOnTranslatedEntityTest.php \Drupal\Tests\file\Functional\PrivateFileOnTranslatedEntityTest::setUp()
- 8.9.x core/modules/file/tests/src/Functional/PrivateFileOnTranslatedEntityTest.php \Drupal\Tests\file\Functional\PrivateFileOnTranslatedEntityTest::setUp()
- 11.x core/modules/file/tests/src/Functional/PrivateFileOnTranslatedEntityTest.php \Drupal\Tests\file\Functional\PrivateFileOnTranslatedEntityTest::setUp()
Overrides FileFieldTestBase::setUp
File
-
core/
modules/ file/ tests/ src/ Functional/ PrivateFileOnTranslatedEntityTest.php, line 40
Class
- PrivateFileOnTranslatedEntityTest
- Uploads private files to translated node and checks access.
Namespace
Drupal\Tests\file\FunctionalCode
protected function setUp() : void {
parent::setUp();
// Create the "Basic page" node type.
$this->drupalCreateContentType([
'type' => 'page',
'name' => 'Basic page',
]);
// Create a file field on the "Basic page" node type.
$this->fieldName = $this->randomMachineName();
$this->createFileField($this->fieldName, 'node', 'page', [
'uri_scheme' => 'private',
]);
// Create and log in user.
$permissions = [
'access administration pages',
'administer content translation',
'administer content types',
'administer languages',
'create content translations',
'create page content',
'edit any page content',
'translate any entity',
];
$admin_user = $this->drupalCreateUser($permissions);
$this->drupalLogin($admin_user);
// Add a second language.
static::createLanguageFromLangcode('fr');
// Enable translation for "Basic page" nodes.
static::enableContentTranslation('node', 'page');
static::setFieldTranslatable('node', 'page', $this->fieldName, TRUE);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.