Newer
Older
Dries Buytaert
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* @file
* Contains \Drupal\tour\Tests\TourTestBasic.
*/
namespace Drupal\tour\Tests;
/**
* Simple tour tips test base.
*/
abstract class TourTestBasic extends TourTestBase {
/**
* Tour tip attributes to be tested. Keyed by the path.
*
* @var array
* An array of tip attributes, keyed by path.
*
* @code
* protected $tips = array(
* '/foo/bar' => array(
* array('data-id' => 'foo'),
* array('data-class' => 'bar'),
* ),
* );
* @endcode
*/
protected $tips = array();
/**
* An admin user with administrative permissions for tour.
*
* @var \Drupal\user\UserInterface
*/
protected $adminUser;
/**
* The permissions required for a logged in user to test tour tips.
*
* @var array
* A list of permissions.
*/
protected $permissions = array('access tour');
protected function setUp() {
parent::setUp();
Angie Byron
committed
// Make sure we are using distinct default and administrative themes for
// the duration of these tests.
$this->container->get('config.factory')
->get('system.theme')
->set('default', 'bartik')
->save();
theme_enable(array('seven'));
$this->container->get('config.factory')
->get('system.theme')
->set('admin', 'seven')
->save();
$this->permissions[] = 'view the administration theme';
Dries Buytaert
committed
//Create an admin user to view tour tips.
$this->adminUser = $this->drupalCreateUser($this->permissions);
$this->drupalLogin($this->adminUser);
}
/**
* A simple tip test.
*/
public function testTips() {
foreach ($this->tips as $path => $attributes) {
$this->drupalGet($path);
$this->assertTourTips($attributes);
}
}
}