Chris@0: profile != 'standard') { Chris@0: $this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']); Chris@0: } Chris@0: Chris@0: $this->authUser = $this->drupalCreateUser([ Chris@0: // For node creation. Chris@0: 'access content', Chris@0: 'create page content', Chris@0: 'edit own page content', Chris@0: // For language negotiation administration. Chris@0: 'administer languages', Chris@0: 'access administration pages', Chris@0: ]); Chris@0: Chris@0: // Ensure we have a node page to access. Chris@0: $this->node = $this->drupalCreateNode(['title' => $this->randomMachineName(255), 'uid' => $this->authUser->id()]); Chris@0: Chris@0: // Add a custom language and enable path-based language negotiation. Chris@0: $this->drupalLogin($this->authUser); Chris@0: $this->language = [ Chris@0: 'predefined_langcode' => 'custom', Chris@0: 'langcode' => 'xx', Chris@0: 'label' => $this->randomMachineName(16), Chris@0: 'direction' => 'ltr', Chris@0: ]; Chris@0: $this->drupalPostForm('admin/config/regional/language/add', $this->language, t('Add custom language')); Chris@0: $this->drupalPostForm('admin/config/regional/language/detection', ['language_interface[enabled][language-url]' => 1], t('Save settings')); Chris@0: $this->drupalLogout(); Chris@0: Chris@0: // Enable access logging. Chris@0: $this->config('statistics.settings') Chris@0: ->set('count_content_views', 1) Chris@0: ->save(); Chris@0: Chris@0: // Clear the logs. Chris@18: Database::getConnection()->truncate('node_counter'); Chris@0: $this->client = \Drupal::httpClient(); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Verifies node hit counter logging and script placement. Chris@0: */ Chris@0: public function testLogging() { Chris@0: $path = 'node/' . $this->node->id(); Chris@0: $module_path = drupal_get_path('module', 'statistics'); Chris@0: $stats_path = base_path() . $module_path . '/statistics.php'; Chris@0: $lib_path = base_path() . $module_path . '/statistics.js'; Chris@0: $expected_library = '/