Update to Drupal 8.0.0-beta15. For more information, see: https://www.drupal.org/node/2563023
This commit is contained in:
parent
2720a9ec4b
commit
f3791f1da3
1898 changed files with 54300 additions and 11481 deletions
|
@ -0,0 +1,13 @@
|
|||
id: d7_tracker_settings
|
||||
label: Drupal 7 tracker settings
|
||||
migration_tags:
|
||||
- Drupal 7
|
||||
source:
|
||||
plugin: variable
|
||||
variables:
|
||||
- tracker_batch_size
|
||||
process:
|
||||
cron_index_limit: tracker_batch_size
|
||||
destination:
|
||||
plugin: config
|
||||
config_name: tracker.settings
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\tracker\Tests\Migrate\d7\MigrateTrackerSettingsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\tracker\Tests\Migrate\d7;
|
||||
|
||||
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
|
||||
|
||||
/**
|
||||
* Tests migration of Tracker settings to configuration.
|
||||
*
|
||||
* @group tracker
|
||||
*/
|
||||
class MigrateTrackerSettingsTest extends MigrateDrupal7TestBase {
|
||||
|
||||
public static $modules = ['tracker'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installConfig(['tracker']);
|
||||
$this->executeMigration('d7_tracker_settings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of tracker's variables to configuration.
|
||||
*/
|
||||
public function testMigration() {
|
||||
$this->assertIdentical(999, \Drupal::config('tracker.settings')->get('cron_index_limit'));
|
||||
}
|
||||
|
||||
}
|
|
@ -10,6 +10,7 @@ namespace Drupal\tracker\Tests;
|
|||
use Drupal\comment\CommentInterface;
|
||||
use Drupal\comment\Tests\CommentTestTrait;
|
||||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\node\Entity\Node;
|
||||
|
@ -31,7 +32,7 @@ class TrackerTest extends WebTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('comment', 'tracker', 'history', 'node_test');
|
||||
public static $modules = ['block', 'comment', 'tracker', 'history', 'node_test'];
|
||||
|
||||
/**
|
||||
* The main user for testing.
|
||||
|
@ -60,6 +61,8 @@ class TrackerTest extends WebTestBase {
|
|||
'access content',
|
||||
'access user profiles',
|
||||
));
|
||||
$this->drupalPlaceBlock('local_tasks_block', ['id' => 'page_tabs_block']);
|
||||
$this->drupalPlaceBlock('local_actions_block', ['id' => 'page_actions_block']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,10 +86,22 @@ class TrackerTest extends WebTestBase {
|
|||
$this->assertLink(t('My recent content'), 0, 'User tab shows up on the global tracker page.');
|
||||
|
||||
// Assert cache contexts, specifically the pager and node access contexts.
|
||||
$this->assertCacheContexts(['languages:language_interface', 'theme', 'url.query_args.pagers:0', 'user.node_grants:view', 'user.permissions']);
|
||||
// Assert cache tags for the visible node and node list cache tag.
|
||||
$this->assertCacheContexts(['languages:language_interface', 'route.name', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'url.query_args.pagers:0', 'user.node_grants:view', 'user']);
|
||||
// Assert cache tags for the action/tabs blocks, visible node, and node list
|
||||
// cache tag.
|
||||
$expected_tags = Cache::mergeTags($published->getCacheTags(), $published->getOwner()->getCacheTags());
|
||||
$expected_tags = Cache::mergeTags($expected_tags, ['node_list', 'rendered']);
|
||||
$block_tags = [
|
||||
'block_view',
|
||||
'config:block.block.page_actions_block',
|
||||
'config:block.block.page_tabs_block',
|
||||
'config:block_list',
|
||||
];
|
||||
$expected_tags = Cache::mergeTags($expected_tags, $block_tags);
|
||||
$additional_tags = [
|
||||
'node_list',
|
||||
'rendered',
|
||||
];
|
||||
$expected_tags = Cache::mergeTags($expected_tags, $additional_tags);
|
||||
$this->assertCacheTags($expected_tags);
|
||||
|
||||
// Delete a node and ensure it no longer appears on the tracker.
|
||||
|
@ -149,16 +164,27 @@ class TrackerTest extends WebTestBase {
|
|||
$this->assertText($other_published_my_comment->label(), "Nodes that the user has commented on appear in the user's tracker listing.");
|
||||
|
||||
// Assert cache contexts.
|
||||
$this->assertCacheContexts(['languages:language_interface', 'theme', 'url.query_args.pagers:0', 'user', 'user.node_grants:view']);
|
||||
$this->assertCacheContexts(['languages:language_interface', 'route.name', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'url.query_args.pagers:0', 'user', 'user.node_grants:view']);
|
||||
// Assert cache tags for the visible nodes (including owners) and node list
|
||||
// cache tag.
|
||||
$expected_tags = Cache::mergeTags($my_published->getCacheTags(), $my_published->getOwner()->getCacheTags());
|
||||
$expected_tags = Cache::mergeTags($expected_tags, $other_published_my_comment->getCacheTags());
|
||||
$expected_tags = Cache::mergeTags($expected_tags, $other_published_my_comment->getOwner()->getCacheTags());
|
||||
$expected_tags = Cache::mergeTags($expected_tags, ['node_list', 'rendered']);
|
||||
$block_tags = [
|
||||
'block_view',
|
||||
'config:block.block.page_actions_block',
|
||||
'config:block.block.page_tabs_block',
|
||||
'config:block_list',
|
||||
];
|
||||
$expected_tags = Cache::mergeTags($expected_tags, $block_tags);
|
||||
$additional_tags = [
|
||||
'node_list',
|
||||
'rendered',
|
||||
];
|
||||
$expected_tags = Cache::mergeTags($expected_tags, $additional_tags);
|
||||
|
||||
$this->assertCacheTags($expected_tags);
|
||||
$this->assertCacheContexts(['languages:language_interface', 'theme', 'url.query_args.pagers:0', 'user', 'user.node_grants:view']);
|
||||
$this->assertCacheContexts(['languages:language_interface', 'route.name', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'url.query_args.pagers:0', 'user', 'user.node_grants:view']);
|
||||
|
||||
$this->assertLink($my_published->label());
|
||||
$this->assertNoLink($unpublished->label());
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* User page callbacks for tracker.module.
|
||||
*/
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\node\Entity\Node;
|
||||
|
||||
|
@ -85,7 +84,7 @@ function tracker_page($account = NULL) {
|
|||
}
|
||||
|
||||
$row = array(
|
||||
'type' => SafeMarkup::checkPlain(node_get_type_label($node)),
|
||||
'type' => node_get_type_label($node),
|
||||
'title' => array(
|
||||
'data' => array(
|
||||
'#type' => 'link',
|
||||
|
@ -140,8 +139,13 @@ function tracker_page($account = NULL) {
|
|||
$page['#cache']['tags'] = $cache_tags;
|
||||
$page['#cache']['contexts'][] = 'user.node_grants:view';
|
||||
|
||||
if (Drupal::moduleHandler()->moduleExists('history') && \Drupal::currentUser()->isAuthenticated()) {
|
||||
$page['#attached']['library'][] = 'tracker/history';
|
||||
// Display the reading history if that module is enabled.
|
||||
if (\Drupal::moduleHandler()->moduleExists('history')) {
|
||||
// Reading history is tracked for authenticated users only.
|
||||
if (\Drupal::currentUser()->isAuthenticated()) {
|
||||
$page['#attached']['library'][] = 'tracker/history';
|
||||
}
|
||||
$page['#cache']['contexts'][] = 'user.roles:authenticated';
|
||||
}
|
||||
|
||||
return $page;
|
||||
|
|
Reference in a new issue