MediaInstallTest.php

Same filename in other branches
  1. 8.9.x core/modules/media/tests/src/Functional/MediaInstallTest.php
  2. 10 core/modules/media/tests/src/Functional/MediaInstallTest.php
  3. 11.x core/modules/media/tests/src/Functional/MediaInstallTest.php

Namespace

Drupal\Tests\media\Functional

File

core/modules/media/tests/src/Functional/MediaInstallTest.php

View source
<?php

namespace Drupal\Tests\media\Functional;

use Drupal\Tests\BrowserTestBase;

/**
 * Tests media Install / Uninstall logic.
 *
 * @group media
 */
class MediaInstallTest extends BrowserTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'media',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() : void {
        parent::setUp();
        $this->drupalLogin($this->drupalCreateUser([
            'administer modules',
        ]));
    }
    
    /**
     * Tests reinstalling after being uninstalled.
     */
    public function testReinstallAfterUninstall() {
        $page = $this->getSession()
            ->getPage();
        $assert_session = $this->assertSession();
        // Uninstall the media module.
        $this->container
            ->get('module_installer')
            ->uninstall([
            'media',
        ], FALSE);
        $this->drupalGet('/admin/modules');
        $page->checkField('modules[media][enable]');
        $page->pressButton('Install');
        $assert_session->pageTextNotContains('could not be moved/copied because a file by that name already exists in the destination directory');
        $assert_session->pageTextContains('Module Media has been enabled');
    }

}

Classes

Title Deprecated Summary
MediaInstallTest Tests media Install / Uninstall logic.

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