Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/tour/src/Tests/TourTest.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c75dbcec494b |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\tour\Tests; | |
4 | |
5 /** | |
6 * A legacy test for \Drupal\tour\Tests\TourTestBase. | |
7 * | |
8 * @group tour | |
9 */ | |
10 class TourTest extends TourTestBase { | |
11 | |
12 /** | |
13 * Modules to enable. | |
14 * | |
15 * @var array | |
16 */ | |
17 public static $modules = ['block', 'tour', 'locale', 'language', 'tour_test']; | |
18 | |
19 /** | |
20 * Tour tip attributes to be tested. Keyed by the path. | |
21 * | |
22 * @var array | |
23 * An array of tip attributes, keyed by path. | |
24 */ | |
25 protected $tips = [ | |
26 'tour-test-1' => [ | |
27 'data-id' => 'tour-test-1', | |
28 'data-class' => 'tour-test-1', | |
29 ], | |
30 ]; | |
31 | |
32 /** | |
33 * An admin user with administrative permissions for tour. | |
34 * | |
35 * @var \Drupal\user\UserInterface | |
36 */ | |
37 protected $adminUser; | |
38 | |
39 /** | |
40 * The permissions required for a logged in user to test tour tips. | |
41 * | |
42 * @var array | |
43 * A list of permissions. | |
44 */ | |
45 protected $permissions = ['access tour']; | |
46 | |
47 /** | |
48 * {@inheritdoc} | |
49 */ | |
50 protected function setUp() { | |
51 parent::setUp(); | |
52 | |
53 // Make sure we are using distinct default and administrative themes for | |
54 // the duration of these tests. | |
55 $this->container->get('theme_handler')->install(['bartik', 'seven']); | |
56 $this->config('system.theme') | |
57 ->set('default', 'bartik') | |
58 ->set('admin', 'seven') | |
59 ->save(); | |
60 | |
61 $this->permissions[] = 'view the administration theme'; | |
62 | |
63 // Create an admin user to view tour tips. | |
64 $this->adminUser = $this->drupalCreateUser($this->permissions); | |
65 $this->drupalLogin($this->adminUser); | |
66 | |
67 $this->drupalPlaceBlock('local_actions_block', [ | |
68 'theme' => 'seven', | |
69 'region' => 'content' | |
70 ]); | |
71 } | |
72 | |
73 /** | |
74 * A simple tip test. | |
75 */ | |
76 public function testTips() { | |
77 foreach ($this->tips as $path => $attributes) { | |
78 $this->drupalGet($path); | |
79 $this->assertTourTips($attributes); | |
80 } | |
81 } | |
82 | |
83 } |