// Verify the same when loading the site in a non-default language.
$this->
drupalGet($this->language
['langcode'
] . '/' .
$path);
$settings =
$this->
getDrupalSettings();
$this->
assertSession()->
responseMatches($expected_library);
$this->
assertSame($settings['statistics'
]['data'
]['nid'
],
$this->node->
id(), 'Found statistics settings on valid node page in a non-default language.'
);
// Manually call statistics.php to simulate ajax data collection behavior.
global $base_root;
$post =
['nid' =>
$this->node->
id()];
$this->client->
post($base_root .
$stats_path,
['form_params' =>
$post]);
$node_counter = \Drupal::
service('statistics.storage.node'
)->
fetchView($this->node->
id());
$this->
assertSame(1,
$node_counter->
getTotalCount());
// Try fetching statistics for an invalid node ID and verify it returns
// FALSE.
$node_id = 1000000;
$node = Node::
load($node_id);
$this->
assertNull($node);
// This is a test specifically for the deprecated statistics_get() function
// and so should remain unconverted until that function is removed.
$result = \Drupal::
service('statistics.storage.node'
)->
fetchView($node_id);