Example #1
0
 protected function setUp()
 {
     parent::setUp();
     // Create Basic page node type.
     if ($this->profile != 'standard') {
         $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
     }
     $this->privilegedUser = $this->drupalCreateUser(array('administer statistics', 'view post access counter', 'create page content'));
     $this->drupalLogin($this->privilegedUser);
     $this->testNode = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->privilegedUser->id()));
     $this->client = \Drupal::httpClient();
     $this->client->setDefaultOption('config/curl', array(CURLOPT_TIMEOUT => 10));
 }
 protected function setUp()
 {
     parent::setUp();
     // Create Basic page node type.
     if ($this->profile != 'standard') {
         $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
     }
     $this->authUser = $this->drupalCreateUser(array('access content', 'create page content', 'edit own page content'));
     // Ensure we have a node page to access.
     $this->node = $this->drupalCreateNode(array('title' => $this->randomMachineName(255), 'uid' => $this->authUser->id()));
     // Enable access logging.
     $this->config('statistics.settings')->set('count_content_views', 1)->save();
     // Clear the logs.
     db_truncate('node_counter');
     $this->client = \Drupal::httpClient();
     $this->client->setDefaultOption('config/curl', array(CURLOPT_TIMEOUT => 10));
 }