You are here

public function CKEditorImagesGalleryTest::setUp in CKEditor Images Gallery 8

Overrides BrowserTestBase::setUp

File

tests/src/FunctionalJavascript/CKEditorImagesGalleryTest.php, line 39

Class

CKEditorImagesGalleryTest
Class CKEditorImagesGalleryTest.

Namespace

Drupal\Tests\ckeditor_images_gallery\FunctionalJavascript

Code

public function setUp() {
  parent::setUp();
  FilterFormat::create([
    'format' => 'full_html',
    'name' => 'Full HTML',
    'weight' => 0,
  ])
    ->save();
  Editor::create([
    'format' => 'full_html',
    'editor' => 'ckeditor',
    'settings' => [
      'toolbar' => [
        'rows' => [
          [
            [
              'name' => 'Main',
              'items' => [
                'Source',
                'Gallery',
              ],
            ],
          ],
        ],
      ],
    ],
  ])
    ->save();
  $this
    ->drupalCreateContentType([
    'type' => 'page',
  ]);
  $this->account = $this
    ->drupalCreateUser([
    'administer nodes',
    'create page content',
    'use text format full_html',
    'administer imce',
    'access files overview',
  ], NULL, TRUE);
  $role = $this->account
    ->getRoles();
  $this
    ->drupalLogin($this->account);

  /** @var \Drupal\Core\Config\ConfigFactoryInterface $config */
  $config = $this->container
    ->get('config.factory');
  $config
    ->getEditable('imce.settings')
    ->set('roles_profiles', [
    $role[2] => [
      'public' => 'admin',
    ],
  ])
    ->save();
  $this
    ->getTestFiles('image');
}