Security update for Core, with self-updated composer
[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     // Install the media module again, through a test module that depends on it.
38     // Note: We use a test module because in 8.4 the media module is hidden.
39     // @todo Simplify this in https://www.drupal.org/node/2897028 once it's
40     //   shown again.
41     $this->drupalGet('/admin/modules');
42     $page->checkField('modules[media_test_views][enable]');
43     $page->pressButton('Install');
44     $assert_session->pageTextContains('Some required modules must be enabled');
45     $page->pressButton('Continue');
46     $this->assertSession()->pageTextNotContains('could not be moved/copied because a file by that name already exists in the destination directory');
47   }
48
49 }