upgrades core to 8.4.2

This commit is contained in:
Bachir Soussi Chiadmi
2017-11-14 16:09:54 +01:00
parent bd60eff9b3
commit c2b4e25be4
3504 changed files with 140306 additions and 38684 deletions
+3 -3
View File
@@ -6,8 +6,8 @@ package: Core
# core: 8.x
configure: entity.contact_form.collection
# Information added by Drupal.org packaging script on 2017-08-16
version: '8.3.7'
# Information added by Drupal.org packaging script on 2017-11-03
version: '8.4.2'
core: '8.x'
project: 'drupal'
datestamp: 1502903957
datestamp: 1509719929
@@ -7,7 +7,6 @@
use Drupal\contact\Entity\ContactForm;
/**
* Initialize 'message' and 'redirect' field values to 'contact_form' entities.
*/
@@ -20,12 +20,12 @@ class ContactFormAccessControlHandler extends EntityAccessControlHandler {
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
if ($operation == 'view') {
// Do not allow access personal form via site-wide route.
return AccessResult::allowedIf($account->hasPermission('access site-wide contact form') && $entity->id() !== 'personal')->cachePerPermissions();
return AccessResult::allowedIfHasPermission($account, 'access site-wide contact form')->andIf(AccessResult::allowedIf($entity->id() !== 'personal'));
}
elseif ($operation == 'delete' || $operation == 'update') {
// Do not allow the 'personal' form to be deleted, as it's used for
// the personal contact form.
return AccessResult::allowedIf($account->hasPermission('administer contact forms') && $entity->id() !== 'personal')->cachePerPermissions();
return AccessResult::allowedIfHasPermission($account, 'administer contact forms')->andIf(AccessResult::allowedIf($entity->id() !== 'personal'));
}
return parent::checkAccess($entity, $operation, $account);
@@ -65,7 +65,8 @@ class ContactController extends ControllerBase {
if (empty($contact_form)) {
if ($this->currentUser()->hasPermission('administer contact forms')) {
drupal_set_message($this->t('The contact form has not been configured. <a href=":add">Add one or more forms</a> .', [
':add' => $this->url('contact.form_add')]), 'error');
':add' => $this->url('contact.form_add'),
]), 'error');
return [];
}
else {
+2 -1
View File
@@ -13,6 +13,7 @@ use Drupal\Core\Field\BaseFieldDefinition;
* @ContentEntityType(
* id = "contact_message",
* label = @Translation("Contact message"),
* bundle_label = @Translation("Contact form"),
* handlers = {
* "access" = "Drupal\contact\ContactMessageAccessControlHandler",
* "storage" = "Drupal\Core\Entity\ContentEntityNullStorage",
@@ -107,7 +108,7 @@ class Message extends ContentEntityBase implements MessageInterface {
* {@inheritdoc}
*/
public function copySender() {
return (bool)$this->get('copy')->value;
return (bool) $this->get('copy')->value;
}
/**
@@ -10,7 +10,7 @@ use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
*
* @MigrateSource(
* id = "contact_category",
* source_provider = "contact"
* source_module = "contact"
* )
*/
class ContactCategory extends DrupalSqlBase {
@@ -7,7 +7,7 @@ use Drupal\migrate_drupal\Plugin\migrate\source\Variable;
/**
* @MigrateSource(
* id = "contact_settings",
* source_provider = "contact"
* source_module = "contact"
* )
*/
class ContactSettings extends Variable {
@@ -8,8 +8,8 @@ dependencies:
- contact
- user
# Information added by Drupal.org packaging script on 2017-08-16
version: '8.3.7'
# Information added by Drupal.org packaging script on 2017-11-03
version: '8.4.2'
core: '8.x'
project: 'drupal'
datestamp: 1502903957
datestamp: 1509719929
@@ -7,8 +7,8 @@ package: Testing
dependencies:
- contact
# Information added by Drupal.org packaging script on 2017-08-16
version: '8.3.7'
# Information added by Drupal.org packaging script on 2017-11-03
version: '8.4.2'
core: '8.x'
project: 'drupal'
datestamp: 1502903957
datestamp: 1509719929
@@ -9,8 +9,8 @@ dependencies:
- views
- user
# Information added by Drupal.org packaging script on 2017-08-16
version: '8.3.7'
# Information added by Drupal.org packaging script on 2017-11-03
version: '8.4.2'
core: '8.x'
project: 'drupal'
datestamp: 1502903957
datestamp: 1509719929
@@ -6,8 +6,8 @@ use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Render\PlainTextOutput;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Test\AssertMailTrait;
use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait;
use Drupal\user\RoleInterface;
/**
@@ -139,7 +139,7 @@ class ContactPersonalTest extends BrowserTestBase {
$this->drupalGet('user/' . $this->contactUser->id());
$contact_link = '/user/' . $this->contactUser->id() . '/contact';
$this->assertResponse(200);
$this->assertNoLinkByHref ($contact_link, 'The "contact" tab is hidden on profiles for users with no email address');
$this->assertNoLinkByHref($contact_link, 'The "contact" tab is hidden on profiles for users with no email address');
// Restore original email address.
$this->contactUser->setEmail($original_email)->save();
@@ -44,6 +44,27 @@ class ContactSitewideTest extends BrowserTestBase {
* Tests configuration options and the site-wide contact form.
*/
public function testSiteWideContact() {
// Tests name and email fields for authenticated and anonymous users.
$this->drupalLogin($this->drupalCreateUser(['access site-wide contact form']));
$this->drupalGet('contact');
// Ensure that there is no textfield for name.
$this->assertFalse($this->xpath('//input[@name=:name]', [':name' => 'name']));
// Ensure that there is no textfield for email.
$this->assertFalse($this->xpath('//input[@name=:name]', [':name' => 'mail']));
// Logout and retrieve the page as an anonymous user
$this->drupalLogout();
user_role_grant_permissions('anonymous', ['access site-wide contact form']);
$this->drupalGet('contact');
// Ensure that there is textfield for name.
$this->assertTrue($this->xpath('//input[@name=:name]', [':name' => 'name']));
// Ensure that there is textfield for email.
$this->assertTrue($this->xpath('//input[@name=:name]', [':name' => 'mail']));
// Create and log in administrative user.
$admin_user = $this->drupalCreateUser([
'access site-wide contact form',
@@ -0,0 +1,53 @@
<?php
namespace Drupal\Tests\contact\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
/**
* Tests contact update path.
*
* @group contact
*/
class ContactUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
];
}
/**
* Tests contact_form updates.
*
* @see contact_post_update_add_message_redirect_field_to_contact_form()
*/
public function testPostUpdateContactFormFields() {
// Check that contact_form does not have fields redirect and message.
$config_factory = \Drupal::configFactory();
// Check that contact_form entities are more than zero.
$contact_forms = $config_factory->listAll('contact.form.');
$this->assertTrue(count($contact_forms), 'There are contact forms to update.');
foreach ($contact_forms as $contact_config_name) {
$contact_form_data = $config_factory->get($contact_config_name)->get();
$this->assertFalse(isset($contact_form_data['message']), 'Prior to running the update the "message" key does not exist.');
$this->assertFalse(isset($contact_form_data['redirect']), 'Prior to running the update the "redirect" key does not exist.');
}
// Run updates.
$this->runUpdates();
// Check that the contact_form entities have been updated.
foreach ($contact_forms as $contact_config_name) {
$contact_form_data = $config_factory->get($contact_config_name)->get();
$this->assertTrue(isset($contact_form_data['message']), 'After running the update the "message" key exists.');
$this->assertEqual('Your message has been sent.', $contact_form_data['message']);
$this->assertTrue(isset($contact_form_data['redirect']), 'After running the update the "redirect" key exists.');
$this->assertEqual('', $contact_form_data['redirect']);
}
}
}
@@ -136,7 +136,7 @@ class MailHandlerTest extends UnitTestCase {
$this->mailManager->expects($this->any())
->method('mail')
->willReturnCallback(
function($module, $key, $to, $langcode, $params, $from) use (&$results) {
function ($module, $key, $to, $langcode, $params, $from) use (&$results) {
$result = array_shift($results);
$this->assertEquals($module, $result['module']);
$this->assertEquals($key, $result['key']);
@@ -234,7 +234,7 @@ class MailHandlerTest extends UnitTestCase {
$results[] = $result + $default_result;
$data[] = [$message, $sender, $results];
//For authenticated user.
// For authenticated user.
$results = [];
$message = $this->getAuthenticatedMockMessage();
$sender = $this->getMockSender(FALSE, 'user@drupal.org');