b0395b0f09ae4add045a2d55ffd2b4cb94404e7b
[yaffs-website] / web / core / modules / user / src / Tests / Views / AccessTestBase.php
1 <?php
2
3 namespace Drupal\user\Tests\Views;
4
5 /**
6  * A common test base class for the user access plugin tests.
7  */
8 abstract class AccessTestBase extends UserTestBase {
9
10   /**
11    * Modules to enable.
12    *
13    * @var array
14    */
15   public static $modules = ['block'];
16
17   /**
18    * Contains a user object that has no special permissions.
19    *
20    * @var \Drupal\user\UserInterface
21    */
22   protected $webUser;
23
24   /**
25    * Contains a user object that has the 'views_test_data test permission'.
26    *
27    * @var \Drupal\user\UserInterface
28    */
29   protected $normalUser;
30
31   /**
32    * Contains a role ID that is used by the webUser.
33    *
34    * @var string
35    */
36   protected $webRole;
37
38   /**
39    * Contains a role ID that is used by the normalUser.
40    *
41    * @var string
42    */
43   protected $normalRole;
44
45   /**
46    * {@inheritdoc}
47    */
48   protected function setUp() {
49     parent::setUp();
50     $this->drupalPlaceBlock('system_breadcrumb_block');
51
52     $this->enableViewsTestModule();
53
54     $this->webUser = $this->drupalCreateUser();
55     $roles = $this->webUser->getRoles();
56     $this->webRole = $roles[0];
57
58     $this->normalRole = $this->drupalCreateRole([]);
59     $this->normalUser = $this->drupalCreateUser(['views_test_data test permission']);
60     $this->normalUser->addRole($this->normalRole);
61     $this->normalUser->save();
62     // @todo when all the plugin information is cached make a reset function and
63     // call it here.
64   }
65
66 }