Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
|
@ -20,9 +20,7 @@ class MigrateStatisticsConfigsTest extends MigrateDrupal6TestBase {
|
|||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = array('statistics');
|
||||
|
||||
|
|
|
@ -47,6 +47,9 @@ class StatisticsAdminTest extends WebTestBase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Set the max age to 0 to simplify testing.
|
||||
$this->config('statistics.settings')->set('display_max_age', 0)->save();
|
||||
|
||||
// Create Basic page node type.
|
||||
if ($this->profile != 'standard') {
|
||||
$this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
|
||||
|
@ -89,6 +92,16 @@ class StatisticsAdminTest extends WebTestBase {
|
|||
$this->drupalGet('node/' . $this->testNode->id());
|
||||
$this->client->post($stats_path, array('form_params' => $post));
|
||||
$this->assertText('2 views', 'Node is viewed 2 times.');
|
||||
|
||||
// Increase the max age to test that nodes are no longer immediately
|
||||
// updated, visit the node once more to populate the cache.
|
||||
$this->config('statistics.settings')->set('display_max_age', 3600)->save();
|
||||
$this->drupalGet('node/' . $this->testNode->id());
|
||||
$this->assertText('3 views', 'Node is viewed 3 times.');
|
||||
|
||||
$this->client->post($stats_path, array('form_params' => $post));
|
||||
$this->drupalGet('node/' . $this->testNode->id());
|
||||
$this->assertText('3 views', 'Views counter was not updated.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
62
core/modules/statistics/src/Tests/StatisticsAttachedTest.php
Normal file
62
core/modules/statistics/src/Tests/StatisticsAttachedTest.php
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\statistics\Tests\StatisticsAttachedTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\statistics\Tests;
|
||||
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\node\Entity\Node;
|
||||
|
||||
/**
|
||||
* Tests if statistics.js is loaded when content is not printed.
|
||||
*
|
||||
* @group statistics
|
||||
*/
|
||||
class StatisticsAttachedTest extends WebTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('node', 'statistics');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->drupalCreateContentType(['type' => 'page']);
|
||||
|
||||
// Install "statistics_test_attached" and set it as the default theme.
|
||||
$theme = 'statistics_test_attached';
|
||||
\Drupal::service('theme_handler')->install(array($theme));
|
||||
$this->config('system.theme')
|
||||
->set('default', $theme)
|
||||
->save();
|
||||
// Installing a theme will cause the kernel terminate event to rebuild the
|
||||
// router. Simulate that here.
|
||||
\Drupal::service('router.builder')->rebuildIfNeeded();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if statistics.js is loaded when content is not printed.
|
||||
*/
|
||||
public function testAttached() {
|
||||
|
||||
$node = Node::create([
|
||||
'type' => 'page',
|
||||
'title' => 'Page node',
|
||||
'body' => 'body text'
|
||||
]);
|
||||
$node->save();
|
||||
$this->drupalGet('node/' . $node->id());
|
||||
|
||||
$this->assertRaw('core/modules/statistics/statistics.js', 'Statistics library is available');
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue