From 11c92ce945ce91c21e1a7a5ff049c13873253b78 Mon Sep 17 00:00:00 2001 From: xjm Date: Tue, 29 Nov 2016 18:58:32 -0600 Subject: [PATCH] Issue #2785997 by chanderbhushan, faline, mallezie, dawehner, mr.baileys: Clean up guzzle declaration in core tests --- core/modules/statistics/src/Tests/StatisticsAdminTest.php | 3 +-- core/modules/statistics/src/Tests/StatisticsLoggingTest.php | 4 +--- core/modules/statistics/src/Tests/StatisticsReportsTest.php | 3 +-- .../statistics/src/Tests/StatisticsTokenReplaceTest.php | 3 +-- core/modules/statistics/src/Tests/Views/IntegrationTest.php | 2 +- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/core/modules/statistics/src/Tests/StatisticsAdminTest.php b/core/modules/statistics/src/Tests/StatisticsAdminTest.php index 565925c0e51..6d87fd97574 100644 --- a/core/modules/statistics/src/Tests/StatisticsAdminTest.php +++ b/core/modules/statistics/src/Tests/StatisticsAdminTest.php @@ -52,8 +52,7 @@ class StatisticsAdminTest extends WebTestBase { $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::service('http_client_factory') - ->fromOptions(['config/curl' => [CURLOPT_TIMEOUT => 10]]); + $this->client = \Drupal::httpClient(); } /** diff --git a/core/modules/statistics/src/Tests/StatisticsLoggingTest.php b/core/modules/statistics/src/Tests/StatisticsLoggingTest.php index 7cfec7cd8a3..9aa3cc3f9b6 100644 --- a/core/modules/statistics/src/Tests/StatisticsLoggingTest.php +++ b/core/modules/statistics/src/Tests/StatisticsLoggingTest.php @@ -82,9 +82,7 @@ class StatisticsLoggingTest extends WebTestBase { // Clear the logs. db_truncate('node_counter'); - - $this->client = \Drupal::service('http_client_factory') - ->fromOptions(['config/curl' => [CURLOPT_TIMEOUT => 10]]); + $this->client = \Drupal::httpClient(); } /** diff --git a/core/modules/statistics/src/Tests/StatisticsReportsTest.php b/core/modules/statistics/src/Tests/StatisticsReportsTest.php index 0fe2e282027..3851207b115 100644 --- a/core/modules/statistics/src/Tests/StatisticsReportsTest.php +++ b/core/modules/statistics/src/Tests/StatisticsReportsTest.php @@ -30,8 +30,7 @@ class StatisticsReportsTest extends StatisticsTestBase { $headers = array('Content-Type' => 'application/x-www-form-urlencoded'); global $base_url; $stats_path = $base_url . '/' . drupal_get_path('module', 'statistics') . '/statistics.php'; - $client = \Drupal::service('http_client_factory') - ->fromOptions(['config/curl' => [CURLOPT_TIMEOUT => 10]]); + $client = \Drupal::httpClient(); $client->post($stats_path, array('headers' => $headers, 'body' => $post)); // Configure and save the block. diff --git a/core/modules/statistics/src/Tests/StatisticsTokenReplaceTest.php b/core/modules/statistics/src/Tests/StatisticsTokenReplaceTest.php index b7d22b8fe41..e2e4533d6f8 100644 --- a/core/modules/statistics/src/Tests/StatisticsTokenReplaceTest.php +++ b/core/modules/statistics/src/Tests/StatisticsTokenReplaceTest.php @@ -28,8 +28,7 @@ class StatisticsTokenReplaceTest extends StatisticsTestBase { $headers = array('Content-Type' => 'application/x-www-form-urlencoded'); global $base_url; $stats_path = $base_url . '/' . drupal_get_path('module', 'statistics') . '/statistics.php'; - $client = \Drupal::service('http_client_factory') - ->fromOptions(['config/curl' => [CURLOPT_TIMEOUT => 10]]); + $client = \Drupal::httpClient(); $client->post($stats_path, array('headers' => $headers, 'body' => $post)); $statistics = statistics_get($node->id()); diff --git a/core/modules/statistics/src/Tests/Views/IntegrationTest.php b/core/modules/statistics/src/Tests/Views/IntegrationTest.php index 07380c88922..7fe99f93ef2 100644 --- a/core/modules/statistics/src/Tests/Views/IntegrationTest.php +++ b/core/modules/statistics/src/Tests/Views/IntegrationTest.php @@ -75,7 +75,7 @@ class IntegrationTest extends ViewTestBase { // @see \Drupal\statistics\Tests\StatisticsLoggingTest::testLogging(). global $base_url; $stats_path = $base_url . '/' . drupal_get_path('module', 'statistics') . '/statistics.php'; - $client = \Drupal::service('http_client_factory')->fromOptions(['config/curl', array(CURLOPT_TIMEOUT => 10)]); + $client = \Drupal::httpClient(); $client->post($stats_path, array('form_params' => array('nid' => $this->node->id()))); $this->drupalGet('test_statistics_integration');