04f2048eac66c75b7c6b16d6587a9a3a4412d489
[yaffs-website] / web / core / modules / migrate_drupal_ui / src / Tests / MigrateAccessTest.php
1 <?php
2
3 namespace Drupal\migrate_drupal_ui\Tests;
4
5 use Drupal\simpletest\WebTestBase;
6
7 /**
8  * Tests that only user 1 can access the migrate UI.
9  *
10  * @group migrate_drupal_ui
11  */
12 class MigrateAccessTest extends WebTestBase {
13
14   /**
15    * Modules to enable.
16    *
17    * @var array
18    */
19   public static $modules = ['migrate_drupal_ui'];
20
21   /**
22    * Tests that only user 1 can access the migrate UI.
23    */
24   public function testAccess() {
25     $this->drupalLogin($this->rootUser);
26     $this->drupalGet('upgrade');
27     $this->assertResponse(200);
28     $this->assertText(t('Upgrade'));
29
30     $user = $this->createUser(['administer software updates']);
31     $this->drupalLogin($user);
32     $this->drupalGet('upgrade');
33     $this->assertResponse(403);
34     $this->assertNoText(t('Upgrade'));
35   }
36
37 }