Version 1
[yaffs-website] / web / core / modules / statistics / src / Tests / StatisticsTestBase.php
1 <?php
2
3 namespace Drupal\statistics\Tests;
4
5 use Drupal\simpletest\WebTestBase;
6
7 /**
8  * Defines a base class for testing the Statistics module.
9  *
10  * @deprecated Scheduled for removal in Drupal 9.0.0.
11  *   Use \Drupal\Tests\statistics\Functional\StatisticsTestBase instead.
12  */
13 abstract class StatisticsTestBase extends WebTestBase {
14
15   /**
16    * Modules to enable.
17    *
18    * @var array
19    */
20   public static $modules = ['node', 'block', 'ban', 'statistics'];
21
22   /**
23    * User with permissions to ban IP's.
24    *
25    * @var \Drupal\user\UserInterface
26    */
27   protected $blockingUser;
28
29   protected function setUp() {
30     parent::setUp();
31
32     // Create Basic page node type.
33     if ($this->profile != 'standard') {
34       $this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
35     }
36
37     // Create user.
38     $this->blockingUser = $this->drupalCreateUser([
39       'access administration pages',
40       'access site reports',
41       'ban IP addresses',
42       'administer blocks',
43       'administer statistics',
44       'administer users',
45     ]);
46     $this->drupalLogin($this->blockingUser);
47
48     // Enable logging.
49     $this->config('statistics.settings')
50       ->set('count_content_views', 1)
51       ->save();
52   }
53
54 }