Update to Drupal 8.0.2. For more information, see https://www.drupal.org/drupal-8.0.2-release-notes
This commit is contained in:
parent
1a0e9d9fac
commit
a6b049dd05
538 changed files with 5247 additions and 1594 deletions
|
@ -38,9 +38,16 @@
|
|||
var $authorContext = $(context);
|
||||
var name = $authorContext.find('.field--name-uid input').val();
|
||||
var date = $authorContext.find('.field--name-created input').val();
|
||||
return date ?
|
||||
Drupal.t('By @name on @date', {'@name': name, '@date': date}) :
|
||||
Drupal.t('By @name', {'@name': name});
|
||||
|
||||
if (name && date) {
|
||||
return Drupal.t('By @name on @date', {'@name': name, '@date': date});
|
||||
}
|
||||
else if (name) {
|
||||
return Drupal.t('By @name', {'@name': name});
|
||||
}
|
||||
else if (date) {
|
||||
return Drupal.t('Authored on @date', {'@date': date});
|
||||
}
|
||||
});
|
||||
|
||||
$context.find('.node-form-options').drupalSetSummary(function (context) {
|
||||
|
|
|
@ -77,7 +77,7 @@ class NodeRevisionAccessCheck implements AccessInterface {
|
|||
$node = $this->nodeStorage->loadRevision($node_revision);
|
||||
}
|
||||
$operation = $route->getRequirement('_access_node_revision');
|
||||
return AccessResult::allowedIf($node && $this->checkAccess($node, $account, $operation))->cachePerPermissions();
|
||||
return AccessResult::allowedIf($node && $this->checkAccess($node, $account, $operation))->cachePerPermissions()->addCacheableDependency($node);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,8 +17,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
|||
/**
|
||||
* Default argument plugin to extract a node.
|
||||
*
|
||||
* This plugin actually has no options so it odes not need to do a great deal.
|
||||
*
|
||||
* @ViewsArgumentDefault(
|
||||
* id = "node",
|
||||
* title = @Translation("Content ID from URL")
|
||||
|
|
|
@ -21,7 +21,7 @@ class MigrateNodeBundleSettingsTest extends MigrateDrupal6TestBase {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setUp() {
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installConfig(['node']);
|
||||
$this->executeMigration('d6_node_type');
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Tests\NodeRevisionsUiBypassAccessTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Tests;
|
||||
|
||||
use Drupal\node\Entity\NodeType;
|
||||
|
||||
/**
|
||||
* Tests the revision tab display.
|
||||
*
|
||||
* This test is similar to NodeRevisionsUITest except that it uses a user with
|
||||
* the bypass node access permission to make sure that the revision access
|
||||
* check adds correct cacheability metadata.
|
||||
*
|
||||
* @group node
|
||||
*/
|
||||
class NodeRevisionsUiBypassAccessTest extends NodeTestBase {
|
||||
|
||||
/**
|
||||
* User with bypass node access permission.
|
||||
*
|
||||
* @var \Drupal\user\Entity\User
|
||||
*/
|
||||
protected $editor;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['block'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Create a user.
|
||||
$this->editor = $this->drupalCreateUser([
|
||||
'administer nodes',
|
||||
'edit any page content',
|
||||
'view page revisions',
|
||||
'bypass node access',
|
||||
'access user profiles',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the Revision tab is displayed correctly.
|
||||
*/
|
||||
function testDisplayRevisionTab() {
|
||||
$this->drupalPlaceBlock('local_tasks_block');
|
||||
|
||||
$this->drupalLogin($this->editor);
|
||||
$node_storage = $this->container->get('entity.manager')->getStorage('node');
|
||||
|
||||
// Set page revision setting 'create new revision'. This will mean new
|
||||
// revisions are created by default when the node is edited.
|
||||
$type = NodeType::load('page');
|
||||
$type->setNewRevision(TRUE);
|
||||
$type->save();
|
||||
|
||||
// Create the node.
|
||||
$node = $this->drupalCreateNode();
|
||||
|
||||
// Verify the checkbox is checked on the node edit form.
|
||||
$this->drupalGet('node/' . $node->id() . '/edit');
|
||||
$this->assertFieldChecked('edit-revision', "'Create new revision' checkbox is checked");
|
||||
|
||||
// Uncheck the create new revision checkbox and save the node.
|
||||
$edit = array('revision' => FALSE);
|
||||
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save and keep published');
|
||||
|
||||
$this->assertUrl($node->toUrl());
|
||||
$this->assertNoLink(t('Revisions'));
|
||||
|
||||
// Verify the checkbox is checked on the node edit form.
|
||||
$this->drupalGet('node/' . $node->id() . '/edit');
|
||||
$this->assertFieldChecked('edit-revision', "'Create new revision' checkbox is checked");
|
||||
|
||||
// Submit the form without changing the checkbox.
|
||||
$edit = array();
|
||||
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save and keep published');
|
||||
|
||||
$this->assertUrl($node->toUrl());
|
||||
$this->assertLink(t('Revisions'));
|
||||
}
|
||||
|
||||
}
|
|
@ -10,6 +10,7 @@ namespace Drupal\node\Tests;
|
|||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\node\NodeTypeInterface;
|
||||
|
||||
/**
|
||||
* Ensures that node type functions work correctly.
|
||||
|
@ -124,6 +125,17 @@ class NodeTypeTest extends NodeTestBase {
|
|||
$this->assertRaw('Foo', 'Title field was found.');
|
||||
$this->assertRaw('Body', 'Body field was found.');
|
||||
|
||||
// Change the name through the API
|
||||
/** @var NodeTypeInterface $node_type */
|
||||
$node_type = NodeType::load('page');
|
||||
$node_type->set('name', 'NewBar');
|
||||
$node_type->save();
|
||||
|
||||
/** @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface $bundle_info */
|
||||
$bundle_info = \Drupal::service('entity_type.bundle.info');
|
||||
$node_bundles = $bundle_info->getBundleInfo('node');
|
||||
$this->assertEqual($node_bundles['page']['label'], 'NewBar', 'Node type bundle cache is updated');
|
||||
|
||||
// Remove the body field.
|
||||
$this->drupalPostForm('admin/structure/types/manage/page/fields/node.page.body/delete', array(), t('Delete'));
|
||||
// Resave the settings for this type.
|
||||
|
|
|
@ -39,7 +39,7 @@ class NodeViewLanguageTest extends NodeTestBase {
|
|||
$node = $this->drupalCreateNode(array('langcode' => 'es'));
|
||||
|
||||
$this->drupalGet($node->urlInfo());
|
||||
$this->assertText('Spanish','The language field is displayed properly.');
|
||||
$this->assertText('Spanish', 'The language field is displayed properly.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -175,18 +175,18 @@ class BulkFormTest extends NodeTestBase {
|
|||
// operations are always applied to individual translations.
|
||||
$edit = array(
|
||||
// Original and all translations.
|
||||
'node_bulk_form[0]' => TRUE, // Node 1, English, original.
|
||||
'node_bulk_form[1]' => TRUE, // Node 1, British English.
|
||||
'node_bulk_form[2]' => TRUE, // Node 1, Italian.
|
||||
'node_bulk_form[0]' => TRUE, // Node 1, English, original.
|
||||
'node_bulk_form[1]' => TRUE, // Node 1, British English.
|
||||
'node_bulk_form[2]' => TRUE, // Node 1, Italian.
|
||||
// Original and only one translation.
|
||||
'node_bulk_form[3]' => TRUE, // Node 2, English.
|
||||
'node_bulk_form[4]' => TRUE, // Node 2, British English, original.
|
||||
'node_bulk_form[3]' => TRUE, // Node 2, English.
|
||||
'node_bulk_form[4]' => TRUE, // Node 2, British English, original.
|
||||
'node_bulk_form[5]' => FALSE, // Node 2, Italian.
|
||||
// Only a single translation.
|
||||
'node_bulk_form[6]' => TRUE, // Node 3, English.
|
||||
'node_bulk_form[6]' => TRUE, // Node 3, English.
|
||||
'node_bulk_form[7]' => FALSE, // Node 3, Italian, original.
|
||||
// Only a single untranslated node.
|
||||
'node_bulk_form[8]' => TRUE, // Node 4, English, untranslated.
|
||||
'node_bulk_form[8]' => TRUE, // Node 4, English, untranslated.
|
||||
'node_bulk_form[9]' => FALSE, // Node 5, British English, untranslated.
|
||||
'action' => 'node_unpublish_action',
|
||||
);
|
||||
|
@ -216,18 +216,18 @@ class BulkFormTest extends NodeTestBase {
|
|||
// nodes and individual translations are properly deleted.
|
||||
$edit = array(
|
||||
// Original and all translations.
|
||||
'node_bulk_form[0]' => TRUE, // Node 1, English, original.
|
||||
'node_bulk_form[1]' => TRUE, // Node 1, British English.
|
||||
'node_bulk_form[2]' => TRUE, // Node 1, Italian.
|
||||
'node_bulk_form[0]' => TRUE, // Node 1, English, original.
|
||||
'node_bulk_form[1]' => TRUE, // Node 1, British English.
|
||||
'node_bulk_form[2]' => TRUE, // Node 1, Italian.
|
||||
// Original and only one translation.
|
||||
'node_bulk_form[3]' => TRUE, // Node 2, English.
|
||||
'node_bulk_form[4]' => TRUE, // Node 2, British English, original.
|
||||
'node_bulk_form[3]' => TRUE, // Node 2, English.
|
||||
'node_bulk_form[4]' => TRUE, // Node 2, British English, original.
|
||||
'node_bulk_form[5]' => FALSE, // Node 2, Italian.
|
||||
// Only a single translation.
|
||||
'node_bulk_form[6]' => TRUE, // Node 3, English.
|
||||
'node_bulk_form[6]' => TRUE, // Node 3, English.
|
||||
'node_bulk_form[7]' => FALSE, // Node 3, Italian, original.
|
||||
// Only a single untranslated node.
|
||||
'node_bulk_form[8]' => TRUE, // Node 4, English, untranslated.
|
||||
'node_bulk_form[8]' => TRUE, // Node 4, English, untranslated.
|
||||
'node_bulk_form[9]' => FALSE, // Node 5, British English, untranslated.
|
||||
'action' => 'node_delete_action',
|
||||
);
|
||||
|
|
|
@ -22,7 +22,7 @@ class RevisionRelationshipsTest extends ViewTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('node' ,'node_test_views');
|
||||
public static $modules = array('node' , 'node_test_views');
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
|
|
@ -47,7 +47,7 @@ class DenyNodePreviewTest extends UnitTestCase {
|
|||
*/
|
||||
protected $routeMatch;
|
||||
|
||||
public function setUp() {
|
||||
protected function setUp() {
|
||||
$this->routeMatch = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');
|
||||
$this->policy = new DenyNodePreview($this->routeMatch);
|
||||
$this->response = new Response();
|
||||
|
|
Reference in a new issue