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\book\Access\BookNodeIsRemovableAccessCheck.
*/
namespace Drupal\book\Access;
use Drupal\book\BookManagerInterface;
@ -44,7 +39,7 @@ class BookNodeIsRemovableAccessCheck implements AccessInterface{
* The access result.
*/
public function access(NodeInterface $node) {
return AccessResult::allowedIf($this->bookManager->checkNodeIsRemovable($node))->cacheUntilEntityChanges($node);
return AccessResult::allowedIf($this->bookManager->checkNodeIsRemovable($node))->addCacheableDependency($node);
}
}

View file

@ -1,13 +1,7 @@
<?php
/**
* @file
* Contains \Drupal\book\BookBreadcrumbBuilder.
*/
namespace Drupal\book;
use Drupal\Core\Access\AccessManagerInterface;
use Drupal\Core\Breadcrumb\Breadcrumb;
use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface;
use Drupal\Core\Entity\EntityManagerInterface;
@ -30,13 +24,6 @@ class BookBreadcrumbBuilder implements BreadcrumbBuilderInterface {
*/
protected $nodeStorage;
/**
* The access manager.
*
* @var \Drupal\Core\Access\AccessManagerInterface
*/
protected $accessManager;
/**
* The current user account.
*
@ -49,14 +36,11 @@ class BookBreadcrumbBuilder implements BreadcrumbBuilderInterface {
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager service.
* @param \Drupal\Core\Access\AccessManagerInterface $access_manager
* The access manager.
* @param \Drupal\Core\Session\AccountInterface $account
* The current user account.
*/
public function __construct(EntityManagerInterface $entity_manager, AccessManagerInterface $access_manager, AccountInterface $account) {
public function __construct(EntityManagerInterface $entity_manager, AccountInterface $account) {
$this->nodeStorage = $entity_manager->getStorage('node');
$this->accessManager = $access_manager;
$this->account = $account;
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\BookExport.
*/
namespace Drupal\book;
use Drupal\Core\Entity\EntityManagerInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\BookManager.
*/
namespace Drupal\book;
use Drupal\Component\Utility\Unicode;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\BookManagerInterface.
*/
namespace Drupal\book;
use Drupal\Core\Form\FormStateInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\BookOutline.
*/
namespace Drupal\book;
/**

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\BookOutlineStorage.
*/
namespace Drupal\book;
use Drupal\Core\Database\Connection;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\BookOutlineStorageInterface.
*/
namespace Drupal\book;
/**

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\BookUninstallValidator.
*/
namespace Drupal\book;
use Drupal\Core\Entity\Query\QueryFactory;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\Cache\BookNavigationCacheContext.
*/
namespace Drupal\book\Cache;
use Drupal\Core\Cache\CacheableMetadata;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\Controller\BookController.
*/
namespace Drupal\book\Controller;
use Drupal\book\BookExport;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\Form\BookAdminEditForm.
*/
namespace Drupal\book\Form;
use Drupal\book\BookManager;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\Form\BookOutlineForm.
*/
namespace Drupal\book\Form;
use Drupal\book\BookManagerInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\Form\BookRemoveForm.
*/
namespace Drupal\book\Form;
use Drupal\book\BookManagerInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\Form\BookSettingsForm.
*/
namespace Drupal\book\Form;
use Drupal\Core\Form\ConfigFormBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\Plugin\Block\BookNavigationBlock.
*/
namespace Drupal\book\Plugin\Block;
use Drupal\Core\Block\BlockBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\Plugin\migrate\destination\Book.
*/
namespace Drupal\book\Plugin\migrate\destination;
use Drupal\Core\Entity\EntityInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\Plugin\migrate\source\d6\Book.
*/
namespace Drupal\book\Plugin\migrate\source\d6;
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;

View file

@ -1,9 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\ProxyClass\BookUninstallValidator.
*/
// @codingStandardsIgnoreFile
/**
* This file was generated via php core/scripts/generate-proxy-class.php 'Drupal\book\BookUninstallValidator' "core/modules/book/src".

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\book\Tests\BookBreadcrumbTest.
*/
namespace Drupal\book\Tests;
use Drupal\simpletest\WebTestBase;

View file

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

View file

@ -1,99 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\book\Tests\BookUninstallTest.
*/
namespace Drupal\book\Tests;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\simpletest\KernelTestBase;
/**
* Tests that the Book module cannot be uninstalled if books exist.
*
* @group book
*/
class BookUninstallTest extends KernelTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['system', 'user', 'field', 'filter', 'text', 'node', 'book'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installEntitySchema('user');
$this->installEntitySchema('node');
$this->installSchema('book', array('book'));
$this->installSchema('node', array('node_access'));
$this->installConfig(array('node', 'book', 'field'));
// For uninstall to work.
$this->installSchema('user', array('users_data'));
}
/**
* Tests the book_system_info_alter() method.
*/
public function testBookUninstall() {
// No nodes exist.
$validation_reasons = \Drupal::service('module_installer')->validateUninstall(['book']);
$this->assertEqual([], $validation_reasons, 'The book module is not required.');
$content_type = NodeType::create(array(
'type' => $this->randomMachineName(),
'name' => $this->randomString(),
));
$content_type->save();
$book_config = $this->config('book.settings');
$allowed_types = $book_config->get('allowed_types');
$allowed_types[] = $content_type->id();
$book_config->set('allowed_types', $allowed_types)->save();
$node = Node::create(array('title' => $this->randomString(), 'type' => $content_type->id()));
$node->book['bid'] = 'new';
$node->save();
// One node in a book but not of type book.
$validation_reasons = \Drupal::service('module_installer')->validateUninstall(['book']);
$this->assertEqual(['To uninstall Book, delete all content that is part of a book'], $validation_reasons['book']);
$book_node = Node::create(array('title' => $this->randomString(), 'type' => 'book'));
$book_node->book['bid'] = FALSE;
$book_node->save();
// Two nodes, one in a book but not of type book and one book node (which is
// not in a book).
$validation_reasons = \Drupal::service('module_installer')->validateUninstall(['book']);
$this->assertEqual(['To uninstall Book, delete all content that is part of a book'], $validation_reasons['book']);
$node->delete();
// One node of type book but not actually part of a book.
$validation_reasons = \Drupal::service('module_installer')->validateUninstall(['book']);
$this->assertEqual(['To uninstall Book, delete all content that has the Book content type'], $validation_reasons['book']);
$book_node->delete();
// No nodes exist therefore the book module is not required.
$module_data = _system_rebuild_module_data();
$this->assertFalse(isset($module_data['book']->info['required']), 'The book module is not required.');
$node = Node::create(array('title' => $this->randomString(), 'type' => $content_type->id()));
$node->save();
// One node exists but is not part of a book therefore the book module is
// not required.
$validation_reasons = \Drupal::service('module_installer')->validateUninstall(['book']);
$this->assertEqual([], $validation_reasons, 'The book module is not required.');
// Uninstall the Book module and check the node type is deleted.
\Drupal::service('module_installer')->uninstall(array('book'));
$this->assertNull(NodeType::load('book'), "The book node type does not exist.");
}
}

View file

@ -1,46 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\book\Tests\Migrate\d6\MigrateBookConfigsTest.
*/
namespace Drupal\book\Tests\Migrate\d6;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
* Upgrade variables to book.settings.yml.
*
* @group migrate_drupal_6
*/
class MigrateBookConfigsTest extends MigrateDrupal6TestBase {
use SchemaCheckTestTrait;
/**
* {@inheritdoc}
*/
public static $modules = ['book'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('d6_book_settings');
}
/**
* Tests migration of book variables to book.settings.yml.
*/
public function testBookSettings() {
$config = $this->config('book.settings');
$this->assertIdentical('book', $config->get('child_type'));
$this->assertIdentical('all pages', $config->get('block.navigation.mode'));
$this->assertIdentical(array('book'), $config->get('allowed_types'));
$this->assertConfigSchema(\Drupal::service('config.typed'), 'book.settings', $config->get());
}
}

View file

@ -1,65 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\book\Tests\Migrate\d6\MigrateBookTest.
*/
namespace Drupal\book\Tests\Migrate\d6;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
use Drupal\node\Entity\Node;
/**
* Upgrade book structure.
*
* @group migrate_drupal_6
*/
class MigrateBookTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['book'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installSchema('book', ['book']);
$this->installSchema('node', ['node_access']);
$this->migrateContent();
$this->executeMigration('d6_book');
}
/**
* Tests the Drupal 6 book structure to Drupal 8 migration.
*/
public function testBook() {
$nodes = Node::loadMultiple(array(4, 5, 6, 7, 8));
$this->assertIdentical('4', $nodes[4]->book['bid']);
$this->assertIdentical('0', $nodes[4]->book['pid']);
$this->assertIdentical('4', $nodes[5]->book['bid']);
$this->assertIdentical('4', $nodes[5]->book['pid']);
$this->assertIdentical('4', $nodes[6]->book['bid']);
$this->assertIdentical('5', $nodes[6]->book['pid']);
$this->assertIdentical('4', $nodes[7]->book['bid']);
$this->assertIdentical('5', $nodes[7]->book['pid']);
$this->assertIdentical('8', $nodes[8]->book['bid']);
$this->assertIdentical('0', $nodes[8]->book['pid']);
$tree = \Drupal::service('book.manager')->bookTreeAllData(4);
$this->assertIdentical('4', $tree['49990 Node 4 4']['link']['nid']);
$this->assertIdentical('5', $tree['49990 Node 4 4']['below']['50000 Node 5 5']['link']['nid']);
$this->assertIdentical('6', $tree['49990 Node 4 4']['below']['50000 Node 5 5']['below']['50000 Node 6 6']['link']['nid']);
$this->assertIdentical('7', $tree['49990 Node 4 4']['below']['50000 Node 5 5']['below']['50000 Node 7 7']['link']['nid']);
$this->assertIdentical(array(), $tree['49990 Node 4 4']['below']['50000 Node 5 5']['below']['50000 Node 6 6']['below']);
$this->assertIdentical(array(), $tree['49990 Node 4 4']['below']['50000 Node 5 5']['below']['50000 Node 7 7']['below']);
}
}