Update to Drupal 8.2.0. For more information, see https://www.drupal.org/project/drupal/releases/8.2.0

This commit is contained in:
Pantheon Automation 2016-10-06 15:16:20 -07:00 committed by Greg Anderson
parent 2f563ab520
commit f1c8716f57
1732 changed files with 52334 additions and 11780 deletions

View file

@ -2,6 +2,7 @@ langcode: en
status: true
dependencies:
config:
- core.entity_view_display.comment.comment_forum.default
- field.field.node.forum.body
- field.field.node.forum.comment_forum
- field.field.node.forum.taxonomy_forums
@ -26,6 +27,7 @@ content:
type: comment_default
weight: 20
settings:
view_mode: default
pager_id: 0
third_party_settings: { }
links:

View file

@ -6,12 +6,12 @@ services:
- { name: backend_overridable }
forum.breadcrumb.node:
class: Drupal\forum\Breadcrumb\ForumNodeBreadcrumbBuilder
arguments: ['@entity.manager', '@config.factory', '@forum_manager']
arguments: ['@entity.manager', '@config.factory', '@forum_manager', '@string_translation']
tags:
- { name: breadcrumb_builder, priority: 1001 }
forum.breadcrumb.listing:
class: Drupal\forum\Breadcrumb\ForumListingBreadcrumbBuilder
arguments: ['@entity.manager', '@config.factory', '@forum_manager']
arguments: ['@entity.manager', '@config.factory', '@forum_manager', '@string_translation']
tags:
- { name: breadcrumb_builder, priority: 1001 }
forum.index_storage:

View file

@ -9,6 +9,7 @@ use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Link;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\forum\ForumManagerInterface;
/**
@ -50,11 +51,14 @@ abstract class ForumBreadcrumbBuilderBase implements BreadcrumbBuilderInterface
* The configuration factory.
* @param \Drupal\forum\ForumManagerInterface $forum_manager
* The forum manager service.
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The string translation service.
*/
public function __construct(EntityManagerInterface $entity_manager, ConfigFactoryInterface $config_factory, ForumManagerInterface $forum_manager) {
public function __construct(EntityManagerInterface $entity_manager, ConfigFactoryInterface $config_factory, ForumManagerInterface $forum_manager, TranslationInterface $string_translation) {
$this->entityManager = $entity_manager;
$this->config = $config_factory->get('forum.settings');
$this->forumManager = $forum_manager;
$this->setStringTranslation($string_translation);
}
/**

View file

@ -78,9 +78,10 @@ class ForumForm extends TermForm {
$route_name = $this->urlStub == 'container' ? 'entity.taxonomy_term.forum_edit_container_form' : 'entity.taxonomy_term.forum_edit_form';
$route_parameters = ['taxonomy_term' => $term->id()];
$link = $this->l($this->t('Edit'), new Url($route_name, $route_parameters));
$view_link = $term->link($term->getName());
switch ($status) {
case SAVED_NEW:
drupal_set_message($this->t('Created new @type %term.', array('%term' => $term->getName(), '@type' => $this->forumFormType)));
drupal_set_message($this->t('Created new @type %term.', array('%term' => $view_link, '@type' => $this->forumFormType)));
$this->logger('forum')->notice('Created new @type %term.', array('%term' => $term->getName(), '@type' => $this->forumFormType, 'link' => $link));
$form_state->setValue('tid', $term->id());
break;

View file

@ -121,8 +121,7 @@ class ForumTest extends WebTestBase {
//Check that the basic forum install creates a default forum topic
$this->drupalGet('/forum');
// Look for the "General discussion" default forum
$this->assertRaw(t('<a href="'. Url::fromRoute('forum.page', ['taxonomy_term' => 1])->toString() .'">General discussion</a>'), "Found the default forum at the /forum listing");
$this->assertRaw(Link::createFromRoute(t('General discussion'), 'forum.page', ['taxonomy_term' => 1])->toString(), "Found the default forum at the /forum listing");
// Check the presence of expected cache tags.
$this->assertCacheTag('config:forum.settings');
@ -416,14 +415,18 @@ class ForumTest extends WebTestBase {
$this->drupalPostForm('admin/structure/forum/add/' . $type, $edit, t('Save'));
$this->assertResponse(200);
$type = ($type == 'container') ? 'forum container' : 'forum';
$this->assertRaw(
$this->assertText(
t(
'Created new @type %term.',
array('%term' => $name, '@type' => t($type))
'Created new @type @term.',
array('@term' => $name, '@type' => t($type))
),
format_string('@type was created', array('@type' => ucfirst($type)))
);
// Verify that the creation message contains a link to a term.
$view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'term/'));
$this->assert(isset($view_link), 'The message area contains a link to a term');
// Verify forum.
$term = db_query("SELECT * FROM {taxonomy_term_field_data} t WHERE t.vid = :vid AND t.name = :name AND t.description__value = :desc AND t.default_langcode = 1", array(':vid' => $this->config('forum.settings')->get('vocabulary'), ':name' => $name, ':desc' => $description))->fetchAssoc();
$this->assertTrue(!empty($term), 'The ' . $type . ' exists in the database');
@ -541,13 +544,17 @@ class ForumTest extends WebTestBase {
$type = t('Forum topic');
if ($container) {
$this->assertNoRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), 'Forum topic was not created');
$this->assertNoText(t('@type @title has been created.', array('@type' => $type, '@title' => $title)), 'Forum topic was not created');
$this->assertRaw(t('The item %title is a forum container, not a forum.', array('%title' => $forum['name'])), 'Error message was shown');
return;
}
else {
$this->assertRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), 'Forum topic was created');
$this->assertText(t('@type @title has been created.', array('@type' => $type, '@title' => $title)), 'Forum topic was created');
$this->assertNoRaw(t('The item %title is a forum container, not a forum.', array('%title' => $forum['name'])), 'No error message was shown');
// Verify that the creation message contains a link to a term.
$view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'term/'));
$this->assert(isset($view_link), 'The message area contains a link to a term');
}
// Retrieve node object, ensure that the topic was created and in the proper forum.
@ -623,7 +630,7 @@ class ForumTest extends WebTestBase {
$edit['taxonomy_forums'] = $this->rootForum['tid'];
$edit['shadow'] = TRUE;
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
$this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit['title[0][value]'])), 'Forum node was edited');
$this->assertText(t('Forum topic @title has been updated.', array('@title' => $edit['title[0][value]'])), 'Forum node was edited');
// Verify topic was moved to a different forum.
$forum_tid = db_query("SELECT tid FROM {forum} WHERE nid = :nid AND vid = :vid", array(

View file

@ -42,6 +42,7 @@ class ForumBreadcrumbBuilderBaseTest extends UnitTestCase {
)
);
$forum_manager = $this->getMock('Drupal\forum\ForumManagerInterface');
$translation_manager = $this->getMock('Drupal\Core\StringTranslation\TranslationInterface');
// Make an object to test.
$builder = $this->getMockForAbstractClass(
@ -51,6 +52,7 @@ class ForumBreadcrumbBuilderBaseTest extends UnitTestCase {
$entity_manager,
$config_factory,
$forum_manager,
$translation_manager,
)
);
@ -58,6 +60,7 @@ class ForumBreadcrumbBuilderBaseTest extends UnitTestCase {
$property_names = array(
'entityManager' => $entity_manager,
'forumManager' => $forum_manager,
'stringTranslation' => $translation_manager,
);
foreach ($property_names as $property_name => $property_value) {
$this->assertAttributeEquals(
@ -82,6 +85,10 @@ class ForumBreadcrumbBuilderBaseTest extends UnitTestCase {
*/
public function testBuild() {
// Build all our dependencies, backwards.
$translation_manager = $this->getMockBuilder('Drupal\Core\StringTranslation\TranslationInterface')
->disableOriginalConstructor()
->getMock();
$forum_manager = $this->getMockBuilder('Drupal\forum\ForumManagerInterface')
->disableOriginalConstructor()
->getMock();
@ -125,6 +132,7 @@ class ForumBreadcrumbBuilderBaseTest extends UnitTestCase {
$entity_manager,
$config_factory,
$forum_manager,
$translation_manager,
)
);

View file

@ -46,6 +46,7 @@ class ForumListingBreadcrumbBuilderTest extends UnitTestCase {
$entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
$config_factory = $this->getConfigFactoryStub(array());
$forum_manager = $this->getMock('Drupal\forum\ForumManagerInterface');
$translation_manager = $this->getMock('Drupal\Core\StringTranslation\TranslationInterface');
// Make an object to test.
$builder = $this->getMockBuilder('Drupal\forum\Breadcrumb\ForumListingBreadcrumbBuilder')
@ -53,6 +54,7 @@ class ForumListingBreadcrumbBuilderTest extends UnitTestCase {
$entity_manager,
$config_factory,
$forum_manager,
$translation_manager,
))
->setMethods(NULL)
->getMock();
@ -116,6 +118,10 @@ class ForumListingBreadcrumbBuilderTest extends UnitTestCase {
*/
public function testBuild() {
// Build all our dependencies, backwards.
$translation_manager = $this->getMockBuilder('Drupal\Core\StringTranslation\TranslationInterface')
->disableOriginalConstructor()
->getMock();
$prophecy = $this->prophesize('Drupal\taxonomy\Entity\Term');
$prophecy->label()->willReturn('Something');
$prophecy->id()->willReturn(1);
@ -177,6 +183,7 @@ class ForumListingBreadcrumbBuilderTest extends UnitTestCase {
$entity_manager,
$config_factory,
$forum_manager,
$translation_manager,
)
);

View file

@ -51,6 +51,8 @@ class ForumNodeBreadcrumbBuilderTest extends UnitTestCase {
->method('checkNodeType')
->will($this->returnValue(TRUE));
$translation_manager = $this->getMock('Drupal\Core\StringTranslation\TranslationInterface');
// Make an object to test.
$builder = $this->getMockBuilder('Drupal\forum\Breadcrumb\ForumNodeBreadcrumbBuilder')
->setConstructorArgs(
@ -58,6 +60,7 @@ class ForumNodeBreadcrumbBuilderTest extends UnitTestCase {
$entity_manager,
$config_factory,
$forum_manager,
$translation_manager,
)
)
->setMethods(NULL)
@ -123,6 +126,10 @@ class ForumNodeBreadcrumbBuilderTest extends UnitTestCase {
*/
public function testBuild() {
// Build all our dependencies, backwards.
$translation_manager = $this->getMockBuilder('Drupal\Core\StringTranslation\TranslationInterface')
->disableOriginalConstructor()
->getMock();
$prophecy = $this->prophesize('Drupal\taxonomy\Entity\Term');
$prophecy->label()->willReturn('Something');
$prophecy->id()->willReturn(1);
@ -185,6 +192,7 @@ class ForumNodeBreadcrumbBuilderTest extends UnitTestCase {
$entity_manager,
$config_factory,
$forum_manager,
$translation_manager,
)
);