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\contact\Access\ContactPageAccess.
*/
namespace Drupal\contact\Access;
use Drupal\Core\Access\AccessResult;
@ -79,7 +74,7 @@ class ContactPageAccess implements AccessInterface {
}
// If requested user has been blocked, do not allow users to contact them.
$access->cacheUntilEntityChanges($contact_account);
$access->addCacheableDependency($contact_account);
if ($contact_account->isBlocked()) {
return $access;
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contact\ContactFormAccessControlHandler.
*/
namespace Drupal\contact;
use Drupal\Core\Access\AccessResult;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contact\ContactFormEditForm.
*/
namespace Drupal\contact;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;

View file

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

View file

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

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contact\ContactMessageAccessControlHandler.
*/
namespace Drupal\contact;
use Drupal\Core\Access\AccessResult;

View file

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

View file

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

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contact\Entity\Message.
*/
namespace Drupal\contact\Entity;
use Drupal\Core\Entity\ContentEntityBase;

View file

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

View file

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

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contact\MailHandlerInterface.
*/
namespace Drupal\contact;
use Drupal\Core\Session\AccountInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contact\MessageForm.
*/
namespace Drupal\contact;
use Drupal\Core\Datetime\DateFormatterInterface;

View file

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

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contact\MessageViewBuilder.
*/
namespace Drupal\contact;
use Drupal\Core\Entity\EntityInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contact\Plugin\migrate\source\ContactCategory.
*/
namespace Drupal\contact\Plugin\migrate\source;
use Drupal\migrate\Row;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contact\Plugin\migrate\source\ContactSettings.
*/
namespace Drupal\contact\Plugin\migrate\source;
use Drupal\migrate_drupal\Plugin\migrate\source\Variable;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contact\Plugin\views\field\ContactLink.
*/
namespace Drupal\contact\Plugin\views\field;
use Drupal\Core\Form\FormStateInterface;

View file

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

View file

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

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contact\Tests\ContactPersonalTest.
*/
namespace Drupal\contact\Tests;
use Drupal\Component\Utility\SafeMarkup;
@ -232,11 +227,6 @@ class ContactPersonalTest extends WebTestBase {
$flood_limit = 3;
$this->config('contact.settings')->set('flood.limit', $flood_limit)->save();
// Clear flood table in preparation for flood test and allow other checks to complete.
db_delete('flood')->execute();
$num_records_flood = db_query("SELECT COUNT(*) FROM {flood}")->fetchField();
$this->assertIdentical($num_records_flood, '0', 'Flood table emptied.');
$this->drupalLogin($this->webUser);
// Submit contact form with correct values and check flood interval.

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contact\Tests\ContactSitewideTest.
*/
namespace Drupal\contact\Tests;
use Drupal\Component\Utility\Unicode;
@ -185,10 +180,6 @@ class ContactSitewideTest extends WebTestBase {
$this->assertNoRaw(t('Contact form %label has been added.', array('%label' => $label)));
$this->assertRaw(t('The machine-readable name is already in use. It must be unique.'));
// Clear flood table in preparation for flood test and allow other checks to complete.
db_delete('flood')->execute();
$num_records_after = db_query("SELECT COUNT(*) FROM {flood}")->fetchField();
$this->assertIdentical($num_records_after, '0', 'Flood table emptied.');
$this->drupalLogout();
// Check to see that anonymous user cannot see contact page without permission.

View file

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

View file

@ -1,75 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\contact\Tests\MessageEntityTest.
*/
namespace Drupal\contact\Tests;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
/**
* Tests the message entity class.
*
* @group contact
* @see \Drupal\contact\Entity\Message
*/
class MessageEntityTest extends EntityUnitTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array(
'system',
'contact',
'field',
'user',
'contact_test',
);
protected function setUp() {
parent::setUp();
$this->installConfig(array('contact', 'contact_test'));
}
/**
* Test some of the methods.
*/
public function testMessageMethods() {
$message_storage = $this->container->get('entity.manager')->getStorage('contact_message');
$message = $message_storage->create(array('contact_form' => 'feedback'));
// Check for empty values first.
$this->assertEqual($message->getMessage(), '');
$this->assertEqual($message->getSenderName(), '');
$this->assertEqual($message->getSenderMail(), '');
$this->assertFalse($message->copySender());
// Check for default values.
$this->assertEqual('feedback', $message->getContactForm()->id());
$this->assertFalse($message->isPersonal());
// Set some values and check for them afterwards.
$message->setMessage('welcome_message');
$message->setSenderName('sender_name');
$message->setSenderMail('sender_mail');
$message->setCopySender(TRUE);
$this->assertEqual($message->getMessage(), 'welcome_message');
$this->assertEqual($message->getSenderName(), 'sender_name');
$this->assertEqual($message->getSenderMail(), 'sender_mail');
$this->assertTrue($message->copySender());
$no_access_user = $this->createUser(['uid' => 2]);
$access_user = $this->createUser(['uid' => 3], ['access site-wide contact form']);
$admin = $this->createUser(['uid' => 4], ['administer contact forms']);
$this->assertFalse(\Drupal::entityManager()->getAccessControlHandler('contact_message')->createAccess(NULL, $no_access_user));
$this->assertTrue(\Drupal::entityManager()->getAccessControlHandler('contact_message')->createAccess(NULL, $access_user));
$this->assertTrue($message->access('edit', $admin));
$this->assertFalse($message->access('edit', $access_user));
}
}

View file

@ -1,69 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\contact\Tests\Migrate\MigrateContactCategoryTest.
*/
namespace Drupal\contact\Tests\Migrate;
use Drupal\contact\Entity\ContactForm;
use Drupal\contact\ContactFormInterface;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
* Migrate contact categories to contact.form.*.yml.
*
* @group contact_category
*/
class MigrateContactCategoryTest extends MigrateDrupal6TestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('contact');
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('contact_category');
}
/**
* Performs various assertions on a single contact form entity.
*
* @param string $id
* The contact form ID.
* @param string $expected_label
* The expected label.
* @param string[] $expected_recipients
* The recipient e-mail addresses the form should have.
* @param string $expected_reply
* The expected reply message.
* @param int $expected_weight
* The contact form's expected weight.
*/
protected function assertEntity($id, $expected_label, array $expected_recipients, $expected_reply, $expected_weight) {
/** @var \Drupal\contact\ContactFormInterface $entity */
$entity = ContactForm::load($id);
$this->assertTrue($entity instanceof ContactFormInterface);
$this->assertIdentical($expected_label, $entity->label());
$this->assertIdentical($expected_recipients, $entity->getRecipients());
$this->assertIdentical($expected_reply, $entity->getReply());
$this->assertIdentical($expected_weight, $entity->getWeight());
}
/**
* The Drupal 6 and 7 contact categories to Drupal 8 migration.
*/
public function testContactCategory() {
$this->assertEntity('website_feedback', 'Website feedback', ['admin@example.com'], '', 0);
$this->assertEntity('some_other_category', 'Some other category', ['test@example.com'], 'Thanks for contacting us, we will reply ASAP!', 1);
$this->assertEntity('a_category_much_longer_than_thir', 'A category much longer than thirty two characters', ['fortyninechars@example.com'], '', 2);
}
}

View file

@ -1,57 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\contact\Tests\Migrate\d6\MigrateContactCategoryTest.
*/
namespace Drupal\contact\Tests\Migrate\d6;
use Drupal\contact\Entity\ContactForm;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
* Migrate contact categories to contact.form.*.yml.
*
* @group migrate_drupal_6
*/
class MigrateContactCategoryTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['contact'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('contact_category');
}
/**
* The Drupal 6 contact categories to Drupal 8 migration.
*/
public function testContactCategory() {
/** @var \Drupal\contact\Entity\ContactForm $contact_form */
$contact_form = ContactForm::load('website_feedback');
$this->assertIdentical('Website feedback', $contact_form->label());
$this->assertIdentical(array('admin@example.com'), $contact_form->getRecipients());
$this->assertIdentical('', $contact_form->getReply());
$this->assertIdentical(0, $contact_form->getWeight());
$contact_form = ContactForm::load('some_other_category');
$this->assertIdentical('Some other category', $contact_form->label());
$this->assertIdentical(array('test@example.com'), $contact_form->getRecipients());
$this->assertIdentical('Thanks for contacting us, we will reply ASAP!', $contact_form->getReply());
$this->assertIdentical(1, $contact_form->getWeight());
$contact_form = ContactForm::load('a_category_much_longer_than_thir');
$this->assertIdentical('A category much longer than thirty two characters', $contact_form->label());
$this->assertIdentical(array('fortyninechars@example.com'), $contact_form->getRecipients());
$this->assertIdentical('', $contact_form->getReply());
$this->assertIdentical(2, $contact_form->getWeight());
}
}

View file

@ -1,46 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\contact\Tests\Migrate\d6\MigrateContactSettingsTest.
*/
namespace Drupal\contact\Tests\Migrate\d6;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
* Upgrade variables to contact.settings.yml.
*
* @group migrate_drupal_6
*/
class MigrateContactSettingsTest extends MigrateDrupal6TestBase {
use SchemaCheckTestTrait;
/**
* {@inheritdoc}
*/
public static $modules = ['contact'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigrations(['contact_category', 'd6_contact_settings']);
}
/**
* Tests migration of contact variables to contact.settings.yml.
*/
public function testContactSettings() {
$config = $this->config('contact.settings');
$this->assertIdentical(true, $config->get('user_default_enabled'));
$this->assertIdentical(3, $config->get('flood.limit'));
$this->assertIdentical('some_other_category', $config->get('default_form'));
$this->assertConfigSchema(\Drupal::service('config.typed'), 'contact.settings', $config->get());
}
}

View file

@ -1,43 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\contact\Tests\Migrate\d7\MigrateContactSettingsTest.
*/
namespace Drupal\contact\Tests\Migrate\d7;
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
/**
* Tests migration of Contact settings to configuration.
*
* @group migrate_drupal_7
*/
class MigrateContactSettingsTest extends MigrateDrupal7TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['contact'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('contact_category');
$this->executeMigration('d7_contact_settings');
}
/**
* Tests migration of Contact's variables to configuration.
*/
public function testContactSettings() {
$config = $this->config('contact.settings');
$this->assertTrue($config->get('user_default_enabled'));
$this->assertIdentical(33, $config->get('flood.limit'));
$this->assertEqual('website_testing', $config->get('default_form'));
}
}

View file

@ -1,13 +1,11 @@
<?php
/**
* @file
* Contains \Drupal\contact\Tests\Views\ContactFieldsTest.
*/
namespace Drupal\contact\Tests\Views;
use Drupal\field\Entity\FieldConfig;
use Drupal\views\Tests\ViewTestBase;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\contact\Entity\ContactForm;
/**
* Tests which checks that no fieldapi fields are added on contact.
@ -33,22 +31,22 @@ class ContactFieldsTest extends ViewTestBase {
protected function setUp() {
parent::setUp();
$this->fieldStorage = entity_create('field_storage_config', array(
$this->fieldStorage = FieldStorageConfig::create(array(
'field_name' => strtolower($this->randomMachineName()),
'entity_type' => 'contact_message',
'type' => 'text'
));
$this->fieldStorage->save();
entity_create('contact_form', array(
ContactForm::create([
'id' => 'contact_message',
'label' => 'Test contact form',
))->save();
])->save();
entity_create('field_config', array(
FieldConfig::create([
'field_storage' => $this->fieldStorage,
'bundle' => 'contact_message',
))->save();
])->save();
$this->container->get('views.views_data')->clear();
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contact\Tests\Views\ContactLinkTest.
*/
namespace Drupal\contact\Tests\Views;
use Drupal\Core\Cache\Cache;