Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\statistics\Tests\Migrate\d6\MigrateStatisticsConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\statistics\Tests\Migrate\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to statistics.settings.yml.
|
||||
*
|
||||
* @group statistics
|
||||
*/
|
||||
class MigrateStatisticsConfigsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('statistics');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->loadDumps(['Variable.php']);
|
||||
$this->executeMigration('d6_statistics_settings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of statistics variables to statistics.settings.yml.
|
||||
*/
|
||||
public function testStatisticsSettings() {
|
||||
$config = $this->config('statistics.settings');
|
||||
$this->assertIdentical(FALSE, $config->get('access_log.enabled'));
|
||||
$this->assertIdentical(259200, $config->get('access_log.max_lifetime'));
|
||||
$this->assertIdentical(0, $config->get('count_content_views'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'statistics.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -40,7 +40,7 @@ class StatisticsAdminTest extends WebTestBase {
|
|||
/**
|
||||
* The Guzzle HTTP client.
|
||||
*
|
||||
* @var \GuzzleHttp\ClientInterface;
|
||||
* @var \GuzzleHttp\Client;
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
|
@ -54,8 +54,8 @@ 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::httpClient();
|
||||
$this->client->setDefaultOption('config/curl', array(CURLOPT_TIMEOUT => 10));
|
||||
$this->client = \Drupal::service('http_client_factory')
|
||||
->fromOptions(['config/curl' => [CURLOPT_TIMEOUT => 10]]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,16 +78,16 @@ class StatisticsAdminTest extends WebTestBase {
|
|||
$post = array('nid' => $nid);
|
||||
global $base_url;
|
||||
$stats_path = $base_url . '/' . drupal_get_path('module', 'statistics'). '/statistics.php';
|
||||
$this->client->post($stats_path, array('body' => $post));
|
||||
$this->client->post($stats_path, array('form_params' => $post));
|
||||
|
||||
// Hit the node again (the counter is incremented after the hit, so
|
||||
// "1 view" will actually be shown when the node is hit the second time).
|
||||
$this->drupalGet('node/' . $this->testNode->id());
|
||||
$this->client->post($stats_path, array('body' => $post));
|
||||
$this->client->post($stats_path, array('form_params' => $post));
|
||||
$this->assertText('1 view', 'Node is viewed once.');
|
||||
|
||||
$this->drupalGet('node/' . $this->testNode->id());
|
||||
$this->client->post($stats_path, array('body' => $post));
|
||||
$this->client->post($stats_path, array('form_params' => $post));
|
||||
$this->assertText('2 views', 'Node is viewed 2 times.');
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ class StatisticsAdminTest extends WebTestBase {
|
|||
$post = array('nid' => $nid);
|
||||
global $base_url;
|
||||
$stats_path = $base_url . '/' . drupal_get_path('module', 'statistics'). '/statistics.php';
|
||||
$this->client->post($stats_path, array('body' => $post));
|
||||
$this->client->post($stats_path, array('form_params' => $post));
|
||||
|
||||
$result = db_select('node_counter', 'n')
|
||||
->fields('n', array('nid'))
|
||||
|
@ -137,9 +137,9 @@ class StatisticsAdminTest extends WebTestBase {
|
|||
$post = array('nid' => $nid);
|
||||
global $base_url;
|
||||
$stats_path = $base_url . '/' . drupal_get_path('module', 'statistics'). '/statistics.php';
|
||||
$this->client->post($stats_path, array('body' => $post));
|
||||
$this->client->post($stats_path, array('form_params' => $post));
|
||||
$this->drupalGet('node/' . $this->testNode->id());
|
||||
$this->client->post($stats_path, array('body' => $post));
|
||||
$this->client->post($stats_path, array('form_params' => $post));
|
||||
$this->assertText('1 view', 'Node is viewed once.');
|
||||
|
||||
// statistics_cron() will subtract
|
||||
|
|
|
@ -36,7 +36,7 @@ class StatisticsLoggingTest extends WebTestBase {
|
|||
/**
|
||||
* The Guzzle HTTP client.
|
||||
*
|
||||
* @var \GuzzleHttp\ClientInterface;
|
||||
* @var \GuzzleHttp\Client;
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
|
@ -61,8 +61,8 @@ class StatisticsLoggingTest extends WebTestBase {
|
|||
// Clear the logs.
|
||||
db_truncate('node_counter');
|
||||
|
||||
$this->client = \Drupal::httpClient();
|
||||
$this->client->setDefaultOption('config/curl', array(CURLOPT_TIMEOUT => 10));
|
||||
$this->client = \Drupal::service('http_client_factory')
|
||||
->fromOptions(['config/curl' => [CURLOPT_TIMEOUT => 10]]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,7 +94,7 @@ class StatisticsLoggingTest extends WebTestBase {
|
|||
// Manually call statistics.php to simulate ajax data collection behavior.
|
||||
$nid = $this->node->id();
|
||||
$post = array('nid' => $nid);
|
||||
$this->client->post($stats_path, array('body' => $post));
|
||||
$this->client->post($stats_path, array('form_params' => $post));
|
||||
$node_counter = statistics_get($this->node->id());
|
||||
$this->assertIdentical($node_counter['totalcount'], '1');
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ 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::httpClient();
|
||||
$client->setDefaultOption('config/curl', array(CURLOPT_TIMEOUT => 10));
|
||||
$client = \Drupal::service('http_client_factory')
|
||||
->fromOptions(['config/curl' => [CURLOPT_TIMEOUT => 10]]);
|
||||
$client->post($stats_path, array('headers' => $headers, 'body' => $post));
|
||||
|
||||
// Configure and save the block.
|
||||
|
|
|
@ -33,8 +33,8 @@ 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::httpClient();
|
||||
$client->setDefaultOption('config/curl', array(CURLOPT_TIMEOUT => 10));
|
||||
$client = \Drupal::service('http_client_factory')
|
||||
->fromOptions(['config/curl' => [CURLOPT_TIMEOUT => 10]]);
|
||||
$client->post($stats_path, array('headers' => $headers, 'body' => $post));
|
||||
$statistics = statistics_get($node->id());
|
||||
|
||||
|
|
|
@ -76,9 +76,8 @@ 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::httpClient();
|
||||
$client->setDefaultOption('config/curl', array(CURLOPT_TIMEOUT => 10));
|
||||
$client->post($stats_path, array('body' => array('nid' => $this->node->id())));
|
||||
$client = \Drupal::service('http_client_factory')->fromOptions(['config/curl', array(CURLOPT_TIMEOUT => 10)]);
|
||||
$client->post($stats_path, array('form_params' => array('nid' => $this->node->id())));
|
||||
$this->drupalGet('test_statistics_integration');
|
||||
|
||||
$expected = statistics_get($this->node->id());
|
||||
|
|
Reference in a new issue