Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes

This commit is contained in:
Pantheon Automation 2016-04-20 09:56:34 -07:00 committed by Greg Anderson
parent b11a755ba8
commit c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Controller\ShortcutController.
*/
namespace Drupal\shortcut\Controller;
use Drupal\Core\Controller\ControllerBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Controller\ShortcutSetController.
*/
namespace Drupal\shortcut\Controller;
use Drupal\Core\Controller\ControllerBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Entity\Shortcut.
*/
namespace Drupal\shortcut\Entity;
use Drupal\Core\Cache\Cache;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Entity\ShortcutSet.
*/
namespace Drupal\shortcut\Entity;
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Form\SetCustomize.
*/
namespace Drupal\shortcut\Form;
use Drupal\Core\Entity\EntityForm;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Form\ShortcutDeleteForm.
*/
namespace Drupal\shortcut\Form;
use Drupal\Core\Entity\ContentEntityDeleteForm;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Form\ShortcutSetDeleteForm.
*/
namespace Drupal\shortcut\Form;
use Drupal\Core\Entity\EntityDeleteForm;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Form\SwitchShortcutSet.
*/
namespace Drupal\shortcut\Form;
use Drupal\Core\Form\FormBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Plugin\Block\ShortcutsBlock.
*/
namespace Drupal\shortcut\Plugin\Block;
use Drupal\Core\Access\AccessResult;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Plugin\migrate\destination\EntityShortcutSet.
*/
namespace Drupal\shortcut\Plugin\migrate\destination;
use Drupal\migrate\Row;

View file

@ -1,15 +1,10 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Plugin\migrate\destination\ShortcutSetUsers.
*/
namespace Drupal\shortcut\Plugin\migrate\destination;
use Drupal\shortcut\ShortcutSetStorageInterface;
use Drupal\user\Entity\User;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Row;
use Drupal\migrate\Plugin\migrate\destination\DestinationBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -38,7 +33,7 @@ class ShortcutSetUsers extends DestinationBase implements ContainerFactoryPlugin
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param MigrationInterface $migration
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
* The migration.
* @param \Drupal\shortcut\ShortcutSetStorageInterface $shortcut_set_storage
* The shortcut_set entity storage handler.

View file

@ -1,8 +1,4 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Plugin\migrate\source\d7\Shortcut.
*/
namespace Drupal\shortcut\Plugin\migrate\source\d7;

View file

@ -1,8 +1,4 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Plugin\migrate\source\d7\ShortcutSet.
*/
namespace Drupal\shortcut\Plugin\migrate\source\d7;

View file

@ -1,8 +1,4 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Plugin\migrate\source\d7\ShortcutSetUsers.
*/
namespace Drupal\shortcut\Plugin\migrate\source\d7;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\ShortcutAccessControlHandler.
*/
namespace Drupal\shortcut;
use Drupal\Core\Access\AccessResult;
@ -61,7 +56,7 @@ class ShortcutAccessControlHandler extends EntityAccessControlHandler implements
}
// @todo Fix this bizarre code: how can a shortcut exist without a shortcut
// set? The above if-test is unnecessary. See https://www.drupal.org/node/2339903.
return AccessResult::neutral()->cacheUntilEntityChanges($entity);
return AccessResult::neutral()->addCacheableDependency($entity);
}
/**

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\ShortcutForm.
*/
namespace Drupal\shortcut;
use Drupal\Core\Entity\ContentEntityForm;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\ShortcutInterface.
*/
namespace Drupal\shortcut;
use Drupal\Core\Entity\ContentEntityInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\ShortcutSetAccessControlHandler.
*/
namespace Drupal\shortcut;
use Drupal\Core\Access\AccessResult;
@ -31,7 +26,7 @@ class ShortcutSetAccessControlHandler extends EntityAccessControlHandler {
if (!$account->hasPermission('access shortcuts')) {
return AccessResult::neutral()->cachePerPermissions();
}
return AccessResult::allowedIf($account->hasPermission('customize shortcut links') && $entity == shortcut_current_displayed_set($account))->cachePerPermissions()->cacheUntilEntityChanges($entity);
return AccessResult::allowedIf($account->hasPermission('customize shortcut links') && $entity == shortcut_current_displayed_set($account))->cachePerPermissions()->addCacheableDependency($entity);
case 'delete':
return AccessResult::allowedIf($account->hasPermission('administer shortcuts') && $entity->id() != 'default')->cachePerPermissions();

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\ShortcutSetForm.
*/
namespace Drupal\shortcut;
use Drupal\Core\Entity\BundleEntityFormBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\ShortcutSetInterface.
*/
namespace Drupal\shortcut;
use Drupal\Core\Config\Entity\ConfigEntityInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\ShortcutSetListBuilder.
*/
namespace Drupal\shortcut;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\ShortcutSetStorage.
*/
namespace Drupal\shortcut;
use Drupal\Component\Uuid\UuidInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\ShortcutSetStorageInterface.
*/
namespace Drupal\shortcut;
use Drupal\Core\Config\Entity\ConfigEntityStorageInterface;

View file

@ -1,44 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Tests\Migrate\MigrateShortcutStubTest.
*/
namespace Drupal\shortcut\Tests\Migrate;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
use Drupal\migrate_drupal\Tests\StubTestTrait;
/**
* Test stub creation for shortcut entities.
*
* @group shortcut
*/
class MigrateShortcutStubTest extends MigrateDrupalTestBase {
use StubTestTrait;
/**
* {@inheritdoc}
*/
public static $modules = ['shortcut', 'link'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installEntitySchema('shortcut');
// Make sure the 'default' shortcut_set is installed.
$this->installConfig(['shortcut']);
}
/**
* Tests creation of shortcut stubs.
*/
public function testStub() {
$this->performStubTest('shortcut');
}
}

View file

@ -1,78 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Tests\Migrate\d7\MigrateShortcutSetTest.
*/
namespace Drupal\shortcut\Tests\Migrate\d7;
use Drupal\shortcut\Entity\ShortcutSet;
use Drupal\shortcut\ShortcutSetInterface;
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
/**
* Test shortcut_set migration to ShortcutSet entities.
*
* @group shortcut
*/
class MigrateShortcutSetTest extends MigrateDrupal7TestBase {
/**
* Modules to enable.
*
* @var array
*/
static $modules = array(
'link',
'field',
'shortcut',
'menu_link_content',
);
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installSchema('system', array('router'));
$this->installEntitySchema('shortcut');
$this->installEntitySchema('menu_link_content');
\Drupal::service('router.builder')->rebuild();
$this->executeMigration('d7_shortcut_set');
$this->executeMigration('menu');
$this->executeMigration('menu_links');
$this->executeMigration('d7_shortcut');
}
/**
* Test the shortcut set migration.
*/
public function testShortcutSetMigration() {
$this->assertEntity('default', 'Default', 2);
$this->assertEntity('shortcut_set_2', 'Alternative shortcut set', 2);
}
/**
* Asserts various aspects of a shortcut set entity.
*
* @param string $id
* The expected shortcut set ID.
* @param string $label
* The expected shortcut set label.
* @param int $expected_size
* The number of shortcuts expected to be in the set.
*/
protected function assertEntity($id, $label, $expected_size) {
$shortcut_set = ShortcutSet::load($id);
$this->assertTrue($shortcut_set instanceof ShortcutSetInterface);
/** @var \Drupal\shortcut\ShortcutSetInterface $shortcut_set */
$this->assertIdentical($id, $shortcut_set->id());
$this->assertIdentical($label, $shortcut_set->label());
// Check the number of shortcuts in the set.
$shortcuts = $shortcut_set->getShortcuts();
$this->assertIdentical(count($shortcuts), $expected_size);
}
}

View file

@ -1,62 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Tests\Migrate\d7\MigrateShortcutSetUsersTest.
*/
namespace Drupal\shortcut\Tests\Migrate\d7;
use Drupal\user\Entity\User;
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
/**
* Test shortcut_set_users migration.
*
* @group shortcut
*/
class MigrateShortcutSetUsersTest extends MigrateDrupal7TestBase {
/**
* Modules to enable.
*
* @var array
*/
static $modules = array(
'link',
'field',
'shortcut',
'menu_link_content',
);
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installSchema('system', array('router'));
$this->installEntitySchema('shortcut');
$this->installEntitySchema('menu_link_content');
$this->installSchema('shortcut', ['shortcut_set_users']);
\Drupal::service('router.builder')->rebuild();
$this->executeMigration('d7_user_role');
$this->executeMigration('d7_user');
$this->executeMigration('d7_shortcut_set');
$this->executeMigration('menu');
$this->executeMigration('menu_links');
$this->executeMigration('d7_shortcut');
$this->executeMigration('d7_shortcut_set_users');
}
/**
* Test the shortcut set migration.
*/
public function testShortcutSetUsersMigration() {
// Check if migrated user has correct migrated shortcut set assigned.
$account = User::load(2);
$shortcut_set = shortcut_current_displayed_set($account);
/** @var \Drupal\shortcut\ShortcutSetInterface $shortcut_set */
$this->assertIdentical('shortcut_set_2', $shortcut_set->id());
}
}

View file

@ -1,80 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Tests\Migrate\d7\MigrateShortcutTest.
*/
namespace Drupal\shortcut\Tests\Migrate\d7;
use Drupal\shortcut\Entity\Shortcut;
use Drupal\shortcut\ShortcutInterface;
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
/**
* Test shortcut menu links migration to Shortcut entities.
*
* @group shortcut
*/
class MigrateShortcutTest extends MigrateDrupal7TestBase {
/**
* Modules to enable.
*
* @var array
*/
static $modules = array(
'link',
'field',
'shortcut',
'menu_link_content',
);
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installSchema('system', array('router'));
$this->installEntitySchema('shortcut');
$this->installEntitySchema('menu_link_content');
\Drupal::service('router.builder')->rebuild();
$this->executeMigration('d7_shortcut_set');
$this->executeMigration('menu');
$this->executeMigration('menu_links');
$this->executeMigration('d7_shortcut');
}
/**
* Asserts various aspects of a shortcut entity.
*
* @param int $id
* The shortcut ID.
* @param string $title
* The expected title of the shortcut.
* @param int $weight
* The expected weight of the shortcut.
* @param string $url
* The expected URL of the shortcut.
*/
protected function assertEntity($id, $title, $weight, $url) {
$shortcut = Shortcut::load($id);
$this->assertTrue($shortcut instanceof ShortcutInterface);
/** @var \Drupal\shortcut\ShortcutInterface $shortcut */
$this->assertIdentical($title, $shortcut->getTitle());
$this->assertIdentical($weight, $shortcut->getWeight());
$this->assertIdentical($url, $shortcut->getUrl()->toString());
}
/**
* Test the shortcut migration.
*/
public function testShortcutMigration() {
// Check if the 4 shortcuts were migrated correctly.
$this->assertEntity(1, 'Add content', '-20', '/node/add');
$this->assertEntity(2, 'Find content', '-19', '/admin/content');
$this->assertEntity(3, 'Help', '-49', '/admin/help');
$this->assertEntity(4, 'People', '-50', '/admin/people');
}
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Tests\ShortcutCacheTagsTest.
*/
namespace Drupal\shortcut\Tests;
use Drupal\shortcut\Entity\Shortcut;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Tests\ShortcutLinksTest.
*/
namespace Drupal\shortcut\Tests;
use Drupal\Component\Utility\SafeMarkup;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Tests\ShortcutSetsTest.
*/
namespace Drupal\shortcut\Tests;
use Drupal\shortcut\Entity\ShortcutSet;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Tests\ShortcutTestBase.
*/
namespace Drupal\shortcut\Tests;
use Drupal\shortcut\Entity\Shortcut;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\shortcut\Tests\ShortcutTranslationUITest.
*/
namespace Drupal\shortcut\Tests;
use Drupal\content_translation\Tests\ContentTranslationUITestBase;