function ImageOnTranslatedEntityTest::setUp

Same name in other branches
  1. 9 core/modules/image/tests/src/Functional/ImageOnTranslatedEntityTest.php \Drupal\Tests\image\Functional\ImageOnTranslatedEntityTest::setUp()
  2. 8.9.x core/modules/image/tests/src/Functional/ImageOnTranslatedEntityTest.php \Drupal\Tests\image\Functional\ImageOnTranslatedEntityTest::setUp()
  3. 10 core/modules/image/tests/src/Functional/ImageOnTranslatedEntityTest.php \Drupal\Tests\image\Functional\ImageOnTranslatedEntityTest::setUp()

Overrides ImageFieldTestBase::setUp

File

core/modules/image/tests/src/Functional/ImageOnTranslatedEntityTest.php, line 46

Class

ImageOnTranslatedEntityTest
Uploads images to translated nodes.

Namespace

Drupal\Tests\image\Functional

Code

protected function setUp() : void {
    parent::setUp();
    // This test expects unused managed files to be marked as a temporary file.
    $this->config('file.settings')
        ->set('make_unused_managed_files_temporary', TRUE)
        ->save();
    // Create the "Basic page" node type.
    // @todo Remove the disabling of new revision creation in
    //   https://www.drupal.org/node/1239558.
    $this->drupalCreateContentType([
        'type' => 'basic_page',
        'name' => 'Basic page',
        'new_revision' => FALSE,
    ]);
    // Create an image field on the "Basic page" node type.
    $this->fieldName = $this->randomMachineName();
    $this->createImageField($this->fieldName, 'node', 'basic_page', [], [
        'title_field' => 1,
    ]);
    // Create and log in user.
    $permissions = [
        'access administration pages',
        'administer content translation',
        'administer content types',
        'administer languages',
        'administer node fields',
        'create content translations',
        'create basic_page content',
        'edit any basic_page content',
        'translate any entity',
        'delete any basic_page content',
    ];
    $admin_user = $this->drupalCreateUser($permissions);
    $this->drupalLogin($admin_user);
    // Add a second and third language.
    static::createLanguageFromLangcode('fr');
    static::createLanguageFromLangcode('nl');
}

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