Update to Drupal 8.1.2. For more information, see https://www.drupal.org/project/drupal/releases/8.1.2
This commit is contained in:
parent
9eae24d844
commit
28556d630e
1322 changed files with 6699 additions and 2064 deletions
|
@ -6,7 +6,6 @@ use Drupal\Component\Utility\Xss;
|
|||
use Drupal\Core\Controller\ControllerBase;
|
||||
use Drupal\Core\Datetime\DateFormatterInterface;
|
||||
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\Core\Render\RendererInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\node\NodeTypeInterface;
|
||||
|
@ -157,8 +156,8 @@ class NodeController extends ControllerBase implements ContainerInjectionInterfa
|
|||
*/
|
||||
public function revisionOverview(NodeInterface $node) {
|
||||
$account = $this->currentUser();
|
||||
$langcode = $this->languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId();
|
||||
$langname = $this->languageManager()->getLanguageName($langcode);
|
||||
$langcode = $node->language()->getId();
|
||||
$langname = $node->language()->getName();
|
||||
$languages = $node->getTranslationLanguages();
|
||||
$has_translations = (count($languages) > 1);
|
||||
$node_storage = $this->entityManager()->getStorage('node');
|
||||
|
@ -179,6 +178,8 @@ class NodeController extends ControllerBase implements ContainerInjectionInterfa
|
|||
foreach (array_reverse($vids) as $vid) {
|
||||
/** @var \Drupal\node\NodeInterface $revision */
|
||||
$revision = $node_storage->loadRevision($vid);
|
||||
// Only show revisions that are affected by the language that is being
|
||||
// displayed.
|
||||
if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) {
|
||||
$username = [
|
||||
'#theme' => 'username',
|
||||
|
|
|
@ -64,4 +64,5 @@ interface NodeStorageInterface extends ContentEntityStorageInterface {
|
|||
* The language object.
|
||||
*/
|
||||
public function clearRevisionsLanguage(LanguageInterface $language);
|
||||
|
||||
}
|
||||
|
|
|
@ -80,4 +80,5 @@ interface NodeTypeInterface extends ConfigEntityInterface {
|
|||
* The description of this node type.
|
||||
*/
|
||||
public function getDescription();
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
|||
* "node" = @ContextDefinition("entity:node", label = @Translation("Node"))
|
||||
* }
|
||||
* )
|
||||
*
|
||||
*/
|
||||
class NodeType extends ConditionPluginBase implements ContainerFactoryPluginInterface {
|
||||
|
||||
|
|
|
@ -151,6 +151,8 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter
|
|||
* A config object for 'search.settings'.
|
||||
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
|
||||
* The language manager.
|
||||
* @param \Drupal\Core\Render\RendererInterface $renderer
|
||||
* The renderer.
|
||||
* @param \Drupal\Core\Session\AccountInterface $account
|
||||
* The $account object to use for checking for access to advanced search.
|
||||
*/
|
||||
|
@ -621,7 +623,7 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildSearchUrlQuery(FormStateInterface $form_state) {
|
||||
|
|
|
@ -35,7 +35,6 @@ class Node extends ArgumentDefaultPluginBase implements CacheableDependencyInter
|
|||
* The plugin_id for the plugin instance.
|
||||
* @param mixed $plugin_definition
|
||||
* The plugin implementation definition.
|
||||
*
|
||||
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
|
||||
* The route match.
|
||||
*/
|
||||
|
|
|
@ -29,4 +29,5 @@ class RevisionLinkRevert extends RevisionLink {
|
|||
protected function getDefaultLabel() {
|
||||
return $this->t('Revert');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,12 +22,12 @@ use Drupal\views\Plugin\views\row\RssPluginBase;
|
|||
class Rss extends RssPluginBase {
|
||||
|
||||
// Basic properties that let the row style follow relationships.
|
||||
var $base_table = 'node_field_data';
|
||||
public $base_table = 'node_field_data';
|
||||
|
||||
var $base_field = 'nid';
|
||||
public $base_field = 'nid';
|
||||
|
||||
// Stores the nodes loaded with preRender.
|
||||
var $nodes = array();
|
||||
public $nodes = array();
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -44,4 +44,5 @@ trait AssertButtonsTrait {
|
|||
$this->assertNoRaw('dropbutton-wrapper');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -222,4 +222,5 @@ class NodeAccessBaseTableTest extends NodeTestBase {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -109,4 +109,5 @@ class NodeAccessFieldTest extends NodeTestBase {
|
|||
$this->drupalGet('node/add/page');
|
||||
$this->assertRaw($default, 'The updated default value is displayed when creating a new node.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -96,4 +96,5 @@ class NodeAccessPagerTest extends WebTestBase {
|
|||
$this->assertRaw('page=1');
|
||||
$this->assertNoRaw('page=2');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,4 +32,5 @@ class NodeAccessRebuildTest extends NodeTestBase {
|
|||
$this->drupalPostForm(NULL, array(), t('Rebuild permissions'));
|
||||
$this->assertText(t('Content permissions have been rebuilt.'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -80,4 +80,5 @@ class NodeAccessRecordsTest extends NodeTestBase {
|
|||
$records = db_query('SELECT realm, gid FROM {node_access} WHERE nid = :nid', array(':nid' => $node6->id()))->fetchAll();
|
||||
$this->assertEqual(count($records), 0, 'Returned no records for unpublished node.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -73,10 +73,8 @@ class NodeEditFormTest extends NodeTestBase {
|
|||
$this->assertUrl($node->url('edit-form', ['absolute' => TRUE]));
|
||||
|
||||
// Check that the title and body fields are displayed with the correct values.
|
||||
// As you see the expected link text has no HTML, but we are using
|
||||
$link_text = 'Edit<span class="visually-hidden">(active tab)</span>';
|
||||
// @todo Ideally assertLink would support HTML, but it doesn't.
|
||||
$this->assertRaw($link_text, 'Edit tab found and marked active.');
|
||||
$this->assertRaw('Edit<span class="visually-hidden">(active tab)</span>', 'Edit tab found and marked active.');
|
||||
$this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.');
|
||||
$this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.');
|
||||
|
||||
|
|
|
@ -46,4 +46,5 @@ class NodeEntityViewModeAlterTest extends NodeTestBase {
|
|||
$build = $this->drupalBuildEntityView($node);
|
||||
$this->assertEqual($build['#view_mode'], 'teaser', 'The view mode has correctly been set to teaser.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ class NodeFieldMultilingualTest extends WebTestBase {
|
|||
$this->assertRaw($body_value, 'Body correctly displayed using English as requested language');
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Tests multilingual field display settings.
|
||||
*/
|
||||
function testMultilingualDisplaySettings() {
|
||||
|
|
|
@ -131,4 +131,5 @@ class NodeFormButtonsTest extends NodeTestBase {
|
|||
$node_3 = $node_storage->load(3);
|
||||
$this->assertFalse($node_3->isPublished(), 'Node is unpublished');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,4 +68,5 @@ class NodeFormSaveChangedTimeTest extends WebTestBase {
|
|||
$node = entity_load('node', 1, TRUE);
|
||||
$this->assertNotEqual($changed_timestamp, $node->getChangedTime(), "The entity's changed time was updated after form save without changes.");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -73,4 +73,5 @@ class NodeHelpTest extends WebTestBase {
|
|||
$this->assertResponse(200);
|
||||
$this->assertText($this->testText);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,4 +58,5 @@ class NodeLoadMultipleTest extends NodeTestBase {
|
|||
$this->assertTrue(is_object($node), 'Node is an object');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -54,4 +54,5 @@ class NodePostSettingsTest extends NodeTestBase {
|
|||
$elements = $this->xpath('//div[contains(@class, :class)]', array(':class' => 'node__submitted'));
|
||||
$this->assertEqual(count($elements), 0, 'Post information is not displayed.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -193,4 +193,5 @@ class NodeQueryAlterTest extends NodeTestBase {
|
|||
}
|
||||
\Drupal::state()->delete('node_access_test.no_access_uid');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -165,4 +165,5 @@ class NodeRevisionPermissionsTest extends NodeTestBase {
|
|||
$this->assertFalse($node_revision_access->checkAccess($revision, $case['account'], $case['op']), "{$this->typeMap[$case['op']]} did not grant revision permission for articles.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -146,4 +146,5 @@ class NodeRevisionsAllTest extends NodeTestBase {
|
|||
'%revision-date' => format_date($old_revision_date),
|
||||
)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,6 +42,8 @@ class NodeRevisionsTest extends NodeTestBase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Enable additional languages.
|
||||
ConfigurableLanguage::createFromLangcode('de')->save();
|
||||
ConfigurableLanguage::createFromLangcode('it')->save();
|
||||
|
||||
$field_storage_definition = array(
|
||||
|
@ -70,6 +72,7 @@ class NodeRevisionsTest extends NodeTestBase {
|
|||
'edit any page content',
|
||||
'delete any page content',
|
||||
'translate any entity',
|
||||
'administer content types',
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -211,6 +214,60 @@ class NodeRevisionsTest extends NodeTestBase {
|
|||
->fetchCol();
|
||||
$default_revision_vid = $default_revision[0];
|
||||
$this->assertTrue($new_node_revision->getRevisionId() > $default_revision_vid, 'Revision vid is greater than default revision vid.');
|
||||
|
||||
// Create an 'EN' node with a revision log message.
|
||||
$node = $this->drupalCreateNode();
|
||||
$node->title = 'Node title in EN';
|
||||
$node->revision_log = 'Simple revision message (EN)';
|
||||
$node->save();
|
||||
|
||||
$this->drupalGet("node/" . $node->id() . "/revisions");
|
||||
$this->assertResponse(403);
|
||||
|
||||
// Create a new revision and new log message.
|
||||
$node = Node::load($node->id());
|
||||
$node->body->value = 'New text (EN)';
|
||||
$node->revision_log = 'New revision message (EN)';
|
||||
$node->setNewRevision();
|
||||
$node->save();
|
||||
|
||||
// Check both revisions are shown on the node revisions overview page.
|
||||
$this->drupalGet("node/" . $node->id() . "/revisions");
|
||||
$this->assertText('Simple revision message (EN)');
|
||||
$this->assertText('New revision message (EN)');
|
||||
|
||||
// Create an 'EN' node with a revision log message.
|
||||
$node = $this->drupalCreateNode();
|
||||
$node->langcode = 'en';
|
||||
$node->title = 'Node title in EN';
|
||||
$node->revision_log = 'Simple revision message (EN)';
|
||||
$node->save();
|
||||
|
||||
$this->drupalGet("node/" . $node->id() . "/revisions");
|
||||
$this->assertResponse(403);
|
||||
|
||||
// Add a translation in 'DE' and create a new revision and new log message.
|
||||
$translation = $node->addTranslation('de');
|
||||
$translation->title->value = 'Node title in DE';
|
||||
$translation->body->value = 'New text (DE)';
|
||||
$translation->revision_log = 'New revision message (DE)';
|
||||
$translation->setNewRevision();
|
||||
$translation->save();
|
||||
|
||||
// View the revision UI in 'IT', only the original node revision is shown.
|
||||
$this->drupalGet("it/node/" . $node->id() . "/revisions");
|
||||
$this->assertText('Simple revision message (EN)');
|
||||
$this->assertNoText('New revision message (DE)');
|
||||
|
||||
// View the revision UI in 'DE', only the translated node revision is shown.
|
||||
$this->drupalGet("de/node/" . $node->id() . "/revisions");
|
||||
$this->assertNoText('Simple revision message (EN)');
|
||||
$this->assertText('New revision message (DE)');
|
||||
|
||||
// View the revision UI in 'EN', only the original node revision is shown.
|
||||
$this->drupalGet("node/" . $node->id() . "/revisions");
|
||||
$this->assertText('Simple revision message (EN)');
|
||||
$this->assertNoText('New revision message (DE)');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -178,4 +178,5 @@ class NodeSaveTest extends NodeTestBase {
|
|||
$node = $this->drupalCreateNode(array('title' => 'new'));
|
||||
$this->assertEqual($node->getTitle(), 'Node ' . $node->id(), 'Node saved on node insert.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class NodeTitleTest extends NodeTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates one node and tests if the node title has the correct value.
|
||||
* Creates one node and tests if the node title has the correct value.
|
||||
*/
|
||||
function testNodeTitle() {
|
||||
// Create "Basic page" content with title.
|
||||
|
@ -56,7 +56,7 @@ class NodeTitleTest extends NodeTestBase {
|
|||
// Test <title> tag.
|
||||
$this->drupalGet('node/' . $node->id());
|
||||
$xpath = '//title';
|
||||
$this->assertEqual(current($this->xpath($xpath)), $node->label() .' | Drupal', 'Page title is equal to node title.', 'Node');
|
||||
$this->assertEqual(current($this->xpath($xpath)), $node->label() . ' | Drupal', 'Page title is equal to node title.', 'Node');
|
||||
|
||||
// Test breadcrumb in comment preview.
|
||||
$this->drupalGet('comment/reply/node/' . $node->id() . '/comment');
|
||||
|
@ -99,4 +99,5 @@ class NodeTitleTest extends NodeTestBase {
|
|||
$this->assertTitle($edge_case_title_escaped . ' | Drupal', 'Page title is equal to article\'s "title".', 'Node');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,4 +38,5 @@ class NodeTitleXSSTest extends NodeTestBase {
|
|||
$this->drupalGet('node/' . $node->id() . '/edit');
|
||||
$this->assertNoRaw($xss, 'Harmful tags are escaped when editing a node.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,4 +38,5 @@ class PageViewTest extends NodeTestBase {
|
|||
$this->drupalGet("node/" . $node->id() . "/edit");
|
||||
$this->assertResponse(200);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -169,4 +169,5 @@ class BulkFormAccessTest extends NodeTestBase {
|
|||
$own_node = Node::load($own_node->id());
|
||||
$this->assertNull($own_node, 'The own node is deleted.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -105,4 +105,5 @@ class NodeFieldFilterTest extends NodeTestBase {
|
|||
$this->assertEqual(substr_count($text, $this->nodeTitles[$langcode]), 2 * $count, 'Translation ' . $langcode . ' has count ' . $count . ' with ' . $message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ function node_test_entity_view_mode_alter(&$view_mode, EntityInterface $entity,
|
|||
function node_test_node_insert(NodeInterface $node) {
|
||||
// Set the node title to the node ID and save.
|
||||
if ($node->getTitle() == 'new') {
|
||||
$node->setTitle('Node '. $node->id());
|
||||
$node->setTitle('Node ' . $node->id());
|
||||
$node->setNewRevision(FALSE);
|
||||
$node->save();
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ use Drupal\node\NodeInterface;
|
|||
*/
|
||||
class MigrateNodeTest extends MigrateDrupal7TestBase {
|
||||
|
||||
static $modules = array(
|
||||
public static $modules = array(
|
||||
'comment',
|
||||
'datetime',
|
||||
'filter',
|
||||
|
|
|
@ -35,6 +35,7 @@ class MigrateNodeTypeTest extends MigrateDrupal7TestBase {
|
|||
* Tests a single node type.
|
||||
*
|
||||
* @dataProvider testNodeTypeDataProvider
|
||||
*
|
||||
* @param string $id
|
||||
* The node type ID.
|
||||
* @param string $label
|
||||
|
|
|
@ -79,4 +79,5 @@ class NodeConditionTest extends EntityKernelTestBase {
|
|||
$condition = $manager->createInstance('node_type', array('bundles' => array('article' => 'article'), 'context' => array('node' => $article)));
|
||||
$this->assertTrue($condition->execute(), 'Constructor injection of context and configuration working as anticipated.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,4 +68,5 @@ class NodeValidationTest extends EntityKernelTestBase {
|
|||
$this->assertEqual($violations[0]->getPropertyPath(), '');
|
||||
$this->assertEqual($violations[0]->getMessage(), 'The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -71,5 +71,4 @@ class RevisionCreateTimestampTest extends ViewsKernelTestBase {
|
|||
], ['vid' => 'vid', 'revision_timestamp' => 'revision_timestamp']);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue