reverted: --- b/core/modules/statistics/src/Tests/StatisticsInvalidPostTest.php +++ /dev/null @@ -1,68 +0,0 @@ -client = \Drupal::httpClient(); - // Enable logging. - $this->config('statistics.settings') - ->set('count_content_views', 1) - ->save(); - } - - /** - * Test if nothing breaks when posting with invalid params. - */ - public function testInvalidPost() { - - // Manually calling statistics.php. - $nid = 'a string instead of an integer'; - $this->client->post($this->buildUrl(drupal_get_path('module', 'statistics') . '/statistics.php'), ['form_params' => ['nid' => $nid]]); - - $result = db_select('node_counter', 'n') - ->fields('n', ['nid']) - ->condition('n.nid', $nid) - ->execute() - ->fetchAssoc(); - $this->assertEqual($result['nid'], [], 'Verifying that nothing is written to the node_counter table.'); - - // An id greater than int(10), the maximum nid database limit. - $nid = 123456789012; - $this->client->post($this->buildUrl(drupal_get_path('module', 'statistics') . '/statistics.php'), ['form_params' => ['nid' => $nid]]); - - $result = db_select('node_counter', 'n') - ->fields('n', ['nid']) - ->condition('n.nid', $nid) - ->execute() - ->fetchAssoc(); - $this->assertEqual($result['nid'], [], 'Verifying that nothing is written to the node_counter table.'); - } - -} only in patch2: unchanged: --- /dev/null +++ b/core/modules/statistics/tests/src/Functional/StatisticsInvalidPostTest.php @@ -0,0 +1,40 @@ +post($this->buildUrl(drupal_get_path('module', 'statistics') . '/statistics.php'), ['form_params' => ['nid' => $nid]]); + + $result = db_select('node_counter', 'n') + ->fields('n', ['nid']) + ->condition('n.nid', $nid) + ->execute() + ->fetchAssoc(); + $this->assertEqual($result['nid'], NULL, 'Verifying that nothing is written to the node_counter table.'); + + // An id greater than int(10), the maximum nid database limit. + $nid = 123456789012; + $client->post($this->buildUrl(drupal_get_path('module', 'statistics') . '/statistics.php'), ['form_params' => ['nid' => $nid]]); + + $result = db_select('node_counter', 'n') + ->fields('n', ['nid']) + ->condition('n.nid', $nid) + ->execute() + ->fetchAssoc(); + $this->assertEqual($result['nid'], NULL, 'Verifying that nothing is written to the node_counter table.'); + } + +}