010f07698a941e9ca64f50b6679b979a316cd389
[yaffs-website] / web / core / modules / media / tests / src / Functional / MediaInstallTest.php
1 <?php
2
3 namespace Drupal\Tests\media\Functional;
4
5 use Drupal\Tests\BrowserTestBase;
6
7 /**
8  * Tests media Install / Uninstall logic.
9  *
10  * @group media
11  */
12 class MediaInstallTest extends BrowserTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public static $modules = ['media'];
18
19   /**
20    * {@inheritdoc}
21    */
22   protected function setUp() {
23     parent::setUp();
24     $this->drupalLogin($this->drupalCreateUser(['administer modules']));
25   }
26
27   /**
28    * Tests reinstalling after being uninstalled.
29    */
30   public function testReinstallAfterUninstall() {
31     $page = $this->getSession()->getPage();
32     $assert_session = $this->assertSession();
33
34     // Uninstall the media module.
35     $this->container->get('module_installer')->uninstall(['media'], FALSE);
36
37     $this->drupalGet('/admin/modules');
38     $page->checkField('modules[media][enable]');
39     $page->pressButton('Install');
40     $assert_session->pageTextNotContains('could not be moved/copied because a file by that name already exists in the destination directory');
41     $assert_session->pageTextContains('Module Media has been enabled');
42   }
43
44 }