l;l++)if(f=h[l]){f=
f.exec(a,e,this);if(!1===f)return null;if(f&&f!=e)return this.onNode(a,f);if(e.parent&&!e.name)break}return e},onNode:function(a,e){var h=e.type;return h==CKEDITOR.NODE_ELEMENT?this.onElement(a,e):h==CKEDITOR.NODE_TEXT?new CKEDITOR.htmlParser.text(this.onText(a,e.value)):h==CKEDITOR.NODE_COMMENT?new CKEDITOR.htmlParser.comment(this.onComment(a,e.value)):null},onAttribute:function(a,e,h,f){return(h=this.attributesRules[h])?h.exec(a,f,e,this):f}}});CKEDITOR.htmlParser.filterRulesGroup=a;a.prototype=
{add:function(a,e,h){this.rules.splice(this.findIndex(e),0,{value:a,priority:e,options:h})},addMany:function(a,e,h){for(var f=[this.findIndex(e),0],l=0,k=a.length;l /g,"\x26gt;")+"\x3c/textarea\x3e");return"\x3ccke:encoded\x3e"+encodeURIComponent(a)+"\x3c/cke:encoded\x3e"})}function p(a){return a.replace(N,function(a,b){return decodeURIComponent(b)})}function u(a){return a.replace(/\x3c!--(?!{cke_protected})[\s\S]+?--\x3e/g,
-function(a){return"\x3c!--"+w+"{C}"+encodeURIComponent(a).replace(/--/g,"%2D%2D")+"--\x3e"})}function v(a){return a.replace(/\x3c!--\{cke_protected\}\{C\}([\s\S]+?)--\x3e/g,function(a,b){return decodeURIComponent(b)})}function r(a,b){var d=b._.dataStore;return a.replace(/\x3c!--\{cke_protected\}([\s\S]+?)--\x3e/g,function(a,b){return decodeURIComponent(b)}).replace(/\{cke_protected_(\d+)\}/g,function(a,b){return d&&d[b]||""})}function n(a,b){var d=[],c=b.config.protectedSource,g=b._.dataStore||(b._.dataStore=
+k=l.length,d,b,g,n;for(n=0;n /g,"\x26gt;")+"\x3c/textarea\x3e");return"\x3ccke:encoded\x3e"+encodeURIComponent(a)+"\x3c/cke:encoded\x3e"})}function n(a){return a.replace(N,function(a,b){return decodeURIComponent(b)})}function v(a){return a.replace(/\x3c!--(?!{cke_protected})[\s\S]+?--\x3e/g,
+function(a){return"\x3c!--"+w+"{C}"+encodeURIComponent(a).replace(/--/g,"%2D%2D")+"--\x3e"})}function u(a){return a.replace(/\x3c!--\{cke_protected\}\{C\}([\s\S]+?)--\x3e/g,function(a,b){return decodeURIComponent(b)})}function r(a,b){var d=b._.dataStore;return a.replace(/\x3c!--\{cke_protected\}([\s\S]+?)--\x3e/g,function(a,b){return decodeURIComponent(b)}).replace(/\{cke_protected_(\d+)\}/g,function(a,b){return d&&d[b]||""})}function p(a,b){var d=[],c=b.config.protectedSource,g=b._.dataStore||(b._.dataStore=
{id:1}),e=/<\!--\{cke_temp(comment)?\}(\d*?)--\x3e/g,c=[/");
+
+ // Make sure HTML tags are filtered out in admin/reports/dblog/event/ too.
+ $this->generateLogEntries(1, ['message' => " Lorem ipsum "]);
+ $wid = db_query('SELECT MAX(wid) FROM {watchdog}')->fetchField();
+ $this->drupalGet('admin/reports/dblog/event/' . $wid);
+ $this->assertNoRaw("");
+ $this->assertRaw("alert('foo'); Lorem ipsum ");
}
}
diff --git a/core/modules/dblog/src/Tests/Rest/DbLogResourceTest.php b/core/modules/dblog/src/Tests/Rest/DbLogResourceTest.php
index 6a74f1e89..1dd1f1145 100644
--- a/core/modules/dblog/src/Tests/Rest/DbLogResourceTest.php
+++ b/core/modules/dblog/src/Tests/Rest/DbLogResourceTest.php
@@ -61,4 +61,5 @@ class DbLogResourceTest extends RESTTestBase {
$decoded = Json::decode($response);
$this->assertEqual($decoded['error'], 'No log entry ID was provided', 'Response message is correct.');
}
+
}
diff --git a/core/modules/editor/editor.module b/core/modules/editor/editor.module
index 01d5c5eef..2a052dce2 100644
--- a/core/modules/editor/editor.module
+++ b/core/modules/editor/editor.module
@@ -66,7 +66,7 @@ function editor_element_info_alter(&$types) {
}
/**
- * Implements hook_form_FORM_ID_alter().
+ * Implements hook_form_FORM_ID_alter() for \Drupal\filter\FilterFormatListBuilder.
*/
function editor_form_filter_admin_overview_alter(&$form, FormStateInterface $form_state) {
// @todo Cleanup column injection: https://www.drupal.org/node/1876718.
@@ -88,7 +88,7 @@ function editor_form_filter_admin_overview_alter(&$form, FormStateInterface $for
}
/**
- * Implements hook_form_BASE_FORM_ID_alter() for 'filter_format_form'.
+ * Implements hook_form_BASE_FORM_ID_alter() for \Drupal\filter\FilterFormatEditForm.
*/
function editor_form_filter_format_form_alter(&$form, FormStateInterface $form_state) {
$editor = $form_state->get('editor');
@@ -471,6 +471,9 @@ function _editor_get_file_uuids_by_field(EntityInterface $entity) {
$field_items = $entity->get($formatted_text_field);
foreach ($field_items as $field_item) {
$text .= $field_item->value;
+ if ($field_item->getFieldDefinition()->getType() == 'text_with_summary') {
+ $text .= $field_item->summary;
+ }
}
$uuids[$formatted_text_field] = _editor_parse_file_uuids($text);
}
diff --git a/core/modules/editor/src/Form/EditorImageDialog.php b/core/modules/editor/src/Form/EditorImageDialog.php
index de27556aa..c353e2d30 100644
--- a/core/modules/editor/src/Form/EditorImageDialog.php
+++ b/core/modules/editor/src/Form/EditorImageDialog.php
@@ -85,8 +85,8 @@ class EditorImageDialog extends FormBase {
// Construct strings to use in the upload validators.
$image_upload = $editor->getImageUploadSettings();
- if (!empty($image_upload['dimensions'])) {
- $max_dimensions = $image_upload['dimensions']['max_width'] . '×' . $image_upload['dimensions']['max_height'];
+ if (!empty($image_upload['max_dimensions']['width']) || !empty($image_upload['max_dimensions']['height'])) {
+ $max_dimensions = $image_upload['max_dimensions']['width'] . 'x' . $image_upload['max_dimensions']['height'];
}
else {
$max_dimensions = 0;
diff --git a/core/modules/editor/src/Tests/EditorAdminTest.php b/core/modules/editor/src/Tests/EditorAdminTest.php
index dcbd368aa..97d47b11e 100644
--- a/core/modules/editor/src/Tests/EditorAdminTest.php
+++ b/core/modules/editor/src/Tests/EditorAdminTest.php
@@ -223,7 +223,7 @@ class EditorAdminTest extends WebTestBase {
$settings = $editor->getSettings();
$this->assertIdentical($editor->getEditor(), 'unicorn', 'The text editor is configured correctly.');
$this->assertIdentical($settings['ponies_too'], $ponies_too, 'The text editor settings are stored correctly.');
- $this->drupalGet('admin/config/content/formats/manage/'. $format_id);
+ $this->drupalGet('admin/config/content/formats/manage/' . $format_id);
$select = $this->xpath('//select[@name="editor[editor]"]');
$select_is_disabled = $this->xpath('//select[@name="editor[editor]" and @disabled="disabled"]');
$options = $this->xpath('//select[@name="editor[editor]"]/option');
diff --git a/core/modules/editor/src/Tests/EditorSecurityTest.php b/core/modules/editor/src/Tests/EditorSecurityTest.php
index 0d6840be0..c771439c6 100644
--- a/core/modules/editor/src/Tests/EditorSecurityTest.php
+++ b/core/modules/editor/src/Tests/EditorSecurityTest.php
@@ -431,4 +431,5 @@ class EditorSecurityTest extends WebTestBase {
$dom_node = $this->xpath('//textarea[@id="edit-body-0-value"]');
$this->assertIdentical(self::$sampleContent, (string) $dom_node[0], 'The value was filtered by the Insecure text editor XSS filter.');
}
+
}
diff --git a/core/modules/editor/src/Tests/EditorUploadImageScaleTest.php b/core/modules/editor/src/Tests/EditorUploadImageScaleTest.php
new file mode 100644
index 000000000..ac6e46b08
--- /dev/null
+++ b/core/modules/editor/src/Tests/EditorUploadImageScaleTest.php
@@ -0,0 +1,172 @@
+ 'basic_html',
+ 'name' => 'Basic HTML',
+ 'weight' => 0,
+ ])->save();
+
+ // Set up text editor.
+ Editor::create([
+ 'format' => 'basic_html',
+ 'editor' => 'unicorn',
+ 'image_upload' => [
+ 'status' => TRUE,
+ 'scheme' => 'public',
+ 'directory' => 'inline-images',
+ 'max_size' => '',
+ 'max_dimensions' => [
+ 'width' => '',
+ 'height' => ''
+ ],
+ ]
+ ])->save();
+
+ // Create admin user.
+ $this->adminUser = $this->drupalCreateUser(['administer filters', 'use text format basic_html']);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Tests scaling of inline images.
+ */
+ public function testEditorUploadImageScale() {
+ // Generate testing images.
+ $testing_image_list = $this->drupalGetTestFiles('image');
+
+ // Case 1: no max dimensions set: uploaded image not scaled.
+ $test_image = $testing_image_list[0];
+ list($image_file_width, $image_file_height) = $this->getTestImageInfo($test_image->uri);
+ $max_width = '';
+ $max_height = '';
+ $this->setMaxDimensions($max_width, $max_height);
+ list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri);
+ $this->assertEqual($uploaded_image_file_width, $image_file_width);
+ $this->assertEqual($uploaded_image_file_height, $image_file_height);
+ $this->assertNoRaw(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $max_width . 'x' . $max_height]));
+
+ // Case 2: max width smaller than uploaded image: image scaled down.
+ $test_image = $testing_image_list[1];
+ list($image_file_width, $image_file_height) = $this->getTestImageInfo($test_image->uri);
+ $max_width = $image_file_width - 5;
+ $max_height = $image_file_height;
+ $this->setMaxDimensions($max_width, $max_height);
+ list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri);
+ $this->assertEqual($uploaded_image_file_width, $max_width);
+ $this->assertEqual($uploaded_image_file_height, $uploaded_image_file_height * ($uploaded_image_file_width / $max_width));
+ $this->assertRaw(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $max_width . 'x' . $max_height]));
+
+ // Case 3: max height smaller than uploaded image: image scaled down.
+ $test_image = $testing_image_list[2];
+ list($image_file_width, $image_file_height) = $this->getTestImageInfo($test_image->uri);
+ $max_width = $image_file_width;
+ $max_height = $image_file_height - 5;
+ $this->setMaxDimensions($max_width, $max_height);
+ list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri);
+ $this->assertEqual($uploaded_image_file_width, $uploaded_image_file_width * ($uploaded_image_file_height / $max_height));
+ $this->assertEqual($uploaded_image_file_height, $max_height);
+ $this->assertRaw(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $max_width . 'x' . $max_height]));
+
+ // Case 4: max dimensions greater than uploaded image: image not scaled.
+ $test_image = $testing_image_list[3];
+ list($image_file_width, $image_file_height) = $this->getTestImageInfo($test_image->uri);
+ $max_width = $image_file_width + 5;
+ $max_height = $image_file_height + 5;
+ $this->setMaxDimensions($max_width, $max_height);
+ list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri);
+ $this->assertEqual($uploaded_image_file_width, $image_file_width);
+ $this->assertEqual($uploaded_image_file_height, $image_file_height);
+ $this->assertNoRaw(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $max_width . 'x' . $max_height]));
+ }
+
+ /**
+ * Gets the dimensions of an uploaded image.
+ *
+ * @param string $uri
+ * The URI of the image.
+ *
+ * @return array
+ * An array containing the uploaded image's width and height.
+ */
+ protected function getTestImageInfo($uri) {
+ $image_file = $this->container->get('image.factory')->get($uri);
+ return [
+ (int) $image_file->getWidth(),
+ (int) $image_file->getHeight(),
+ ];
+ }
+
+ /**
+ * Sets the maximum dimensions and saves the configuration.
+ *
+ * @param string|int $width
+ * The width of the image.
+ * @param string|int $height
+ * The height of the image.
+ */
+ protected function setMaxDimensions($width, $height) {
+ $editor = Editor::load('basic_html');
+ $image_upload_settings = $editor->getImageUploadSettings();
+ $image_upload_settings['max_dimensions']['width'] = $width;
+ $image_upload_settings['max_dimensions']['height'] = $height;
+ $editor->setImageUploadSettings($image_upload_settings);
+ $editor->save();
+ }
+
+ /**
+ * Uploads an image via the editor dialog.
+ *
+ * @param string $uri
+ * The URI of the image.
+ *
+ * @return array
+ * An array containing the uploaded image's width and height.
+ */
+ protected function uploadImage($uri) {
+ $edit = [
+ 'files[fid]' => drupal_realpath($uri),
+ ];
+ $this->drupalGet('editor/dialog/image/basic_html');
+ $this->drupalPostForm('editor/dialog/image/basic_html', $edit, t('Upload'));
+ $uploaded_image_file = $this->container->get('image.factory')->get('public://inline-images/' . basename($uri));
+ return [
+ (int) $uploaded_image_file->getWidth(),
+ (int) $uploaded_image_file->getHeight(),
+ ];
+ }
+
+}
diff --git a/core/modules/editor/tests/src/Kernel/EditorFileUsageTest.php b/core/modules/editor/tests/src/Kernel/EditorFileUsageTest.php
index a8379d11a..9b7b48722 100644
--- a/core/modules/editor/tests/src/Kernel/EditorFileUsageTest.php
+++ b/core/modules/editor/tests/src/Kernel/EditorFileUsageTest.php
@@ -177,6 +177,28 @@ class EditorFileUsageTest extends EntityKernelTestBase {
$this->assertIdentical(array('editor' => array('node' => array(1 => '2'))), $file_usage->listUsage($image_entity), 'The image ' . $image_paths[$key] . ' has 2 usages.');
}
+ // Populate both the body and summary. Because this will be the same
+ // revision of the same node, it will record only one usage.
+ foreach ($original_values as $key => $original_value) {
+ $node->body[$key]->value = $original_value;
+ $node->body[$key]->summary = $original_value;
+ }
+ $node->save();
+ foreach ($image_entities as $key => $image_entity) {
+ $this->assertIdentical(array('editor' => array('node' => array(1 => '2'))), $file_usage->listUsage($image_entity), 'The image ' . $image_paths[$key] . ' has 2 usages.');
+ }
+
+ // Empty out the body value, but keep the summary. The number of usages
+ // should not change.
+ foreach ($original_values as $key => $original_value) {
+ $node->body[$key]->value = '';
+ $node->body[$key]->summary = $original_value;
+ }
+ $node->save();
+ foreach ($image_entities as $key => $image_entity) {
+ $this->assertIdentical(array('editor' => array('node' => array(1 => '2'))), $file_usage->listUsage($image_entity), 'The image ' . $image_paths[$key] . ' has 2 usages.');
+ }
+
// Test editor_entity_delete().
$node->delete();
foreach ($image_entities as $key => $image_entity) {
diff --git a/core/modules/field/field.module b/core/modules/field/field.module
index 5fb3ae37f..053ab4ae8 100644
--- a/core/modules/field/field.module
+++ b/core/modules/field/field.module
@@ -69,7 +69,7 @@ function field_help($route_name, RouteMatchInterface $route_match) {
$field_ui_url = \Drupal::moduleHandler()->moduleExists('field_ui') ? \Drupal::url('help.page', array('name' => 'field_ui')) : '#';
$output = '';
$output .= '' . t('About') . ' ';
- $output .= '' . t('The Field module allows custom data fields to be defined for entity types (see below). The Field module takes care of storing, loading, editing, and rendering field data. Most users will not interact with the Field module directly, but will instead use the Field UI module user interface. Module developers can use the Field API to make new entity types "fieldable" and thus allow fields to be attached to them. For more information, see the online documentation for the Field module .', array(':field-ui-help' => $field_ui_url, ':field' => 'https://www.drupal.org/documentation/modules/field')). '
';
+ $output .= '' . t('The Field module allows custom data fields to be defined for entity types (see below). The Field module takes care of storing, loading, editing, and rendering field data. Most users will not interact with the Field module directly, but will instead use the Field UI module user interface. Module developers can use the Field API to make new entity types "fieldable" and thus allow fields to be attached to them. For more information, see the online documentation for the Field module .', array(':field-ui-help' => $field_ui_url, ':field' => 'https://www.drupal.org/documentation/modules/field')) . '
';
$output .= '' . t('Terminology') . ' ';
$output .= '';
$output .= '' . t('Entities and entity types') . ' ';
diff --git a/core/modules/field/src/Entity/FieldStorageConfig.php b/core/modules/field/src/Entity/FieldStorageConfig.php
index d04454ed3..00883d61a 100644
--- a/core/modules/field/src/Entity/FieldStorageConfig.php
+++ b/core/modules/field/src/Entity/FieldStorageConfig.php
@@ -298,7 +298,8 @@ class FieldStorageConfig extends ConfigEntityBase implements FieldStorageConfigI
* @param \Drupal\Core\Entity\EntityStorageInterface $storage
* The entity storage.
*
- * @throws \Drupal\Core\Field\FieldException If the field definition is invalid.
+ * @throws \Drupal\Core\Field\FieldException
+ * If the field definition is invalid.
*/
protected function preSaveNew(EntityStorageInterface $storage) {
$entity_manager = \Drupal::entityManager();
diff --git a/core/modules/field/src/Plugin/migrate/source/d7/Field.php b/core/modules/field/src/Plugin/migrate/source/d7/Field.php
index 91ec73eb6..2e8f74551 100644
--- a/core/modules/field/src/Plugin/migrate/source/d7/Field.php
+++ b/core/modules/field/src/Plugin/migrate/source/d7/Field.php
@@ -70,4 +70,5 @@ class Field extends DrupalSqlBase {
),
);
}
+
}
diff --git a/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php b/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php
index 08a0680ed..3c076e57d 100644
--- a/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php
+++ b/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php
@@ -103,4 +103,5 @@ class FieldInstance extends DrupalSqlBase {
),
);
}
+
}
diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldDefaultValueTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldDefaultValueTest.php
index 4524c88ed..64339583d 100644
--- a/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldDefaultValueTest.php
+++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldDefaultValueTest.php
@@ -74,13 +74,13 @@ class EntityReferenceFieldDefaultValueTest extends WebTestBase {
// Set created node as default_value.
$field_edit = array(
- 'default_value_input[' . $field_name . '][0][target_id]' => $referenced_node->getTitle() . ' (' .$referenced_node->id() . ')',
+ 'default_value_input[' . $field_name . '][0][target_id]' => $referenced_node->getTitle() . ' (' . $referenced_node->id() . ')',
);
$this->drupalPostForm('admin/structure/types/manage/reference_content/fields/node.reference_content.' . $field_name, $field_edit, t('Save settings'));
// Check that default value is selected in default value form.
$this->drupalGet('admin/structure/types/manage/reference_content/fields/node.reference_content.' . $field_name);
- $this->assertRaw('name="default_value_input[' . $field_name . '][0][target_id]" value="' . $referenced_node->getTitle() .' (' .$referenced_node->id() . ')', 'The default value is selected in instance settings page');
+ $this->assertRaw('name="default_value_input[' . $field_name . '][0][target_id]" value="' . $referenced_node->getTitle() . ' (' . $referenced_node->id() . ')', 'The default value is selected in instance settings page');
// Check if the ID has been converted to UUID in config entity.
$config_entity = $this->config('field.field.node.reference_content.' . $field_name)->get();
@@ -137,8 +137,8 @@ class EntityReferenceFieldDefaultValueTest extends WebTestBase {
// Set created node as default_value.
$field_edit = array(
- 'default_value_input[' . $field_name . '][0][target_id]' => $referenced_node_type->label() . ' (' .$referenced_node_type->id() . ')',
- 'default_value_input[' . $field_name . '][1][target_id]' => $referenced_node_type2->label() . ' (' .$referenced_node_type2->id() . ')',
+ 'default_value_input[' . $field_name . '][0][target_id]' => $referenced_node_type->label() . ' (' . $referenced_node_type->id() . ')',
+ 'default_value_input[' . $field_name . '][1][target_id]' => $referenced_node_type2->label() . ' (' . $referenced_node_type2->id() . ')',
);
$this->drupalPostForm('admin/structure/types/manage/reference_content/fields/node.reference_content.' . $field_name, $field_edit, t('Save settings'));
diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceFileUploadTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceFileUploadTest.php
index b638d4c15..6aef0f828 100644
--- a/core/modules/field/src/Tests/EntityReference/EntityReferenceFileUploadTest.php
+++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceFileUploadTest.php
@@ -125,4 +125,5 @@ class EntityReferenceFileUploadTest extends WebTestBase {
$this->drupalPostForm(NULL, $edit, 'Save');
$this->assertResponse(200);
}
+
}
diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceIntegrationTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceIntegrationTest.php
index 0514d977a..bae3041ce 100644
--- a/core/modules/field/src/Tests/EntityReference/EntityReferenceIntegrationTest.php
+++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceIntegrationTest.php
@@ -142,7 +142,7 @@ class EntityReferenceIntegrationTest extends WebTestBase {
if ($key == 'content') {
$field_edit['settings[handler_settings][target_bundles][' . $referenced_entities[0]->getEntityTypeId() . ']'] = TRUE;
}
- $this->drupalPostForm($this->entityType . '/structure/' . $this->bundle .'/fields/' . $this->entityType . '.' . $this->bundle . '.' . $this->fieldName, $field_edit, t('Save settings'));
+ $this->drupalPostForm($this->entityType . '/structure/' . $this->bundle . '/fields/' . $this->entityType . '.' . $this->bundle . '.' . $this->fieldName, $field_edit, t('Save settings'));
// Ensure the configuration has the expected dependency on the entity that
// is being used a default value.
$field = FieldConfig::loadByName($this->entityType, $this->bundle, $this->fieldName);
diff --git a/core/modules/field/src/Tests/EntityReference/Views/SelectionTest.php b/core/modules/field/src/Tests/EntityReference/Views/SelectionTest.php
index 5a472efbb..e677dbc4a 100644
--- a/core/modules/field/src/Tests/EntityReference/Views/SelectionTest.php
+++ b/core/modules/field/src/Tests/EntityReference/Views/SelectionTest.php
@@ -141,4 +141,5 @@ class SelectionTest extends WebTestBase {
$result = $handler->getReferenceableEntities();
$this->assertResults($result);
}
+
}
diff --git a/core/modules/field/src/Tests/FieldAccessTest.php b/core/modules/field/src/Tests/FieldAccessTest.php
index 0907a4659..05534060b 100644
--- a/core/modules/field/src/Tests/FieldAccessTest.php
+++ b/core/modules/field/src/Tests/FieldAccessTest.php
@@ -88,4 +88,5 @@ class FieldAccessTest extends FieldTestBase {
$this->drupalGet('node/' . $this->node->id());
$this->assertNoText($this->testViewFieldValue);
}
+
}
diff --git a/core/modules/field/src/Tests/FieldTestBase.php b/core/modules/field/src/Tests/FieldTestBase.php
index ca23d0328..2b1b020b4 100644
--- a/core/modules/field/src/Tests/FieldTestBase.php
+++ b/core/modules/field/src/Tests/FieldTestBase.php
@@ -58,4 +58,5 @@ abstract class FieldTestBase extends WebTestBase {
$this->assertEqual($values[$key][$column], $value, format_string('Value @value was saved correctly.', array('@value' => $value)));
}
}
+
}
diff --git a/core/modules/field/src/Tests/FormTest.php b/core/modules/field/src/Tests/FormTest.php
index 51c80b39a..c2efc175f 100644
--- a/core/modules/field/src/Tests/FormTest.php
+++ b/core/modules/field/src/Tests/FormTest.php
@@ -230,14 +230,6 @@ class FormTest extends FieldTestBase {
$this->assertRaw(t('@name field is required.', array('@name' => $this->field['label'])), 'Required field with no value fails validation');
}
-// function testFieldFormMultiple() {
-// $this->field = $this->field_multiple;
-// $field_name = $this->field['field_name'];
-// $this->instance['field_name'] = $field_name;
-// FieldStorageConfig::create($this->field)->save();
-// FieldConfig::create($this->instance)->save();
-// }
-
function testFieldFormUnlimited() {
$field_storage = $this->fieldStorageUnlimited;
$field_name = $field_storage['field_name'];
diff --git a/core/modules/field/src/Tests/Number/NumberFieldTest.php b/core/modules/field/src/Tests/Number/NumberFieldTest.php
index 342f6dd4a..14777ec34 100644
--- a/core/modules/field/src/Tests/Number/NumberFieldTest.php
+++ b/core/modules/field/src/Tests/Number/NumberFieldTest.php
@@ -551,11 +551,12 @@ class NumberFieldTest extends WebTestBase {
);
$this->drupalPostForm($field_configuration_url, $edit, t('Save settings'));
// Check if an error message is shown.
- $this->assertNoRaw(t('%name is not a valid number.', array('%name' => t('Minimum'))), 'Saved ' . gettype($minimum_value) .' value as minimal value on a ' . $field->getType() . ' field');
+ $this->assertNoRaw(t('%name is not a valid number.', array('%name' => t('Minimum'))), 'Saved ' . gettype($minimum_value) . ' value as minimal value on a ' . $field->getType() . ' field');
// Check if a success message is shown.
$this->assertRaw(t('Saved %label configuration.', array('%label' => $field->getLabel())));
// Check if the minimum value was actually set.
$this->drupalGet($field_configuration_url);
- $this->assertFieldById('edit-settings-min', $minimum_value, 'Minimal ' . gettype($minimum_value) .' value was set on a ' . $field->getType() . ' field.');
+ $this->assertFieldById('edit-settings-min', $minimum_value, 'Minimal ' . gettype($minimum_value) . ' value was set on a ' . $field->getType() . ' field.');
}
+
}
diff --git a/core/modules/field/src/Tests/String/StringFieldTest.php b/core/modules/field/src/Tests/String/StringFieldTest.php
index 928442699..ed71ebc17 100644
--- a/core/modules/field/src/Tests/String/StringFieldTest.php
+++ b/core/modules/field/src/Tests/String/StringFieldTest.php
@@ -97,4 +97,5 @@ class StringFieldTest extends WebTestBase {
$this->setRawContent(\Drupal::service('renderer')->renderRoot($content));
$this->assertText($value, 'Filtered tags are not displayed');
}
+
}
diff --git a/core/modules/field/src/Tests/TranslationWebTest.php b/core/modules/field/src/Tests/TranslationWebTest.php
index 397e1c16d..5271fd28a 100644
--- a/core/modules/field/src/Tests/TranslationWebTest.php
+++ b/core/modules/field/src/Tests/TranslationWebTest.php
@@ -130,4 +130,5 @@ class TranslationWebTest extends FieldTestBase {
$this->assertTrue($passed, format_string('The @language translation for revision @revision was correctly stored', array('@language' => $langcode, '@revision' => $entity->getRevisionId())));
}
}
+
}
diff --git a/core/modules/field/src/Tests/Update/FieldUpdateTest.php b/core/modules/field/src/Tests/Update/FieldUpdateTest.php
index c3f967cf3..be31a0935 100644
--- a/core/modules/field/src/Tests/Update/FieldUpdateTest.php
+++ b/core/modules/field/src/Tests/Update/FieldUpdateTest.php
@@ -140,4 +140,5 @@ class FieldUpdateTest extends UpdatePathTestBase {
$dependencies += ['module' => []];
$this->assertEqual(in_array('entity_reference', $dependencies['module']), $present);
}
+
}
diff --git a/core/modules/field/src/Tests/Views/FieldUITest.php b/core/modules/field/src/Tests/Views/FieldUITest.php
index 28b7024af..b51abb231 100644
--- a/core/modules/field/src/Tests/Views/FieldUITest.php
+++ b/core/modules/field/src/Tests/Views/FieldUITest.php
@@ -137,4 +137,5 @@ class FieldUITest extends FieldTestBase {
$option = $this->xpath('//label[@for="edit-options-value-0"]');
$this->assertEqual(t('False'), (string) $option[0]);
}
+
}
diff --git a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldApplicableFormatter.php b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldApplicableFormatter.php
index f3662b4b8..c2916f5d6 100644
--- a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldApplicableFormatter.php
+++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldApplicableFormatter.php
@@ -36,4 +36,5 @@ class TestFieldApplicableFormatter extends FormatterBase {
public function viewElements(FieldItemListInterface $items, $langcode) {
return array('#markup' => 'Nothing to see here');
}
+
}
diff --git a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldDefaultFormatter.php b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldDefaultFormatter.php
index 041967283..5eb0354ae 100644
--- a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldDefaultFormatter.php
+++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldDefaultFormatter.php
@@ -66,4 +66,5 @@ class TestFieldDefaultFormatter extends FormatterBase {
return $elements;
}
+
}
diff --git a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldEmptySettingFormatter.php b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldEmptySettingFormatter.php
index b6387832a..ca0886108 100644
--- a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldEmptySettingFormatter.php
+++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldEmptySettingFormatter.php
@@ -69,4 +69,5 @@ class TestFieldEmptySettingFormatter extends FormatterBase {
return $elements;
}
+
}
diff --git a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldMultipleFormatter.php b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldMultipleFormatter.php
index 399aeba53..97bb1e636 100644
--- a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldMultipleFormatter.php
+++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldMultipleFormatter.php
@@ -71,4 +71,5 @@ class TestFieldMultipleFormatter extends FormatterBase {
return $elements;
}
+
}
diff --git a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldPrepareViewFormatter.php b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldPrepareViewFormatter.php
index 5fb45e0d8..f7df0c0c2 100644
--- a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldPrepareViewFormatter.php
+++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldPrepareViewFormatter.php
@@ -79,4 +79,5 @@ class TestFieldPrepareViewFormatter extends FormatterBase {
return $elements;
}
+
}
diff --git a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItemWithDependencies.php b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItemWithDependencies.php
index d26e22545..f1e96dc40 100644
--- a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItemWithDependencies.php
+++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItemWithDependencies.php
@@ -21,7 +21,6 @@ use Drupal\Core\Field\FieldDefinitionInterface;
* }
* )
*/
-
class TestItemWithDependencies extends TestItem {
/**
diff --git a/core/modules/field/tests/src/Kernel/DisplayApiTest.php b/core/modules/field/tests/src/Kernel/DisplayApiTest.php
index 9a85255dd..d639e6aa2 100644
--- a/core/modules/field/tests/src/Kernel/DisplayApiTest.php
+++ b/core/modules/field/tests/src/Kernel/DisplayApiTest.php
@@ -308,4 +308,5 @@ class DisplayApiTest extends FieldKernelTestBase {
// default "empty" text.
$this->assertText($display['settings']['test_empty_string']);
}
+
}
diff --git a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php
index 4894a118d..5441c2fb6 100644
--- a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php
+++ b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php
@@ -66,7 +66,7 @@ class EntityReferenceFormatterTest extends EntityKernelTestBase {
// Use Classy theme for testing markup output.
\Drupal::service('theme_handler')->install(['classy']);
\Drupal::service('theme_handler')->setDefault('classy');
-
+ $this->installEntitySchema('entity_test');
// Grant the 'view test entity' permission.
$this->installConfig(array('user'));
Role::load(RoleInterface::ANONYMOUS_ID)
@@ -195,7 +195,7 @@ class EntityReferenceFormatterTest extends EntityKernelTestBase {
';
$renderer->renderRoot($build[0]);
- $this->assertEqual($build[0]['#markup'], 'default | ' . $this->referencedEntity->label() . $expected_rendered_name_field_1 . $expected_rendered_body_field_1, sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter));
+ $this->assertEqual($build[0]['#markup'], 'default | ' . $this->referencedEntity->label() . $expected_rendered_name_field_1 . $expected_rendered_body_field_1, sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter));
$expected_cache_tags = Cache::mergeTags(\Drupal::entityManager()->getViewBuilder($this->entityType)->getCacheTags(), $this->referencedEntity->getCacheTags());
$expected_cache_tags = Cache::mergeTags($expected_cache_tags, FilterFormat::load('full_html')->getCacheTags());
$this->assertEqual($build[0]['#cache']['tags'], $expected_cache_tags, format_string('The @formatter formatter has the expected cache tags.', array('@formatter' => $formatter)));
diff --git a/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php b/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
index 1af4ac6e2..8237ef4d8 100644
--- a/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
@@ -370,7 +370,7 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
// Verify that the fields are gone.
$this->assertFalse(FieldConfig::load('entity_test.' . $this->fieldTestData->field->getTargetBundle() . '.' . $this->fieldTestData->field_name), "First field is deleted");
- $this->assertFalse(FieldConfig::load('entity_test.' . $field['bundle']. '.' . $field_name), "Second field is deleted");
+ $this->assertFalse(FieldConfig::load('entity_test.' . $field['bundle'] . '.' . $field_name), "Second field is deleted");
}
}
diff --git a/core/modules/field/tests/src/Kernel/FieldImportChangeTest.php b/core/modules/field/tests/src/Kernel/FieldImportChangeTest.php
index 760607698..8cd029188 100644
--- a/core/modules/field/tests/src/Kernel/FieldImportChangeTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldImportChangeTest.php
@@ -48,4 +48,5 @@ class FieldImportChangeTest extends FieldKernelTestBase {
$field = FieldConfig::load($field_id);
$this->assertEqual($field->getLabel(), $new_label, 'field label updated');
}
+
}
diff --git a/core/modules/field/tests/src/Kernel/FieldImportCreateTest.php b/core/modules/field/tests/src/Kernel/FieldImportCreateTest.php
index 78a136e2a..3478dd3be 100644
--- a/core/modules/field/tests/src/Kernel/FieldImportCreateTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldImportCreateTest.php
@@ -115,4 +115,5 @@ class FieldImportCreateTest extends FieldKernelTestBase {
$field = FieldConfig::load($field_id_2b);
$this->assertTrue($field, 'Test import field 2b from sync exists');
}
+
}
diff --git a/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php b/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
index 220aa46e3..b536fe804 100644
--- a/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
@@ -108,4 +108,5 @@ class FieldImportDeleteTest extends FieldKernelTestBase {
$deleted_storages = \Drupal::state()->get('field.storage.deleted') ?: array();
$this->assertTrue(empty($deleted_storages), 'Fields are deleted');
}
+
}
diff --git a/core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php b/core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php
index e82f5a89f..6d443843a 100644
--- a/core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php
@@ -3,6 +3,7 @@
namespace Drupal\Tests\field\Kernel;
use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Core\Extension\ExtensionDiscovery;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\entity_test\Entity\EntityTest;
@@ -84,4 +85,41 @@ class FieldTypePluginManagerTest extends FieldKernelTestBase {
$this->assertEqual($instance->getFieldDefinition()->getDefaultValue($entity), [['value' => 8675309]], 'Instance default_value is 8675309');
}
+ /**
+ * Tests all field items provide an existing main property.
+ */
+ public function testMainProperty() {
+ // Let's enable all Drupal modules in Drupal core, so we test any field
+ // type plugin.
+ $this->enableAllCoreModules();
+
+ /** @var \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager */
+ $field_type_manager = \Drupal::service('plugin.manager.field.field_type');
+ foreach ($field_type_manager->getDefinitions() as $plugin_id => $definition) {
+ $class = $definition['class'];
+ $property = $class::mainPropertyName();
+ $storage_definition = BaseFieldDefinition::create($plugin_id);
+ $property_definitions = $class::propertyDefinitions($storage_definition);
+ $properties = implode(', ', array_keys($property_definitions));
+ if (!empty($property_definitions)) {
+ $message = sprintf("%s property %s found in %s", $plugin_id, $property, $properties);
+ $this->assertArrayHasKey($property, $class::propertyDefinitions($storage_definition), $message);
+ }
+ }
+ }
+
+ /**
+ * Enable all core modules.
+ */
+ protected function enableAllCoreModules() {
+ $listing = new ExtensionDiscovery(\Drupal::root());
+ $module_list = $listing->scan('module', FALSE);
+ /** @var \Drupal\Core\Extension\ModuleHandlerInterface $module_handler */
+ $module_handler = $this->container->get('module_handler');
+ $module_list = array_filter(array_keys($module_list), function ($module) use ($module_handler, $module_list) {
+ return !$module_handler->moduleExists($module) && substr($module_list[$module]->getPath(), 0, 4) === 'core';
+ });
+ $this->enableModules($module_list);
+ }
+
}
diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php
index c9cf0107a..83279d033 100644
--- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php
+++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php
@@ -20,7 +20,7 @@ class MigrateFieldInstanceTest extends MigrateDrupal7TestBase {
*
* @var array
*/
- static $modules = array(
+ public static $modules = array(
'comment',
'datetime',
'file',
@@ -76,7 +76,7 @@ class MigrateFieldInstanceTest extends MigrateDrupal7TestBase {
* The expected field label.
* @param string $expected_field_type
* The expected field type.
- * @param boolean $is_required
+ * @param bool $is_required
* Whether or not the field is required.
*/
protected function assertEntity($id, $expected_label, $expected_field_type, $is_required) {
diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php
index eba9b9c51..b1c2fb8b3 100644
--- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php
+++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php
@@ -18,7 +18,7 @@ class MigrateFieldTest extends MigrateDrupal7TestBase {
*
* @var array
*/
- static $modules = array(
+ public static $modules = array(
'comment',
'datetime',
'file',
diff --git a/core/modules/field/tests/src/Kernel/String/StringFormatterTest.php b/core/modules/field/tests/src/Kernel/String/StringFormatterTest.php
index 41cb06aa7..b52a92fd2 100644
--- a/core/modules/field/tests/src/Kernel/String/StringFormatterTest.php
+++ b/core/modules/field/tests/src/Kernel/String/StringFormatterTest.php
@@ -156,4 +156,5 @@ class StringFormatterTest extends KernelTestBase {
$this->assertLink($value, 0);
$this->assertLinkByHref('/entity_test_rev/' . $entity_new_revision->id() . '/revision/' . $entity_new_revision->getRevisionId() . '/view');
}
+
}
diff --git a/core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldTypeDefaultsTest.php b/core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldTypeDefaultsTest.php
index 89655fd45..f7b6fc7ad 100644
--- a/core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldTypeDefaultsTest.php
+++ b/core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldTypeDefaultsTest.php
@@ -51,4 +51,5 @@ class FieldTypeDefaultsTest extends MigrateProcessTestCase {
sprintf('Failed to lookup field type %s in the static map.', var_export([], TRUE)));
$this->plugin->transform([], $this->migrateExecutable, $this->row, 'property');
}
+
}
diff --git a/core/modules/field_ui/field_ui.api.php b/core/modules/field_ui/field_ui.api.php
index 4e44c3a33..28cb246e6 100644
--- a/core/modules/field_ui/field_ui.api.php
+++ b/core/modules/field_ui/field_ui.api.php
@@ -27,7 +27,7 @@
* @return array
* Returns the form array to be built.
*
- * @see \Drupal\field_ui\DisplayOverView.
+ * @see \Drupal\field_ui\DisplayOverView
*/
function hook_field_formatter_third_party_settings_form(\Drupal\Core\Field\FormatterInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $view_mode, $form, \Drupal\Core\Form\FormStateInterface $form_state) {
$element = array();
@@ -60,7 +60,7 @@ function hook_field_formatter_third_party_settings_form(\Drupal\Core\Field\Forma
* @return array
* Returns the form array to be built.
*
- * @see \Drupal\field_ui\FormDisplayOverView.
+ * @see \Drupal\field_ui\FormDisplayOverView
*/
function hook_field_widget_third_party_settings_form(\Drupal\Core\Field\WidgetInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $form_mode, $form, \Drupal\Core\Form\FormStateInterface $form_state) {
$element = array();
@@ -87,7 +87,7 @@ function hook_field_widget_third_party_settings_form(\Drupal\Core\Field\WidgetIn
* - field_definition: The field definition.
* - view_mode: The view mode being configured.
*
- * @see \Drupal\field_ui\DisplayOverView.
+ * @see \Drupal\field_ui\DisplayOverView
*/
function hook_field_formatter_settings_summary_alter(&$summary, $context) {
// Append a message to the summary when an instance of foo_formatter has
@@ -110,7 +110,7 @@ function hook_field_formatter_settings_summary_alter(&$summary, $context) {
* - field_definition: The field definition.
* - form_mode: The form mode being configured.
*
- * @see \Drupal\field_ui\FormDisplayOverView.
+ * @see \Drupal\field_ui\FormDisplayOverView
*/
function hook_field_widget_settings_summary_alter(&$summary, $context) {
// Append a message to the summary when an instance of foo_widget has
diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module
index 1517e5f60..5134cad26 100644
--- a/core/modules/field_ui/field_ui.module
+++ b/core/modules/field_ui/field_ui.module
@@ -144,7 +144,7 @@ function field_ui_entity_operation(EntityInterface $entity) {
// of another and that type has field UI enabled.
if (($bundle_of = $info->getBundleOf()) && \Drupal::entityManager()->getDefinition($bundle_of)->get('field_ui_base_route')) {
$account = \Drupal::currentUser();
- if ($account->hasPermission('administer '. $bundle_of . ' fields')) {
+ if ($account->hasPermission('administer ' . $bundle_of . ' fields')) {
$operations['manage-fields'] = array(
'title' => t('Manage fields'),
'weight' => 15,
@@ -153,7 +153,7 @@ function field_ui_entity_operation(EntityInterface $entity) {
)),
);
}
- if ($account->hasPermission('administer '. $bundle_of . ' form display')) {
+ if ($account->hasPermission('administer ' . $bundle_of . ' form display')) {
$operations['manage-form-display'] = array(
'title' => t('Manage form display'),
'weight' => 20,
@@ -162,7 +162,7 @@ function field_ui_entity_operation(EntityInterface $entity) {
)),
);
}
- if ($account->hasPermission('administer '. $bundle_of . ' display')) {
+ if ($account->hasPermission('administer ' . $bundle_of . ' display')) {
$operations['manage-display'] = array(
'title' => t('Manage display'),
'weight' => 25,
diff --git a/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php b/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php
index 54ff0a6ed..3ebf95994 100644
--- a/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php
+++ b/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php
@@ -186,4 +186,5 @@ class FieldUiLocalTask extends DeriverBase implements ContainerDeriverInterface
}
}
}
+
}
diff --git a/core/modules/field_ui/src/Tests/FieldUIIndentationTest.php b/core/modules/field_ui/src/Tests/FieldUIIndentationTest.php
index b2950e760..898b41723 100644
--- a/core/modules/field_ui/src/Tests/FieldUIIndentationTest.php
+++ b/core/modules/field_ui/src/Tests/FieldUIIndentationTest.php
@@ -37,4 +37,5 @@ class FieldUIIndentationTest extends WebTestBase {
$this->drupalGet('admin/structure/types/manage/page/display');
$this->assertRaw('js-indentation indentation');
}
+
}
diff --git a/core/modules/field_ui/src/Tests/ManageDisplayTest.php b/core/modules/field_ui/src/Tests/ManageDisplayTest.php
index 35ceb3c5b..b13518640 100644
--- a/core/modules/field_ui/src/Tests/ManageDisplayTest.php
+++ b/core/modules/field_ui/src/Tests/ManageDisplayTest.php
@@ -304,7 +304,7 @@ class ManageDisplayTest extends WebTestBase {
$field_test_with_prepare_view_settings = $formatter_plugin_manager->getDefaultSettings('field_test_with_prepare_view');
$output = array(
'field_test_default' => $field_test_default_settings['test_formatter_setting'] . '|' . $value,
- 'field_test_with_prepare_view' => $field_test_with_prepare_view_settings['test_formatter_setting_additional'] . '|' . $value. '|' . ($value + 1),
+ 'field_test_with_prepare_view' => $field_test_with_prepare_view_settings['test_formatter_setting_additional'] . '|' . $value . '|' . ($value + 1),
);
// Check that the field is displayed with the default formatter in 'rss'
@@ -470,7 +470,7 @@ class ManageDisplayTest extends WebTestBase {
$clone = clone $node;
$element = node_view($clone, $view_mode);
$output = \Drupal::service('renderer')->renderRoot($element);
- $this->verbose(t('Rendered node - view mode: @view_mode', array('@view_mode' => $view_mode)) . ' '. $output);
+ $this->verbose(t('Rendered node - view mode: @view_mode', array('@view_mode' => $view_mode)) . ' ' . $output);
// Assign content so that WebTestBase functions can be used.
$this->setRawContent($output);
diff --git a/core/modules/field_ui/src/Tests/ManageFieldsTest.php b/core/modules/field_ui/src/Tests/ManageFieldsTest.php
index c37e1e0b2..673b7319e 100644
--- a/core/modules/field_ui/src/Tests/ManageFieldsTest.php
+++ b/core/modules/field_ui/src/Tests/ManageFieldsTest.php
@@ -79,7 +79,7 @@ class ManageFieldsTest extends WebTestBase {
// Create random field name with markup to test escaping.
$this->fieldLabel = '' . $this->randomMachineName(8) . ' ';
$this->fieldNameInput = strtolower($this->randomMachineName(8));
- $this->fieldName = 'field_'. $this->fieldNameInput;
+ $this->fieldName = 'field_' . $this->fieldNameInput;
// Create Basic page and Article node types.
$this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
diff --git a/core/modules/field_ui/templates/field-ui-table.html.twig b/core/modules/field_ui/templates/field-ui-table.html.twig
index f7ff02681..68c8c8ec9 100644
--- a/core/modules/field_ui/templates/field-ui-table.html.twig
+++ b/core/modules/field_ui/templates/field-ui-table.html.twig
@@ -24,7 +24,7 @@
* - no_striping: A flag indicating that the row should receive no
* 'even / odd' styling. Defaults to FALSE.
* - cells: Table cells of the row. Each cell contains the following keys:
- * - tag: The HTML tag name to use; either TH or TD.
+ * - tag: The HTML tag name to use; either 'th' or 'td'.
* - attributes: Any HTML attributes, such as "colspan", to apply to the
* table cell.
* - content: The string to display in the table cell.
diff --git a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
index 3aa8e686e..67ad20fca 100644
--- a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
+++ b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
@@ -113,7 +113,7 @@ class EntityDisplayTest extends KernelTestBase {
}
/**
- * Test sorting of components by name on basic CRUD operations
+ * Test sorting of components by name on basic CRUD operations
*/
public function testEntityDisplayCRUDSort() {
$display = EntityViewDisplay::create(array(
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index e1ab4214a..a10645bad 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -709,11 +709,12 @@ function file_save_upload($form_field_name, $validators = array(), $destination
$user = \Drupal::currentUser();
static $upload_cache;
- $file_upload = \Drupal::request()->files->get("files[$form_field_name]", NULL, TRUE);
+ $all_files = \Drupal::request()->files->get('files', array());
// Make sure there's an upload to process.
- if (empty($file_upload)) {
+ if (empty($all_files[$form_field_name])) {
return NULL;
}
+ $file_upload = $all_files[$form_field_name];
// Return cached objects without processing since the file will have
// already been processed and the paths in $_FILES will be invalid.
@@ -1168,10 +1169,11 @@ function file_managed_file_submit($form, FormStateInterface $form_state) {
*/
function file_managed_file_save_upload($element, FormStateInterface $form_state) {
$upload_name = implode('_', $element['#parents']);
- $file_upload = \Drupal::request()->files->get("files[$upload_name]", NULL, TRUE);
- if (empty($file_upload)) {
+ $all_files = \Drupal::request()->files->get('files', array());
+ if (empty($all_files[$upload_name])) {
return FALSE;
}
+ $file_upload = $all_files[$upload_name];
$destination = isset($element['#upload_location']) ? $element['#upload_location'] : NULL;
if (isset($destination) && !file_prepare_directory($destination, FILE_CREATE_DIRECTORY)) {
diff --git a/core/modules/file/src/Element/ManagedFile.php b/core/modules/file/src/Element/ManagedFile.php
index 1b0984bdb..426f40c03 100644
--- a/core/modules/file/src/Element/ManagedFile.php
+++ b/core/modules/file/src/Element/ManagedFile.php
@@ -97,7 +97,7 @@ class ManagedFile extends FormElement {
// Temporary files that belong to other users should never be
// allowed.
if ($file->isTemporary()) {
- if ($file->getOwnerId() != \Drupal::currentUser()->id()) {
+ if ($file->getOwnerId() != \Drupal::currentUser()->id()) {
$force_default = TRUE;
break;
}
diff --git a/core/modules/file/src/Entity/File.php b/core/modules/file/src/Entity/File.php
index 0c34871f5..5deb382d7 100644
--- a/core/modules/file/src/Entity/File.php
+++ b/core/modules/file/src/Entity/File.php
@@ -13,6 +13,8 @@ use Drupal\user\UserInterface;
/**
* Defines the file entity class.
*
+ * @ingroup file
+ *
* @ContentEntityType(
* id = "file",
* label = @Translation("File"),
@@ -186,7 +188,11 @@ class File extends ContentEntityBase implements FileInterface {
public function preSave(EntityStorageInterface $storage) {
parent::preSave($storage);
- $this->setSize(filesize($this->getFileUri()));
+ // The file itself might not exist or be available right now.
+ $uri = $this->getFileUri();
+ if ($size = @filesize($uri)) {
+ $this->setSize($size);
+ }
}
/**
diff --git a/core/modules/file/src/FileAccessControlHandler.php b/core/modules/file/src/FileAccessControlHandler.php
index f9569ecac..a82c46053 100644
--- a/core/modules/file/src/FileAccessControlHandler.php
+++ b/core/modules/file/src/FileAccessControlHandler.php
@@ -6,6 +6,8 @@ use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityAccessControlHandler;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Session\AccountInterface;
/**
@@ -43,6 +45,16 @@ class FileAccessControlHandler extends EntityAccessControlHandler {
}
}
+ if ($operation == 'delete' || $operation == 'update') {
+ $account = $this->prepareUser($account);
+ $file_uid = $entity->get('uid')->getValue();
+ // Only the file owner can delete and update the file entity.
+ if ($account->id() == $file_uid[0]['target_id']) {
+ return AccessResult::allowed();
+ }
+ return AccessResult::forbidden();
+ }
+
// No opinion.
return AccessResult::neutral();
}
@@ -63,4 +75,30 @@ class FileAccessControlHandler extends EntityAccessControlHandler {
return file_get_file_references($file, NULL, EntityStorageInterface::FIELD_LOAD_REVISION, NULL);
}
+ /**
+ * {@inheritdoc}
+ */
+ protected function checkFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
+ // No user can edit the status of a file. Prevents saving a new file as
+ // persistent before even validating it.
+ if ($field_definition->getName() === 'status' && $operation === 'edit') {
+ return AccessResult::forbidden();
+ }
+ return parent::checkFieldAccess($operation, $field_definition, $account, $items);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
+ // The file entity has no "create" permission because by default Drupal core
+ // does not allow creating file entities independently. It allows you to
+ // create file entities that are referenced from another entity
+ // (e.g. an image for a article). A contributed module is free to alter
+ // this to allow file entities to be created directly.
+ // @todo Update comment to mention REST module when
+ // https://www.drupal.org/node/1927648 is fixed.
+ return AccessResult::neutral();
+ }
+
}
diff --git a/core/modules/file/src/FileInterface.php b/core/modules/file/src/FileInterface.php
index d07894638..ee7120b03 100644
--- a/core/modules/file/src/FileInterface.php
+++ b/core/modules/file/src/FileInterface.php
@@ -8,6 +8,8 @@ use Drupal\Core\Entity\EntityChangedInterface;
/**
* Defines getter and setter methods for file entity base fields.
+ *
+ * @ingroup file
*/
interface FileInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface {
@@ -113,4 +115,5 @@ interface FileInterface extends ContentEntityInterface, EntityChangedInterface,
* Creation timestamp of the file entity.
*/
public function getCreatedTime();
+
}
diff --git a/core/modules/file/src/FileStorageInterface.php b/core/modules/file/src/FileStorageInterface.php
index 296be7b27..3bbd92c5b 100644
--- a/core/modules/file/src/FileStorageInterface.php
+++ b/core/modules/file/src/FileStorageInterface.php
@@ -23,4 +23,5 @@ interface FileStorageInterface extends ContentEntityStorageInterface {
* An integer containing the number of bytes used.
*/
public function spaceUsed($uid = NULL, $status = FILE_STATUS_PERMANENT);
+
}
diff --git a/core/modules/file/src/FileUsage/DatabaseFileUsageBackend.php b/core/modules/file/src/FileUsage/DatabaseFileUsageBackend.php
index eeab8af34..12647b112 100644
--- a/core/modules/file/src/FileUsage/DatabaseFileUsageBackend.php
+++ b/core/modules/file/src/FileUsage/DatabaseFileUsageBackend.php
@@ -107,4 +107,5 @@ class DatabaseFileUsageBackend extends FileUsageBase {
}
return $references;
}
+
}
diff --git a/core/modules/file/src/FileUsage/FileUsageBase.php b/core/modules/file/src/FileUsage/FileUsageBase.php
index 5ebc79383..c90359be8 100644
--- a/core/modules/file/src/FileUsage/FileUsageBase.php
+++ b/core/modules/file/src/FileUsage/FileUsageBase.php
@@ -32,4 +32,5 @@ abstract class FileUsageBase implements FileUsageInterface {
$file->save();
}
}
+
}
diff --git a/core/modules/file/src/FileUsage/FileUsageInterface.php b/core/modules/file/src/FileUsage/FileUsageInterface.php
index 6248b32d6..6acda42cc 100644
--- a/core/modules/file/src/FileUsage/FileUsageInterface.php
+++ b/core/modules/file/src/FileUsage/FileUsageInterface.php
@@ -64,7 +64,7 @@ interface FileUsageInterface {
* A nested array with usage data. The first level is keyed by module name,
* the second by object type and the third by the object id. The value of
* the third level contains the usage count.
- *
*/
public function listUsage(FileInterface $file);
+
}
diff --git a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
index fe94ecf2a..df5e039cb 100644
--- a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
+++ b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
@@ -372,7 +372,8 @@ class FileWidget extends WidgetBase implements ContainerFactoryPluginInterface {
);
if (isset($item['display'])) {
$element['display']['#value'] = $item['display'] ? '1' : '';
- } else {
+ }
+ else {
$element['display']['#value'] = $element['#display_default'];
}
}
diff --git a/core/modules/file/src/Tests/DownloadTest.php b/core/modules/file/src/Tests/DownloadTest.php
index 745743c67..e92cef3f2 100644
--- a/core/modules/file/src/Tests/DownloadTest.php
+++ b/core/modules/file/src/Tests/DownloadTest.php
@@ -168,4 +168,5 @@ class DownloadTest extends FileManagedTestBase {
$file->delete();
}
+
}
diff --git a/core/modules/file/src/Tests/FileFieldPathTest.php b/core/modules/file/src/Tests/FileFieldPathTest.php
index b3773becc..c9a15de81 100644
--- a/core/modules/file/src/Tests/FileFieldPathTest.php
+++ b/core/modules/file/src/Tests/FileFieldPathTest.php
@@ -89,4 +89,5 @@ class FileFieldPathTest extends FileFieldTestBase {
$result = preg_match('/' . preg_quote($base_path, '/') . '(_[0-9]+)?\.' . preg_quote($extension, '/') . '/', $actual_path);
$this->assertTrue($result, $message);
}
+
}
diff --git a/core/modules/file/src/Tests/FileFieldRSSContentTest.php b/core/modules/file/src/Tests/FileFieldRSSContentTest.php
index 1fc41777e..665649aae 100644
--- a/core/modules/file/src/Tests/FileFieldRSSContentTest.php
+++ b/core/modules/file/src/Tests/FileFieldRSSContentTest.php
@@ -64,4 +64,5 @@ class FileFieldRSSContentTest extends FileFieldTestBase {
);
$this->assertRaw($test_element, 'File field RSS enclosure is displayed when viewing the RSS feed.');
}
+
}
diff --git a/core/modules/file/src/Tests/FileFieldRevisionTest.php b/core/modules/file/src/Tests/FileFieldRevisionTest.php
index 09a8572c1..f5d00c7cb 100644
--- a/core/modules/file/src/Tests/FileFieldRevisionTest.php
+++ b/core/modules/file/src/Tests/FileFieldRevisionTest.php
@@ -138,4 +138,5 @@ class FileFieldRevisionTest extends FileFieldTestBase {
$this->assertFileNotExists($node_file_r1, 'Original file is deleted after deleting the entire node with two revisions remaining.');
$this->assertFileEntryNotExists($node_file_r1, 'Original file entry is deleted after deleting the entire node with two revisions remaining.');
}
+
}
diff --git a/core/modules/file/src/Tests/FileFieldWidgetTest.php b/core/modules/file/src/Tests/FileFieldWidgetTest.php
index a6ca64254..a0d039372 100644
--- a/core/modules/file/src/Tests/FileFieldWidgetTest.php
+++ b/core/modules/file/src/Tests/FileFieldWidgetTest.php
@@ -191,7 +191,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
$check_field_name = $field_name;
}
- $this->assertIdentical((string) $button['name'], $check_field_name . '_' . $key. '_remove_button');
+ $this->assertIdentical((string) $button['name'], $check_field_name . '_' . $key . '_remove_button');
}
// "Click" the remove button (emulating either a nojs or js submission).
diff --git a/core/modules/file/src/Tests/FileManagedAccessTest.php b/core/modules/file/src/Tests/FileManagedAccessTest.php
index ce016af01..391f91a44 100644
--- a/core/modules/file/src/Tests/FileManagedAccessTest.php
+++ b/core/modules/file/src/Tests/FileManagedAccessTest.php
@@ -65,4 +65,5 @@ class FileManagedAccessTest extends FileManagedTestBase {
$this->assertFalse($file->access('view', $account), 'Private file is not viewable to anonymous user');
$this->assertFalse($file->access('download', $account), 'Private file is not downloadable to anonymous user');
}
+
}
diff --git a/core/modules/file/src/Tests/FileManagedFileElementTest.php b/core/modules/file/src/Tests/FileManagedFileElementTest.php
index f5d5be394..07102a04d 100644
--- a/core/modules/file/src/Tests/FileManagedFileElementTest.php
+++ b/core/modules/file/src/Tests/FileManagedFileElementTest.php
@@ -171,4 +171,27 @@ class FileManagedFileElementTest extends FileFieldTestBase {
$this->assertRaw('The file referenced by the Managed file & butter field does not exist.');
}
+ /**
+ * Ensure a file entity can be saved when the file does not exist on disk.
+ */
+ public function testFileRemovedFromDisk() {
+ $this->drupalGet('file/test/1/0/1');
+ $test_file = $this->getTestFile('text');
+ $file_field_name = 'files[nested_file][]';
+
+ $edit = [$file_field_name => drupal_realpath($test_file->getFileUri())];
+ $this->drupalPostForm(NULL, $edit, t('Upload'));
+ $this->drupalPostForm(NULL, array(), t('Save'));
+
+ $fid = $this->getLastFileId();
+ /** @var $file \Drupal\file\FileInterface */
+ $file = $this->container->get('entity_type.manager')->getStorage('file')->load($fid);
+ $file->setPermanent();
+ $file->save();
+ $this->assertTrue(file_unmanaged_delete($file->getFileUri()));
+ $file->save();
+ $this->assertTrue($file->isPermanent());
+ $file->delete();
+ }
+
}
diff --git a/core/modules/file/src/Tests/FilePrivateTest.php b/core/modules/file/src/Tests/FilePrivateTest.php
index 9355de173..2705ef205 100644
--- a/core/modules/file/src/Tests/FilePrivateTest.php
+++ b/core/modules/file/src/Tests/FilePrivateTest.php
@@ -75,9 +75,9 @@ class FilePrivateTest extends FileFieldTestBase {
$this->drupalPostForm('node/add/' . $type_name, $edit, t('Save and publish'));
$new_node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
$edit[$field_name . '[0][fids]'] = $node_file->id();
- $this->drupalPostForm('node/' . $new_node->id() .'/edit', $edit, t('Save and keep published'));
+ $this->drupalPostForm('node/' . $new_node->id() . '/edit', $edit, t('Save and keep published'));
// Make sure the form submit failed - we stayed on the edit form.
- $this->assertUrl('node/' . $new_node->id() .'/edit');
+ $this->assertUrl('node/' . $new_node->id() . '/edit');
// Check that we got the expected constraint form error.
$constraint = new ReferenceAccessConstraint();
$this->assertRaw(SafeMarkup::format($constraint->message, array('%type' => 'file', '%id' => $node_file->id())));
@@ -111,4 +111,5 @@ class FilePrivateTest extends FileFieldTestBase {
$this->drupalGet($file_url);
$this->assertResponse(403, 'Confirmed that access is denied for another user to the temporary file.');
}
+
}
diff --git a/core/modules/file/src/Tests/FileTokenReplaceTest.php b/core/modules/file/src/Tests/FileTokenReplaceTest.php
index de763270d..dfb9e51d4 100644
--- a/core/modules/file/src/Tests/FileTokenReplaceTest.php
+++ b/core/modules/file/src/Tests/FileTokenReplaceTest.php
@@ -93,4 +93,5 @@ class FileTokenReplaceTest extends FileFieldTestBase {
$this->assertEqual($output, $expected, format_string('Unsanitized file token %token replaced.', array('%token' => $input)));
}
}
+
}
diff --git a/core/modules/file/src/Tests/RemoteFileSaveUploadTest.php b/core/modules/file/src/Tests/RemoteFileSaveUploadTest.php
index 64a49bed1..b1ee6a65d 100644
--- a/core/modules/file/src/Tests/RemoteFileSaveUploadTest.php
+++ b/core/modules/file/src/Tests/RemoteFileSaveUploadTest.php
@@ -20,4 +20,5 @@ class RemoteFileSaveUploadTest extends SaveUploadTest {
parent::setUp();
$this->config('system.file')->set('default_scheme', 'dummy-remote')->save();
}
+
}
diff --git a/core/modules/file/src/Tests/SaveUploadTest.php b/core/modules/file/src/Tests/SaveUploadTest.php
index 0f0f5ec87..3aaa5cff0 100644
--- a/core/modules/file/src/Tests/SaveUploadTest.php
+++ b/core/modules/file/src/Tests/SaveUploadTest.php
@@ -358,4 +358,5 @@ class SaveUploadTest extends FileManagedTestBase {
'@destination' => 'temporary://' . $test_directory . '/' . $this->image->getFilename()
)), 'Found upload error log entry.');
}
+
}
diff --git a/core/modules/file/tests/file_test/src/Form/FileTestForm.php b/core/modules/file/tests/file_test/src/Form/FileTestForm.php
index 5b06335a0..628bb55db 100644
--- a/core/modules/file/tests/file_test/src/Form/FileTestForm.php
+++ b/core/modules/file/tests/file_test/src/Form/FileTestForm.php
@@ -117,4 +117,5 @@ class FileTestForm implements FormInterface {
drupal_set_message(t('Epic upload FAIL!'), 'error');
}
}
+
}
diff --git a/core/modules/file/tests/file_test/src/StreamWrapper/DummyReadOnlyStreamWrapper.php b/core/modules/file/tests/file_test/src/StreamWrapper/DummyReadOnlyStreamWrapper.php
index fd6da2edf..c0a7c0517 100644
--- a/core/modules/file/tests/file_test/src/StreamWrapper/DummyReadOnlyStreamWrapper.php
+++ b/core/modules/file/tests/file_test/src/StreamWrapper/DummyReadOnlyStreamWrapper.php
@@ -46,4 +46,5 @@ class DummyReadOnlyStreamWrapper extends LocalReadOnlyStream {
function getExternalUrl() {
return '/dummy/example.txt';
}
+
}
diff --git a/core/modules/file/tests/file_test/src/StreamWrapper/DummyRemoteStreamWrapper.php b/core/modules/file/tests/file_test/src/StreamWrapper/DummyRemoteStreamWrapper.php
index 7736751ce..12019e658 100644
--- a/core/modules/file/tests/file_test/src/StreamWrapper/DummyRemoteStreamWrapper.php
+++ b/core/modules/file/tests/file_test/src/StreamWrapper/DummyRemoteStreamWrapper.php
@@ -30,4 +30,5 @@ class DummyRemoteStreamWrapper extends PublicStream {
function realpath() {
return FALSE;
}
+
}
diff --git a/core/modules/file/tests/file_test/src/StreamWrapper/DummyStreamWrapper.php b/core/modules/file/tests/file_test/src/StreamWrapper/DummyStreamWrapper.php
index 8ae028a74..1428300f1 100644
--- a/core/modules/file/tests/file_test/src/StreamWrapper/DummyStreamWrapper.php
+++ b/core/modules/file/tests/file_test/src/StreamWrapper/DummyStreamWrapper.php
@@ -46,4 +46,5 @@ class DummyStreamWrapper extends LocalStream {
function getExternalUrl() {
return '/dummy/example.txt';
}
+
}
diff --git a/core/modules/file/tests/src/Kernel/AccessTest.php b/core/modules/file/tests/src/Kernel/AccessTest.php
new file mode 100644
index 000000000..c2fa65bac
--- /dev/null
+++ b/core/modules/file/tests/src/Kernel/AccessTest.php
@@ -0,0 +1,107 @@
+installEntitySchema('file');
+ $this->installEntitySchema('user');
+ $this->installSchema('file', array('file_usage'));
+ $this->installSchema('system', 'sequences');
+
+ $this->user1 = User::create([
+ 'name' => 'user1',
+ 'status' => 1,
+ ]);
+ $this->user1->save();
+
+ $this->user2 = User::create([
+ 'name' => 'user2',
+ 'status' => 1,
+ ]);
+ $this->user2->save();
+
+ $this->file = File::create(array(
+ 'uid' => $this->user1->id(),
+ 'filename' => 'druplicon.txt',
+ 'filemime' => 'text/plain',
+ ));
+ }
+
+ /**
+ * Tests that only the file owner can delete or update a file.
+ */
+ public function testOnlyOwnerCanDeleteUpdateFile() {
+ \Drupal::currentUser()->setAccount($this->user2);
+ $this->assertFalse($this->file->access('delete'));
+ $this->assertFalse($this->file->access('update'));
+
+ \Drupal::currentUser()->setAccount($this->user1);
+ $this->assertTrue($this->file->access('delete'));
+ $this->assertTrue($this->file->access('update'));
+ }
+
+ /**
+ * Tests that the status field is not editable.
+ */
+ public function testStatusFieldIsNotEditable() {
+ \Drupal::currentUser()->setAccount($this->user1);
+ $this->assertFalse($this->file->get('status')->access('edit'));
+ }
+
+ /**
+ * Tests create access checks.
+ */
+ public function testCreateAccess() {
+ // Anonymous users can create a file by default.
+ $this->assertFalse($this->file->access('create'));
+
+ // Authenticated users can create a file by default.
+ \Drupal::currentUser()->setAccount($this->user1);
+ $this->assertFalse($this->file->access('create'));
+ }
+
+}
diff --git a/core/modules/file/tests/src/Kernel/CopyTest.php b/core/modules/file/tests/src/Kernel/CopyTest.php
index b9bf8bc56..8836bd484 100644
--- a/core/modules/file/tests/src/Kernel/CopyTest.php
+++ b/core/modules/file/tests/src/Kernel/CopyTest.php
@@ -141,4 +141,5 @@ class CopyTest extends FileManagedUnitTestBase {
$this->assertFileUnchanged($source, File::load($source->id()));
$this->assertFileUnchanged($target, File::load($target->id()));
}
+
}
diff --git a/core/modules/file/tests/src/Kernel/DeleteTest.php b/core/modules/file/tests/src/Kernel/DeleteTest.php
index a6577d8c6..b88057121 100644
--- a/core/modules/file/tests/src/Kernel/DeleteTest.php
+++ b/core/modules/file/tests/src/Kernel/DeleteTest.php
@@ -68,4 +68,5 @@ class DeleteTest extends FileManagedUnitTestBase {
$this->assertFalse(file_exists($file->getFileUri()), 'File has been deleted after its last usage was removed.');
$this->assertFalse(File::load($file->id()), 'File was removed from the database.');
}
+
}
diff --git a/core/modules/file/tests/src/Kernel/Migrate/d7/MigrateFileTest.php b/core/modules/file/tests/src/Kernel/Migrate/d7/MigrateFileTest.php
index b2d2f4e43..9750da3ec 100644
--- a/core/modules/file/tests/src/Kernel/Migrate/d7/MigrateFileTest.php
+++ b/core/modules/file/tests/src/Kernel/Migrate/d7/MigrateFileTest.php
@@ -14,7 +14,7 @@ use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
*/
class MigrateFileTest extends MigrateDrupal7TestBase {
- static $modules = ['file'];
+ public static $modules = ['file'];
/**
* {@inheritdoc}
diff --git a/core/modules/file/tests/src/Kernel/MoveTest.php b/core/modules/file/tests/src/Kernel/MoveTest.php
index 9262b0356..a56caeaec 100644
--- a/core/modules/file/tests/src/Kernel/MoveTest.php
+++ b/core/modules/file/tests/src/Kernel/MoveTest.php
@@ -156,4 +156,5 @@ class MoveTest extends FileManagedUnitTestBase {
$this->assertFileUnchanged($source, File::load($source->id()));
$this->assertFileUnchanged($target, File::load($target->id()));
}
+
}
diff --git a/core/modules/file/tests/src/Kernel/SaveDataTest.php b/core/modules/file/tests/src/Kernel/SaveDataTest.php
index e079454db..c5637d08d 100644
--- a/core/modules/file/tests/src/Kernel/SaveDataTest.php
+++ b/core/modules/file/tests/src/Kernel/SaveDataTest.php
@@ -130,4 +130,5 @@ class SaveDataTest extends FileManagedUnitTestBase {
// Ensure that the existing file wasn't overwritten.
$this->assertFileUnchanged($existing, File::load($existing->id()));
}
+
}
diff --git a/core/modules/file/tests/src/Kernel/SaveTest.php b/core/modules/file/tests/src/Kernel/SaveTest.php
index d5a3eef53..69c7f2b7a 100644
--- a/core/modules/file/tests/src/Kernel/SaveTest.php
+++ b/core/modules/file/tests/src/Kernel/SaveTest.php
@@ -82,4 +82,5 @@ class SaveTest extends FileManagedUnitTestBase {
$this->assertEqual(array($uppercase_file->id() => $uppercase_file->id()), $fids);
}
+
}
diff --git a/core/modules/file/tests/src/Kernel/SpaceUsedTest.php b/core/modules/file/tests/src/Kernel/SpaceUsedTest.php
index 95efbaf69..f8752c4f6 100644
--- a/core/modules/file/tests/src/Kernel/SpaceUsedTest.php
+++ b/core/modules/file/tests/src/Kernel/SpaceUsedTest.php
@@ -71,4 +71,5 @@ class SpaceUsedTest extends FileManagedUnitTestBase {
$this->assertEqual($file->spaceUsed(3, 0), 3);
$this->assertEqual($file->spaceUsed(3, FILE_STATUS_PERMANENT), 300);
}
+
}
diff --git a/core/modules/file/tests/src/Kernel/UsageTest.php b/core/modules/file/tests/src/Kernel/UsageTest.php
index 1b8918da4..fdf12311b 100644
--- a/core/modules/file/tests/src/Kernel/UsageTest.php
+++ b/core/modules/file/tests/src/Kernel/UsageTest.php
@@ -202,4 +202,5 @@ class UsageTest extends FileManagedUnitTestBase {
$this->assertTrue(file_exists($perm_old->getFileUri()), 'Old permanent file was correctly ignored.');
$this->assertTrue(file_exists($perm_new->getFileUri()), 'New permanent file was correctly ignored.');
}
+
}
diff --git a/core/modules/file/tests/src/Kernel/ValidateTest.php b/core/modules/file/tests/src/Kernel/ValidateTest.php
index c3bd453cd..0bfcfddd4 100644
--- a/core/modules/file/tests/src/Kernel/ValidateTest.php
+++ b/core/modules/file/tests/src/Kernel/ValidateTest.php
@@ -34,4 +34,5 @@ class ValidateTest extends FileManagedUnitTestBase {
$this->assertEqual(file_validate($file, $failing), array('Failed', 'Badly', 'Epic fail'), 'Validating returns errors.');
$this->assertFileHooksCalled(array('validate'));
}
+
}
diff --git a/core/modules/file/tests/src/Kernel/ValidatorTest.php b/core/modules/file/tests/src/Kernel/ValidatorTest.php
index 961958bd9..30a6fe8be 100644
--- a/core/modules/file/tests/src/Kernel/ValidatorTest.php
+++ b/core/modules/file/tests/src/Kernel/ValidatorTest.php
@@ -51,7 +51,7 @@ class ValidatorTest extends FileManagedUnitTestBase {
}
/**
- * This ensures a specific file is actually an image.
+ * This ensures a specific file is actually an image.
*/
function testFileValidateIsImage() {
$this->assertTrue(file_exists($this->image->getFileUri()), 'The image being tested exists.', 'File');
@@ -64,8 +64,9 @@ class ValidatorTest extends FileManagedUnitTestBase {
}
/**
- * This ensures the resolution of a specific file is within bounds.
- * The image will be resized if it's too large.
+ * This ensures the resolution of a specific file is within bounds.
+ *
+ * The image will be resized if it's too large.
*/
function testFileValidateImageResolution() {
// Non-images.
@@ -113,7 +114,7 @@ class ValidatorTest extends FileManagedUnitTestBase {
}
/**
- * This will ensure the filename length is valid.
+ * This will ensure the filename length is valid.
*/
function testFileValidateNameLength() {
// Create a new file entity.
@@ -152,4 +153,5 @@ class ValidatorTest extends FileManagedUnitTestBase {
$errors = file_validate_size($file, 1, 1);
$this->assertEqual(count($errors), 2, 'Errors for both the file and their limit.', 'File');
}
+
}
diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module
index d42c81a24..f52614a42 100644
--- a/core/modules/filter/filter.module
+++ b/core/modules/filter/filter.module
@@ -487,7 +487,7 @@ function _filter_url($text, $filter) {
// Allow URL paths to contain balanced parens
// 1. Used in Wikipedia URLs like /Primer_(film)
// 2. Used in IIS sessions like /S(dfd346)/
- $valid_url_balanced_parens = '\('. $valid_url_path_characters . '+\)';
+ $valid_url_balanced_parens = '\(' . $valid_url_path_characters . '+\)';
// Valid end-of-path characters (so /foo. does not gobble the period).
// 1. Allow = for empty URL parameters and other URL-join artifacts
@@ -498,7 +498,7 @@ function _filter_url($text, $filter) {
//full path
//and allow @ in a url, but only in the middle. Catch things like http://example.com/@user/
- $valid_url_path = '(?:(?:'.$valid_url_path_characters . '*(?:'.$valid_url_balanced_parens .$valid_url_path_characters . '*)*'. $valid_url_ending_characters . ')|(?:@' . $valid_url_path_characters . '+\/))';
+ $valid_url_path = '(?:(?:' . $valid_url_path_characters . '*(?:' . $valid_url_balanced_parens . $valid_url_path_characters . '*)*' . $valid_url_ending_characters . ')|(?:@' . $valid_url_path_characters . '+\/))';
// Prepare domain name pattern.
// The ICANN seems to be on track towards accepting more diverse top level
@@ -507,7 +507,7 @@ function _filter_url($text, $filter) {
$domain = '(?:[\p{L}\p{M}\p{N}._+-]+\.)?[\p{L}\p{M}]{2,64}\b';
$ip = '(?:[0-9]{1,3}\.){3}[0-9]{1,3}';
$auth = '[\p{L}\p{M}\p{N}:%_+*~#?&=.,/;-]+@';
- $trail = '('.$valid_url_path.'*)?(\\?'.$valid_url_query_chars .'*'.$valid_url_query_ending_chars.')?';
+ $trail = '(' . $valid_url_path . '*)?(\\?' . $valid_url_query_chars . '*' . $valid_url_query_ending_chars . ')?';
// Match absolute URLs.
$url_pattern = "(?:$auth)?(?:$domain|$ip)/?(?:$trail)?";
@@ -647,7 +647,7 @@ function _filter_url_escape_comments($match, $escape = NULL) {
if (isset($escape)) {
$mode = $escape;
- if ($escape){
+ if ($escape) {
$comments = array();
}
return;
diff --git a/core/modules/filter/migration_templates/d6_filter_format.yml b/core/modules/filter/migration_templates/d6_filter_format.yml
index ffcbbb51b..6b767f208 100644
--- a/core/modules/filter/migration_templates/d6_filter_format.yml
+++ b/core/modules/filter/migration_templates/d6_filter_format.yml
@@ -6,14 +6,8 @@ source:
plugin: d6_filter_format
process:
format:
- -
- plugin: machine_name
- source: name
- -
- plugin: dedupe_entity
- entity_type: filter_format
- field: format
- length: 32
+ plugin: machine_name
+ source: name
name: name
cache: cache
filters:
diff --git a/core/modules/filter/src/Plugin/DataType/FilterFormat.php b/core/modules/filter/src/Plugin/DataType/FilterFormat.php
index 65bfa1998..11ef4cc4e 100644
--- a/core/modules/filter/src/Plugin/DataType/FilterFormat.php
+++ b/core/modules/filter/src/Plugin/DataType/FilterFormat.php
@@ -44,4 +44,5 @@ class FilterFormat extends StringData implements OptionsProviderInterface {
// @todo: Avoid calling functions but move to injected dependencies.
return array_map(function ($format) { return $format->label(); }, filter_formats($account));
}
+
}
diff --git a/core/modules/filter/src/Plugin/Filter/FilterHtml.php b/core/modules/filter/src/Plugin/Filter/FilterHtml.php
index 6ec335ef6..1dc339516 100644
--- a/core/modules/filter/src/Plugin/Filter/FilterHtml.php
+++ b/core/modules/filter/src/Plugin/Filter/FilterHtml.php
@@ -154,7 +154,7 @@ class FilterHtml extends FilterBase {
*/
protected function filterElementAttributes(\DOMElement $element, array $allowed_attributes) {
$modified_attributes = [];
- foreach($element->attributes as $name => $attribute) {
+ foreach ($element->attributes as $name => $attribute) {
// Remove attributes not in the whitelist.
$allowed_value = $this->findAllowedValue($allowed_attributes, $name);
if (empty($allowed_value)) {
diff --git a/core/modules/filter/src/Render/FilteredMarkup.php b/core/modules/filter/src/Render/FilteredMarkup.php
index 3a6912335..bf2498350 100644
--- a/core/modules/filter/src/Render/FilteredMarkup.php
+++ b/core/modules/filter/src/Render/FilteredMarkup.php
@@ -21,4 +21,5 @@ use Drupal\Component\Render\MarkupTrait;
*/
final class FilteredMarkup implements MarkupInterface, \Countable {
use MarkupTrait;
+
}
diff --git a/core/modules/filter/src/Tests/FilterDefaultFormatTest.php b/core/modules/filter/src/Tests/FilterDefaultFormatTest.php
index 96bae809e..800d70687 100644
--- a/core/modules/filter/src/Tests/FilterDefaultFormatTest.php
+++ b/core/modules/filter/src/Tests/FilterDefaultFormatTest.php
@@ -74,4 +74,5 @@ class FilterDefaultFormatTest extends WebTestBase {
protected function resetFilterCaches() {
filter_formats_reset();
}
+
}
diff --git a/core/modules/filter/src/Tests/FilterFormatAccessTest.php b/core/modules/filter/src/Tests/FilterFormatAccessTest.php
index 4d2da6183..ed41db08a 100644
--- a/core/modules/filter/src/Tests/FilterFormatAccessTest.php
+++ b/core/modules/filter/src/Tests/FilterFormatAccessTest.php
@@ -329,4 +329,5 @@ class FilterFormatAccessTest extends WebTestBase {
protected function resetFilterCaches() {
filter_formats_reset();
}
+
}
diff --git a/core/modules/filter/src/Tests/FilterHooksTest.php b/core/modules/filter/src/Tests/FilterHooksTest.php
index 448f2fc35..5353ccb87 100644
--- a/core/modules/filter/src/Tests/FilterHooksTest.php
+++ b/core/modules/filter/src/Tests/FilterHooksTest.php
@@ -68,4 +68,5 @@ class FilterHooksTest extends WebTestBase {
$this->assertRaw(t('Disabled text format %format.', array('%format' => $name)));
$this->assertText('hook_filter_format_disable invoked.');
}
+
}
diff --git a/core/modules/filter/src/Tests/FilterHtmlImageSecureTest.php b/core/modules/filter/src/Tests/FilterHtmlImageSecureTest.php
index c7a2ee3ad..5ce4e6d6b 100644
--- a/core/modules/filter/src/Tests/FilterHtmlImageSecureTest.php
+++ b/core/modules/filter/src/Tests/FilterHtmlImageSecureTest.php
@@ -154,4 +154,5 @@ class FilterHtmlImageSecureTest extends WebTestBase {
$this->assertTrue($found, format_string('@image was found.', array('@image' => $image)));
}
}
+
}
diff --git a/core/modules/filter/src/Tests/FilterNoFormatTest.php b/core/modules/filter/src/Tests/FilterNoFormatTest.php
index 32d5d4378..3dcc9f607 100644
--- a/core/modules/filter/src/Tests/FilterNoFormatTest.php
+++ b/core/modules/filter/src/Tests/FilterNoFormatTest.php
@@ -33,4 +33,5 @@ class FilterNoFormatTest extends WebTestBase {
// format, it is filtered as though it is in the fallback format.
$this->assertEqual(check_markup($text), check_markup($text, filter_fallback_format()), 'Text with no format is filtered the same as text in the fallback format.');
}
+
}
diff --git a/core/modules/filter/src/Tests/FilterSecurityTest.php b/core/modules/filter/src/Tests/FilterSecurityTest.php
index 4ea141c4c..b86e0722a 100644
--- a/core/modules/filter/src/Tests/FilterSecurityTest.php
+++ b/core/modules/filter/src/Tests/FilterSecurityTest.php
@@ -86,4 +86,5 @@ class FilterSecurityTest extends WebTestBase {
$this->assertEqual(check_markup($text, 'filtered_html', '', array()), $expected_filtered_text, 'Expected filter result.');
$this->assertEqual(check_markup($text, 'filtered_html', '', array(FilterInterface::TYPE_HTML_RESTRICTOR)), $expected_filtered_text, 'Expected filter result, even when trying to disable filters of the FilterInterface::TYPE_HTML_RESTRICTOR type.');
}
+
}
diff --git a/core/modules/filter/tests/src/Kernel/FilterSettingsTest.php b/core/modules/filter/tests/src/Kernel/FilterSettingsTest.php
index cc90cb3c3..dc77eb416 100644
--- a/core/modules/filter/tests/src/Kernel/FilterSettingsTest.php
+++ b/core/modules/filter/tests/src/Kernel/FilterSettingsTest.php
@@ -58,4 +58,5 @@ class FilterSettingsTest extends KernelTestBase {
)));
}
}
+
}
diff --git a/core/modules/filter/tests/src/Kernel/FilterUnitTest.php b/core/modules/filter/tests/src/Kernel/FilterUnitTest.php
index 860f6723d..3f467398b 100644
--- a/core/modules/filter/tests/src/Kernel/FilterUnitTest.php
+++ b/core/modules/filter/tests/src/Kernel/FilterUnitTest.php
@@ -1174,4 +1174,5 @@ body {color:red}
function assertNoNormalized($haystack, $needle, $message = '', $group = 'Other') {
return $this->assertTrue(strpos(strtolower(Html::decodeEntities($haystack)), $needle) === FALSE, $message, $group);
}
+
}
diff --git a/core/modules/filter/tests/src/Kernel/Migrate/d7/MigrateFilterFormatTest.php b/core/modules/filter/tests/src/Kernel/Migrate/d7/MigrateFilterFormatTest.php
index 8e98e8ff0..0ab5d056f 100644
--- a/core/modules/filter/tests/src/Kernel/Migrate/d7/MigrateFilterFormatTest.php
+++ b/core/modules/filter/tests/src/Kernel/Migrate/d7/MigrateFilterFormatTest.php
@@ -16,7 +16,7 @@ class MigrateFilterFormatTest extends MigrateDrupal7TestBase {
/**
* {@inheritdoc}
*/
- static $modules = array('filter');
+ public static $modules = array('filter');
/**
* {@inheritdoc}
diff --git a/core/modules/filter/tests/src/Unit/Plugin/migrate/source/d6/FilterFormatTest.php b/core/modules/filter/tests/src/Unit/Plugin/migrate/source/d6/FilterFormatTest.php
index 0d4e5d07e..a50a069ad 100644
--- a/core/modules/filter/tests/src/Unit/Plugin/migrate/source/d6/FilterFormatTest.php
+++ b/core/modules/filter/tests/src/Unit/Plugin/migrate/source/d6/FilterFormatTest.php
@@ -102,4 +102,5 @@ class FilterFormatTest extends MigrateSqlSourceTestCase {
}
parent::setUp();
}
+
}
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index 42d5349f3..330688756 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -29,7 +29,7 @@ function forum_help($route_name, RouteMatchInterface $route_match) {
$output .= ' ' . t('Forums (for example, Recipes for cooking vegetables )') . ' ';
$output .= '' . t('Forum topics submitted by users (for example, How to cook potatoes ), which start discussions.') . ' ';
$output .= '' . t('Threaded comments submitted by users (for example, You wash the potatoes first and then... ).') . ' ';
- $output .= '' . t('Optional containers , used to group similar forums. Forums can be placed inside containers, and vice versa.').' ';
+ $output .= '' . t('Optional containers , used to group similar forums. Forums can be placed inside containers, and vice versa.') . ' ';
$output .= '';
$output .= '';
$output .= '' . t('For more information, see the online documentation for the Forum module .', array(':forum' => 'https://www.drupal.org/documentation/modules/forum')) . '
';
@@ -282,7 +282,7 @@ function forum_comment_delete(CommentInterface $comment) {
}
/**
- * Implements hook_form_BASE_FORM_ID_alter().
+ * Implements hook_form_BASE_FORM_ID_alter() for \Drupal\taxonomy\VocabularyForm.
*/
function forum_form_taxonomy_vocabulary_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$vid = \Drupal::config('forum.settings')->get('vocabulary');
@@ -304,7 +304,7 @@ function forum_form_taxonomy_vocabulary_form_alter(&$form, FormStateInterface $f
}
/**
- * Implements hook_form_FORM_ID_alter() for taxonomy_term_form().
+ * Implements hook_form_FORM_ID_alter() for \Drupal\taxonomy\TermForm.
*/
function forum_form_taxonomy_term_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$vid = \Drupal::config('forum.settings')->get('vocabulary');
@@ -315,7 +315,7 @@ function forum_form_taxonomy_term_form_alter(&$form, FormStateInterface $form_st
}
/**
- * Implements hook_form_BASE_FORM_ID_alter() for node_form().
+ * Implements hook_form_BASE_FORM_ID_alter() for \Drupal\node\NodeForm.
*/
function forum_form_node_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$node = $form_state->getFormObject()->getEntity();
diff --git a/core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php b/core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php
index 4bde297cf..6604001f7 100644
--- a/core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php
+++ b/core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php
@@ -17,7 +17,7 @@ use Drupal\forum\ForumManagerInterface;
* This just holds the dependency-injected config, entity manager, and forum
* manager objects.
*/
-abstract class ForumBreadcrumbBuilderBase implements BreadcrumbBuilderInterface {
+abstract class ForumBreadcrumbBuilderBase implements BreadcrumbBuilderInterface {
use StringTranslationTrait;
/**
diff --git a/core/modules/forum/src/Form/Overview.php b/core/modules/forum/src/Form/Overview.php
index 9e77482c1..ba9c033de 100644
--- a/core/modules/forum/src/Form/Overview.php
+++ b/core/modules/forum/src/Form/Overview.php
@@ -10,7 +10,7 @@ use Drupal\taxonomy\Form\OverviewTerms;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-/*
+/**
* Provides forum overview form for the forum vocabulary.
*/
class Overview extends OverviewTerms {
diff --git a/core/modules/forum/src/Plugin/Block/NewTopicsBlock.php b/core/modules/forum/src/Plugin/Block/NewTopicsBlock.php
index 50551eef1..d57628f31 100644
--- a/core/modules/forum/src/Plugin/Block/NewTopicsBlock.php
+++ b/core/modules/forum/src/Plugin/Block/NewTopicsBlock.php
@@ -24,4 +24,5 @@ class NewTopicsBlock extends ForumBlockBase {
->orderBy('f.created', 'DESC')
->range(0, $this->configuration['block_count']);
}
+
}
diff --git a/core/modules/forum/src/Plugin/Validation/Constraint/ForumLeafConstraint.php b/core/modules/forum/src/Plugin/Validation/Constraint/ForumLeafConstraint.php
index 1791a719d..eec87cbee 100644
--- a/core/modules/forum/src/Plugin/Validation/Constraint/ForumLeafConstraint.php
+++ b/core/modules/forum/src/Plugin/Validation/Constraint/ForumLeafConstraint.php
@@ -16,4 +16,5 @@ class ForumLeafConstraint extends Constraint {
public $selectForum = 'Select a forum.';
public $noLeafMessage = 'The item %forum is a forum container, not a forum. Select one of the forums below instead.';
+
}
diff --git a/core/modules/forum/src/Tests/ForumBlockTest.php b/core/modules/forum/src/Tests/ForumBlockTest.php
index 6b1399b8d..1bcc9bc8d 100644
--- a/core/modules/forum/src/Tests/ForumBlockTest.php
+++ b/core/modules/forum/src/Tests/ForumBlockTest.php
@@ -176,4 +176,5 @@ class ForumBlockTest extends WebTestBase {
return $topics;
}
+
}
diff --git a/core/modules/forum/src/Tests/ForumIndexTest.php b/core/modules/forum/src/Tests/ForumIndexTest.php
index 64fe0d12f..8ead34f6d 100644
--- a/core/modules/forum/src/Tests/ForumIndexTest.php
+++ b/core/modules/forum/src/Tests/ForumIndexTest.php
@@ -79,4 +79,5 @@ class ForumIndexTest extends WebTestBase {
$this->drupalGet('forum/' . $tid);
$this->assertNoText($title, 'Unpublished forum topic no longer appears on index.');
}
+
}
diff --git a/core/modules/forum/src/Tests/ForumTest.php b/core/modules/forum/src/Tests/ForumTest.php
index 04e5ff46c..34176650a 100644
--- a/core/modules/forum/src/Tests/ForumTest.php
+++ b/core/modules/forum/src/Tests/ForumTest.php
@@ -678,4 +678,5 @@ class ForumTest extends WebTestBase {
$this->nids[] = $node->id();
}
}
+
}
diff --git a/core/modules/forum/src/Tests/ForumUninstallTest.php b/core/modules/forum/src/Tests/ForumUninstallTest.php
index d2acc1f7e..1978e6b31 100644
--- a/core/modules/forum/src/Tests/ForumUninstallTest.php
+++ b/core/modules/forum/src/Tests/ForumUninstallTest.php
@@ -138,7 +138,7 @@ class ForumUninstallTest extends WebTestBase {
// Delete all terms in the Forums vocabulary. Uninstalling the forum module
// will fail unless this is done.
$terms = entity_load_multiple_by_properties('taxonomy_term', array('vid' => 'forums'));
- foreach($terms as $term) {
+ foreach ($terms as $term) {
$term->delete();
}
diff --git a/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php b/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php
index f2b913fb7..fd8158b34 100644
--- a/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php
+++ b/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php
@@ -215,7 +215,6 @@ class ContentEntityNormalizer extends NormalizerBase {
*
* @return array
* The typed data IDs.
- *
*/
protected function getTypedDataIds($types, $context = array()) {
// The 'type' can potentially contain an array of type objects. By default,
@@ -245,4 +244,5 @@ class ContentEntityNormalizer extends NormalizerBase {
return $typed_data_ids;
}
+
}
diff --git a/core/modules/hal/tests/src/Kernel/DenormalizeTest.php b/core/modules/hal/tests/src/Kernel/DenormalizeTest.php
index 3e99f2fa7..64c8311f7 100644
--- a/core/modules/hal/tests/src/Kernel/DenormalizeTest.php
+++ b/core/modules/hal/tests/src/Kernel/DenormalizeTest.php
@@ -203,4 +203,5 @@ class DenormalizeTest extends NormalizerTestBase {
// Check the custom property that contains the list of fields to merge.
$this->assertEqual($denormalized->_restSubmittedFields, ['field_test_text']);
}
+
}
diff --git a/core/modules/help/src/Tests/HelpTest.php b/core/modules/help/src/Tests/HelpTest.php
index 6cb399198..76e2ee3a3 100644
--- a/core/modules/help/src/Tests/HelpTest.php
+++ b/core/modules/help/src/Tests/HelpTest.php
@@ -158,4 +158,5 @@ class HelpTest extends WebTestBase {
}
return $modules;
}
+
}
diff --git a/core/modules/help/src/Tests/NoHelpTest.php b/core/modules/help/src/Tests/NoHelpTest.php
index 9d087b756..7a6fb7a4c 100644
--- a/core/modules/help/src/Tests/NoHelpTest.php
+++ b/core/modules/help/src/Tests/NoHelpTest.php
@@ -45,4 +45,5 @@ class NoHelpTest extends WebTestBase {
$this->drupalGet('admin/help/menu_test');
$this->assertResponse(404, 'Getting a module overview help page for a module that does not implement hook_help() results in a 404.');
}
+
}
diff --git a/core/modules/history/history.module b/core/modules/history/history.module
index baaec2edd..779259132 100644
--- a/core/modules/history/history.module
+++ b/core/modules/history/history.module
@@ -28,7 +28,7 @@ function history_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.history':
$output = '' . t('About') . ' ';
- $output .= '' . t('The History module keeps track of which content a user has read. It marks content as new or updated depending on the last time the user viewed it. History records that are older than one month are removed during cron, which means that content older than one month is always considered read . The History module does not have a user interface but it provides a filter to Views to show new or updated content. For more information, see the online documentation for the History module .', array(':views-help' => (\Drupal::moduleHandler()->moduleExists('views')) ? \Drupal::url('help.page', array ('name' => 'views')) : '#', ':url' => 'https://www.drupal.org/documentation/modules/history')) . '
';
+ $output .= '' . t('The History module keeps track of which content a user has read. It marks content as new or updated depending on the last time the user viewed it. History records that are older than one month are removed during cron, which means that content older than one month is always considered read . The History module does not have a user interface but it provides a filter to Views to show new or updated content. For more information, see the online documentation for the History module .', array(':views-help' => (\Drupal::moduleHandler()->moduleExists('views')) ? \Drupal::url('help.page', array ('name' => 'views')) : '#', ':url' => 'https://www.drupal.org/documentation/modules/history')) . '
';
return $output;
}
}
diff --git a/core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php b/core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php
index 92e1acddd..65dfc2b49 100644
--- a/core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php
+++ b/core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php
@@ -18,7 +18,7 @@ use Drupal\views\Plugin\views\filter\FilterPluginBase;
class HistoryUserTimestamp extends FilterPluginBase {
// Don't display empty space where the operator would be.
- var $no_operator = TRUE;
+ public $no_operator = TRUE;
/**
* {@inheritdoc}
diff --git a/core/modules/history/src/Tests/HistoryTest.php b/core/modules/history/src/Tests/HistoryTest.php
index 9e5d970ef..17bba3406 100644
--- a/core/modules/history/src/Tests/HistoryTest.php
+++ b/core/modules/history/src/Tests/HistoryTest.php
@@ -144,4 +144,5 @@ class HistoryTest extends WebTestBase {
$this->markNodeAsRead($nid);
$this->assertResponse(403);
}
+
}
diff --git a/core/modules/history/src/Tests/Views/HistoryTimestampTest.php b/core/modules/history/src/Tests/Views/HistoryTimestampTest.php
index 1e34b79d2..0f484014b 100644
--- a/core/modules/history/src/Tests/Views/HistoryTimestampTest.php
+++ b/core/modules/history/src/Tests/Views/HistoryTimestampTest.php
@@ -85,4 +85,5 @@ class HistoryTimestampTest extends ViewTestBase {
$this->executeView($view);
}
+
}
diff --git a/core/modules/image/src/Plugin/migrate/process/d6/ImageCacheActions.php b/core/modules/image/src/Plugin/migrate/process/d6/ImageCacheActions.php
index 259cd2f10..0d40769ae 100644
--- a/core/modules/image/src/Plugin/migrate/process/d6/ImageCacheActions.php
+++ b/core/modules/image/src/Plugin/migrate/process/d6/ImageCacheActions.php
@@ -19,7 +19,7 @@ class ImageCacheActions extends ProcessPluginBase {
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
$effects = [];
- foreach($row->getSourceProperty('actions') as $action) {
+ foreach ($row->getSourceProperty('actions') as $action) {
$id = preg_replace('/^imagecache/', 'image', $action['action']);
if ($id === 'image_crop') {
diff --git a/core/modules/image/src/Plugin/migrate/source/d6/ImageCachePreset.php b/core/modules/image/src/Plugin/migrate/source/d6/ImageCachePreset.php
index 2f14adc96..4266ff179 100644
--- a/core/modules/image/src/Plugin/migrate/source/d6/ImageCachePreset.php
+++ b/core/modules/image/src/Plugin/migrate/source/d6/ImageCachePreset.php
@@ -54,7 +54,7 @@ class ImageCachePreset extends DrupalSqlBase {
->condition('presetid', $row->getSourceProperty('presetid'))
->execute();
- foreach($results as $key => $result) {
+ foreach ($results as $key => $result) {
$actions[$key] = $result;
$actions[$key]['data'] = unserialize($result['data']);
}
diff --git a/core/modules/image/src/Tests/FileMoveTest.php b/core/modules/image/src/Tests/FileMoveTest.php
index 5868e85c4..195799446 100644
--- a/core/modules/image/src/Tests/FileMoveTest.php
+++ b/core/modules/image/src/Tests/FileMoveTest.php
@@ -48,4 +48,5 @@ class FileMoveTest extends WebTestBase {
// Check if derivative image has been flushed.
$this->assertFalse(file_exists($derivative_uri), 'Make sure derivative image has been flushed.');
}
+
}
diff --git a/core/modules/image/src/Tests/ImageDimensionsTest.php b/core/modules/image/src/Tests/ImageDimensionsTest.php
index 74cc7bf49..6f73042cc 100644
--- a/core/modules/image/src/Tests/ImageDimensionsTest.php
+++ b/core/modules/image/src/Tests/ImageDimensionsTest.php
@@ -35,7 +35,7 @@ class ImageDimensionsTest extends WebTestBase {
/** @var $style \Drupal\image\ImageStyleInterface */
$style = ImageStyle::create(array('name' => 'test', 'label' => 'Test'));
$style->save();
- $generated_uri = 'public://styles/test/public/'. \Drupal::service('file_system')->basename($original_uri);
+ $generated_uri = 'public://styles/test/public/' . \Drupal::service('file_system')->basename($original_uri);
$url = file_url_transform_relative($style->buildUrl($original_uri));
$variables = array(
@@ -248,7 +248,7 @@ class ImageDimensionsTest extends WebTestBase {
'#height' => 20,
];
// PNG original image. Should be resized to 100x100.
- $generated_uri = 'public://styles/test_uri/public/'. \Drupal::service('file_system')->basename($original_uri);
+ $generated_uri = 'public://styles/test_uri/public/' . \Drupal::service('file_system')->basename($original_uri);
$url = file_url_transform_relative($style->buildUrl($original_uri));
$this->assertEqual($this->getImageTag($variables), ' ');
$this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.');
@@ -261,7 +261,7 @@ class ImageDimensionsTest extends WebTestBase {
// GIF original image. Should be resized to 50x50.
$file = $files[1];
$original_uri = file_unmanaged_copy($file->uri, 'public://', FILE_EXISTS_RENAME);
- $generated_uri = 'public://styles/test_uri/public/'. \Drupal::service('file_system')->basename($original_uri);
+ $generated_uri = 'public://styles/test_uri/public/' . \Drupal::service('file_system')->basename($original_uri);
$url = file_url_transform_relative($style->buildUrl($original_uri));
$variables['#uri'] = $original_uri;
$this->assertEqual($this->getImageTag($variables), ' ');
diff --git a/core/modules/image/src/Tests/ImageFieldValidateTest.php b/core/modules/image/src/Tests/ImageFieldValidateTest.php
index d36aafcdc..253252412 100644
--- a/core/modules/image/src/Tests/ImageFieldValidateTest.php
+++ b/core/modules/image/src/Tests/ImageFieldValidateTest.php
@@ -101,4 +101,5 @@ class ImageFieldValidateTest extends ImageFieldTestBase {
$this->assertNoText(t('Alternative text field is required.'));
$this->assertNoText(t('Title field is required.'));
}
+
}
diff --git a/core/modules/image/src/Tests/ImageStyleFlushTest.php b/core/modules/image/src/Tests/ImageStyleFlushTest.php
index 1f7c8e41d..63c0d8093 100644
--- a/core/modules/image/src/Tests/ImageStyleFlushTest.php
+++ b/core/modules/image/src/Tests/ImageStyleFlushTest.php
@@ -106,4 +106,5 @@ class ImageStyleFlushTest extends ImageFieldTestBase {
// Post flush, expected no image in the 'private' wrapper.
$this->assertEqual($this->getImageCount($style, 'private'), 0, format_string('Image style %style flushed correctly for %wrapper wrapper.', array('%style' => $style->label(), '%wrapper' => 'private')));
}
+
}
diff --git a/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php b/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php
index fc71e1803..f146ccc5a 100644
--- a/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php
+++ b/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php
@@ -175,7 +175,7 @@ class ImageStylesPathAndUrlTest extends WebTestBase {
// make sure that access is denied.
$file_noaccess = array_shift($files);
$original_uri_noaccess = file_unmanaged_copy($file_noaccess->uri, $scheme . '://', FILE_EXISTS_RENAME);
- $generated_uri_noaccess = $scheme . '://styles/' . $this->style->id() . '/' . $scheme . '/'. drupal_basename($original_uri_noaccess);
+ $generated_uri_noaccess = $scheme . '://styles/' . $this->style->id() . '/' . $scheme . '/' . drupal_basename($original_uri_noaccess);
$this->assertFalse(file_exists($generated_uri_noaccess), 'Generated file does not exist.');
$generate_url_noaccess = $this->style->buildUrl($original_uri_noaccess);
@@ -249,7 +249,7 @@ class ImageStylesPathAndUrlTest extends WebTestBase {
// Check that requesting a nonexistent image does not create any new
// directories in the file system.
- $directory = $scheme . '://styles/' . $this->style->id() . '/' . $scheme . '/' . $this->randomMachineName();
+ $directory = $scheme . '://styles/' . $this->style->id() . '/' . $scheme . '/' . $this->randomMachineName();
$this->drupalGet(file_create_url($directory . '/' . $this->randomString()));
$this->assertFalse(file_exists($directory), 'New directory was not created in the filesystem when requesting an unauthorized image.');
}
diff --git a/core/modules/image/src/Tests/ImageThemeFunctionTest.php b/core/modules/image/src/Tests/ImageThemeFunctionTest.php
index bf0a4cdb0..52cf6c6e5 100644
--- a/core/modules/image/src/Tests/ImageThemeFunctionTest.php
+++ b/core/modules/image/src/Tests/ImageThemeFunctionTest.php
@@ -217,4 +217,5 @@ class ImageThemeFunctionTest extends WebTestBase {
$elements = $this->xpath('//img[contains(@class, class) and contains(@alt, :alt)]', array(":class" => "image-with-attribute-alt", ":alt" => "Attribute alt"));
$this->assertEqual(count($elements), 1, 'Attribute alt overrides alt property if both set.');
}
+
}
diff --git a/core/modules/language/language.module b/core/modules/language/language.module
index c7873b895..b4612f4a2 100644
--- a/core/modules/language/language.module
+++ b/core/modules/language/language.module
@@ -168,7 +168,7 @@ function language_entity_base_field_info_alter(&$fields) {
foreach ($fields as $definition) {
// Set configurable form display for language fields with display options.
if ($definition->getType() == 'language') {
- foreach (array('form', 'view') as $type) {
+ foreach (array('form', 'view') as $type) {
if ($definition->getDisplayOptions($type)) {
// The related configurations will be purged manually on Language
// module uninstallation. @see language_modules_uninstalled().
diff --git a/core/modules/language/src/ConfigurableLanguageManager.php b/core/modules/language/src/ConfigurableLanguageManager.php
index 26892c318..238bd830c 100644
--- a/core/modules/language/src/ConfigurableLanguageManager.php
+++ b/core/modules/language/src/ConfigurableLanguageManager.php
@@ -387,7 +387,7 @@ class ConfigurableLanguageManager extends LanguageManager implements Configurabl
$type = 'language_fallback_candidates';
$types = array();
if (!empty($context['operation'])) {
- $types[] = $type . '_' . $context['operation'];
+ $types[] = $type . '_' . $context['operation'];
}
$types[] = $type;
$this->moduleHandler->alter($types, $candidates, $context);
diff --git a/core/modules/language/src/ContentLanguageSettingsInterface.php b/core/modules/language/src/ContentLanguageSettingsInterface.php
index 3bb3d5d25..7e1211d3c 100644
--- a/core/modules/language/src/ContentLanguageSettingsInterface.php
+++ b/core/modules/language/src/ContentLanguageSettingsInterface.php
@@ -39,7 +39,7 @@ interface ContentLanguageSettingsInterface extends ConfigEntityInterface {
* @param string $default_langcode
* The default language code.
*
- * @return $this;
+ * @return $this
*/
public function setDefaultLangcode($default_langcode);
diff --git a/core/modules/language/src/Form/NegotiationBrowserForm.php b/core/modules/language/src/Form/NegotiationBrowserForm.php
index 1e38a9b70..dfbdabbeb 100644
--- a/core/modules/language/src/Form/NegotiationBrowserForm.php
+++ b/core/modules/language/src/Form/NegotiationBrowserForm.php
@@ -211,4 +211,5 @@ class NegotiationBrowserForm extends ConfigFormBase {
}
return $config->get('map');
}
+
}
diff --git a/core/modules/language/src/LanguageServiceProvider.php b/core/modules/language/src/LanguageServiceProvider.php
index 566bd632c..cb4ad8823 100644
--- a/core/modules/language/src/LanguageServiceProvider.php
+++ b/core/modules/language/src/LanguageServiceProvider.php
@@ -100,4 +100,5 @@ class LanguageServiceProvider extends ServiceProviderBase {
}
return FALSE;
}
+
}
diff --git a/core/modules/language/src/Plugin/Condition/Language.php b/core/modules/language/src/Plugin/Condition/Language.php
index bbb37bf23..d1f3c95ce 100644
--- a/core/modules/language/src/Plugin/Condition/Language.php
+++ b/core/modules/language/src/Plugin/Condition/Language.php
@@ -19,7 +19,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* "language" = @ContextDefinition("language", label = @Translation("Language"))
* }
* )
- *
*/
class Language extends ConditionPluginBase implements ContainerFactoryPluginInterface {
diff --git a/core/modules/language/src/Tests/LanguageBlockSettingsVisibilityTest.php b/core/modules/language/src/Tests/LanguageBlockSettingsVisibilityTest.php
index f92514bd9..ee6912e37 100644
--- a/core/modules/language/src/Tests/LanguageBlockSettingsVisibilityTest.php
+++ b/core/modules/language/src/Tests/LanguageBlockSettingsVisibilityTest.php
@@ -23,4 +23,5 @@ class LanguageBlockSettingsVisibilityTest extends WebTestBase {
$this->assertFieldByXPath('//input[@id="edit-visibility-language-langcodes-en"]', NULL, '\'English\' option appears at block config, language settings section.');
$this->assertFieldByXpath('//input[@id="edit-visibility-language-langcodes-hu"]', NULL, '\'Hungarian\' option appears at block config, language settings section.');
}
+
}
diff --git a/core/modules/language/src/Tests/LanguageBrowserDetectionTest.php b/core/modules/language/src/Tests/LanguageBrowserDetectionTest.php
index c6b731907..3991b2a0a 100644
--- a/core/modules/language/src/Tests/LanguageBrowserDetectionTest.php
+++ b/core/modules/language/src/Tests/LanguageBrowserDetectionTest.php
@@ -86,4 +86,5 @@ class LanguageBrowserDetectionTest extends WebTestBase {
$this->assertField('edit-mappings-xx-browser-langcode', 'xx', 'Browser language code found.');
$this->assertField('edit-mappings-xx-drupal-langcode', 'zh-hans', 'Drupal language code found.');
}
+
}
diff --git a/core/modules/language/src/Tests/LanguageCustomLanguageConfigurationTest.php b/core/modules/language/src/Tests/LanguageCustomLanguageConfigurationTest.php
index 9cf69ad59..dbd35cdf3 100644
--- a/core/modules/language/src/Tests/LanguageCustomLanguageConfigurationTest.php
+++ b/core/modules/language/src/Tests/LanguageCustomLanguageConfigurationTest.php
@@ -97,4 +97,5 @@ class LanguageCustomLanguageConfigurationTest extends WebTestBase {
));
$this->assertUrl(\Drupal::url('language.add', array(), array('absolute' => TRUE)), [], 'Correct page redirection.');
}
+
}
diff --git a/core/modules/language/src/Tests/LanguageListModuleInstallTest.php b/core/modules/language/src/Tests/LanguageListModuleInstallTest.php
index ea9cdd561..3df9bdc0b 100644
--- a/core/modules/language/src/Tests/LanguageListModuleInstallTest.php
+++ b/core/modules/language/src/Tests/LanguageListModuleInstallTest.php
@@ -37,4 +37,5 @@ class LanguageListModuleInstallTest extends WebTestBase {
$this->rebuildContainer();
$this->assertTrue(\Drupal::moduleHandler()->moduleExists('language'), 'Language module is enabled');
}
+
}
diff --git a/core/modules/language/src/Tests/LanguageListTest.php b/core/modules/language/src/Tests/LanguageListTest.php
index 25de99cd0..d40753060 100644
--- a/core/modules/language/src/Tests/LanguageListTest.php
+++ b/core/modules/language/src/Tests/LanguageListTest.php
@@ -61,7 +61,7 @@ class LanguageListTest extends WebTestBase {
);
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
$this->assertUrl(\Drupal::url('entity.configurable_language.collection', [], ['absolute' => TRUE]));
- $this->assertRaw('"edit-languages-' . $langcode .'-weight"', 'Language code found.');
+ $this->assertRaw('"edit-languages-' . $langcode . '-weight"', 'Language code found.');
$this->assertText(t($name), 'Test language added.');
$language = \Drupal::service('language_manager')->getLanguage($langcode);
@@ -205,4 +205,5 @@ class LanguageListTest extends WebTestBase {
$conf_languages = $this->container->get('language_manager')->getLanguages();
$this->assertEqual(array_diff_key($expected_conf_languages, $conf_languages), array(), 'Configurable languages loaded correctly.');
}
+
}
diff --git a/core/modules/language/src/Tests/LanguageLocaleListTest.php b/core/modules/language/src/Tests/LanguageLocaleListTest.php
index ec05c4418..dd3e02a1f 100644
--- a/core/modules/language/src/Tests/LanguageLocaleListTest.php
+++ b/core/modules/language/src/Tests/LanguageLocaleListTest.php
@@ -69,4 +69,5 @@ class LanguageLocaleListTest extends WebTestBase {
// Check the language list displayed is ordered.
$this->assertTrue($options === $options_ordered, 'Language list is ordered.');
}
+
}
diff --git a/core/modules/language/src/Tests/LanguageNegotiationInfoTest.php b/core/modules/language/src/Tests/LanguageNegotiationInfoTest.php
index caafc80a0..ee4c6d4ce 100644
--- a/core/modules/language/src/Tests/LanguageNegotiationInfoTest.php
+++ b/core/modules/language/src/Tests/LanguageNegotiationInfoTest.php
@@ -86,7 +86,7 @@ class LanguageNegotiationInfoTest extends WebTestBase {
$test_type = 'test_language_type';
$interface_method_id = LanguageNegotiationUI::METHOD_ID;
$test_method_id = 'test_language_negotiation_method';
- $form_field = $type . '[enabled]['. $interface_method_id .']';
+ $form_field = $type . '[enabled][' . $interface_method_id . ']';
$edit = array(
$form_field => TRUE,
$type . '[enabled][' . $test_method_id . ']' => TRUE,
diff --git a/core/modules/language/src/Tests/LanguagePathMonolingualTest.php b/core/modules/language/src/Tests/LanguagePathMonolingualTest.php
index 1f79604f1..510d80542 100644
--- a/core/modules/language/src/Tests/LanguagePathMonolingualTest.php
+++ b/core/modules/language/src/Tests/LanguagePathMonolingualTest.php
@@ -69,4 +69,5 @@ class LanguagePathMonolingualTest extends WebTestBase {
$this->assertResponse(200, 'Clicked link results in a valid page');
$this->assertText(t('Add language'), 'Page contains the add language text');
}
+
}
diff --git a/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php b/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php
index 7e19d4f6b..ef2abee3c 100644
--- a/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php
+++ b/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php
@@ -532,4 +532,5 @@ class LanguageUILanguageNegotiationTest extends WebTestBase {
$block = Block::load($block_id);
$this->assertFalse($block, 'Language switcher block was removed.');
}
+
}
diff --git a/core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElement.php b/core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElement.php
index e89f86a66..99b2fff27 100644
--- a/core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElement.php
+++ b/core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElement.php
@@ -46,4 +46,5 @@ class LanguageConfigurationElement extends FormBase {
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
}
+
}
diff --git a/core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElementTest.php b/core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElementTest.php
index d538fcc82..0aa6c4975 100644
--- a/core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElementTest.php
+++ b/core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElementTest.php
@@ -34,4 +34,5 @@ class LanguageConfigurationElementTest extends FormBase {
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
}
+
}
diff --git a/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php b/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php
index 4fa83a441..8ecdbf771 100644
--- a/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php
+++ b/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php
@@ -249,6 +249,7 @@ class LanguageNegotiationUrlTest extends UnitTestCase {
);
return $domain_configuration;
}
+
}
}
diff --git a/core/modules/link/src/Plugin/Field/FieldFormatter/LinkSeparateFormatter.php b/core/modules/link/src/Plugin/Field/FieldFormatter/LinkSeparateFormatter.php
index 4849d32b8..f7370378e 100644
--- a/core/modules/link/src/Plugin/Field/FieldFormatter/LinkSeparateFormatter.php
+++ b/core/modules/link/src/Plugin/Field/FieldFormatter/LinkSeparateFormatter.php
@@ -85,4 +85,5 @@ class LinkSeparateFormatter extends LinkFormatter {
}
return $element;
}
+
}
diff --git a/core/modules/link/src/Plugin/Validation/Constraint/LinkTypeConstraint.php b/core/modules/link/src/Plugin/Validation/Constraint/LinkTypeConstraint.php
index 3fe76a67b..4f706f6a0 100644
--- a/core/modules/link/src/Plugin/Validation/Constraint/LinkTypeConstraint.php
+++ b/core/modules/link/src/Plugin/Validation/Constraint/LinkTypeConstraint.php
@@ -74,4 +74,5 @@ class LinkTypeConstraint extends Constraint implements ConstraintValidatorInterf
}
}
}
+
}
diff --git a/core/modules/link/src/Tests/Views/LinkViewsTokensTest.php b/core/modules/link/src/Tests/Views/LinkViewsTokensTest.php
index b80624f72..ec06ca614 100644
--- a/core/modules/link/src/Tests/Views/LinkViewsTokensTest.php
+++ b/core/modules/link/src/Tests/Views/LinkViewsTokensTest.php
@@ -94,4 +94,5 @@ class LinkViewsTokensTest extends ViewTestBase {
$this->assertRaw("Raw options: .");
}
}
+
}
diff --git a/core/modules/locale/src/Form/ExportForm.php b/core/modules/locale/src/Form/ExportForm.php
index 1b19a93c8..ed2a6cf5c 100644
--- a/core/modules/locale/src/Form/ExportForm.php
+++ b/core/modules/locale/src/Form/ExportForm.php
@@ -139,7 +139,7 @@ class ExportForm extends FormBase {
$reader->setOptions($content_options);
$languages = $this->languageManager->getLanguages();
$language_name = isset($languages[$language->getId()]) ? $languages[$language->getId()]->getName() : '';
- $filename = $language->getId() .'.po';
+ $filename = $language->getId() . '.po';
}
else {
// Template required.
diff --git a/core/modules/locale/src/Form/ImportForm.php b/core/modules/locale/src/Form/ImportForm.php
index 5a20e278f..0ea71809b 100644
--- a/core/modules/locale/src/Form/ImportForm.php
+++ b/core/modules/locale/src/Form/ImportForm.php
@@ -192,4 +192,5 @@ class ImportForm extends FormBase {
$form_state->setRedirect('locale.translate_page');
}
+
}
diff --git a/core/modules/locale/src/Gettext.php b/core/modules/locale/src/Gettext.php
index 7bfa2ddb0..5573f43d6 100644
--- a/core/modules/locale/src/Gettext.php
+++ b/core/modules/locale/src/Gettext.php
@@ -93,4 +93,5 @@ class Gettext {
$report['seek'] = $reader->getSeek();
return $report;
}
+
}
diff --git a/core/modules/locale/src/Locale.php b/core/modules/locale/src/Locale.php
index 3627b578d..3e2a9f5da 100644
--- a/core/modules/locale/src/Locale.php
+++ b/core/modules/locale/src/Locale.php
@@ -20,4 +20,5 @@ class Locale {
public static function config() {
return \Drupal::service('locale.config_manager');
}
+
}
diff --git a/core/modules/locale/src/LocaleConfigManager.php b/core/modules/locale/src/LocaleConfigManager.php
index 1a8aef8d8..2de875e29 100644
--- a/core/modules/locale/src/LocaleConfigManager.php
+++ b/core/modules/locale/src/LocaleConfigManager.php
@@ -204,7 +204,6 @@ class LocaleConfigManager {
* The translatable array structure. A nested array matching the exact
* structure under of the default configuration for $name with only the
* elements that are translatable wrapped into a TranslatableMarkup.
- * @see self::getTranslatableData().
* @param string $langcode
* The language code to process the array with.
*
@@ -212,6 +211,8 @@ class LocaleConfigManager {
* Processed translatable data array. Will only contain translations
* different from source strings or in case of untranslatable English, the
* source strings themselves.
+ *
+ * @see self::getTranslatableData()
*/
protected function processTranslatableData($name, array $active, array $translatable, $langcode) {
$translated = array();
diff --git a/core/modules/locale/src/LocaleProjectStorage.php b/core/modules/locale/src/LocaleProjectStorage.php
index e0189de30..907bd6cd7 100644
--- a/core/modules/locale/src/LocaleProjectStorage.php
+++ b/core/modules/locale/src/LocaleProjectStorage.php
@@ -165,4 +165,5 @@ class LocaleProjectStorage implements LocaleProjectStorageInterface {
}
return $this->cache;
}
+
}
diff --git a/core/modules/locale/src/LocaleProjectStorageInterface.php b/core/modules/locale/src/LocaleProjectStorageInterface.php
index be3fe570f..b56174db8 100644
--- a/core/modules/locale/src/LocaleProjectStorageInterface.php
+++ b/core/modules/locale/src/LocaleProjectStorageInterface.php
@@ -98,4 +98,5 @@ interface LocaleProjectStorageInterface {
* The number of saved items.
*/
public function countProjects();
+
}
diff --git a/core/modules/locale/src/StreamWrapper/TranslationsStream.php b/core/modules/locale/src/StreamWrapper/TranslationsStream.php
index 7797ad117..8a1c1c9fb 100644
--- a/core/modules/locale/src/StreamWrapper/TranslationsStream.php
+++ b/core/modules/locale/src/StreamWrapper/TranslationsStream.php
@@ -42,9 +42,11 @@ class TranslationsStream extends LocalStream {
/**
* Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::getExternalUrl().
- * @throws \LogicException PO files URL should not be public.
+ * @throws \LogicException
+ * PO files URL should not be public.
*/
function getExternalUrl() {
throw new \LogicException('PO files URL should not be public.');
}
+
}
diff --git a/core/modules/locale/src/StringDatabaseStorage.php b/core/modules/locale/src/StringDatabaseStorage.php
index fc6552a5b..01a0544e4 100644
--- a/core/modules/locale/src/StringDatabaseStorage.php
+++ b/core/modules/locale/src/StringDatabaseStorage.php
@@ -536,4 +536,5 @@ class StringDatabaseStorage implements StringStorageInterface {
protected function dbExecute($query, array $args = array()) {
return $this->connection->query($query, $args, $this->options);
}
+
}
diff --git a/core/modules/locale/src/StringStorageInterface.php b/core/modules/locale/src/StringStorageInterface.php
index 2aad73ea5..da1c8fb1f 100644
--- a/core/modules/locale/src/StringStorageInterface.php
+++ b/core/modules/locale/src/StringStorageInterface.php
@@ -176,4 +176,5 @@ interface StringStorageInterface {
* New string translation object.
*/
public function createTranslation($values = array());
+
}
diff --git a/core/modules/locale/src/Tests/LocaleContentTest.php b/core/modules/locale/src/Tests/LocaleContentTest.php
index 51ab6b0ad..07021faff 100644
--- a/core/modules/locale/src/Tests/LocaleContentTest.php
+++ b/core/modules/locale/src/Tests/LocaleContentTest.php
@@ -112,7 +112,7 @@ class LocaleContentTest extends WebTestBase {
// Edit the content and ensure correct language is selected.
$path = 'node/' . $node->id() . '/edit';
$this->drupalGet($path);
- $this->assertRaw('' . $name . ' ', 'Correct language selected.');
+ $this->assertRaw('' . $name . ' ', 'Correct language selected.');
// Ensure we can change the node language.
$edit = array(
'langcode[0][value]' => 'en',
diff --git a/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php b/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php
index c2ecc1a3d..0b69da257 100644
--- a/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php
+++ b/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php
@@ -638,4 +638,5 @@ msgstr "Deutsch"
EOF;
}
+
}
diff --git a/core/modules/locale/src/Tests/LocaleLibraryAlterTest.php b/core/modules/locale/src/Tests/LocaleLibraryAlterTest.php
index 0993e286a..e84e3dd48 100644
--- a/core/modules/locale/src/Tests/LocaleLibraryAlterTest.php
+++ b/core/modules/locale/src/Tests/LocaleLibraryAlterTest.php
@@ -32,4 +32,5 @@ class LocaleLibraryAlterTest extends WebTestBase {
$js_assets = $this->container->get('asset.resolver')->getJsAssets($assets, FALSE)[1];
$this->assertTrue(array_key_exists('core/modules/locale/locale.datepicker.js', $js_assets), 'locale.datepicker.js added to scripts.');
}
+
}
diff --git a/core/modules/locale/src/Tests/LocalePathTest.php b/core/modules/locale/src/Tests/LocalePathTest.php
index 7bd2615db..cc4f31a93 100644
--- a/core/modules/locale/src/Tests/LocalePathTest.php
+++ b/core/modules/locale/src/Tests/LocalePathTest.php
@@ -147,4 +147,5 @@ class LocalePathTest extends WebTestBase {
$this->assertText($second_node->label(), 'Custom alias with prefix returns second node.');
}
+
}
diff --git a/core/modules/locale/src/Tests/LocalePluralFormatTest.php b/core/modules/locale/src/Tests/LocalePluralFormatTest.php
index 0f6c9c107..00fe8d58a 100644
--- a/core/modules/locale/src/Tests/LocalePluralFormatTest.php
+++ b/core/modules/locale/src/Tests/LocalePluralFormatTest.php
@@ -444,4 +444,5 @@ msgid "Monday"
msgstr "Ponedjeljak"
EOF;
}
+
}
diff --git a/core/modules/locale/src/Tests/LocaleStringTest.php b/core/modules/locale/src/Tests/LocaleStringTest.php
index f70a96420..2f467e74d 100644
--- a/core/modules/locale/src/Tests/LocaleStringTest.php
+++ b/core/modules/locale/src/Tests/LocaleStringTest.php
@@ -201,4 +201,5 @@ class LocaleStringTest extends WebTestBase {
'translation' => $this->randomMachineName(100),
))->save();
}
+
}
diff --git a/core/modules/locale/src/Tests/LocaleTranslatedSchemaDefinitionTest.php b/core/modules/locale/src/Tests/LocaleTranslatedSchemaDefinitionTest.php
index dae9e5b2f..b117e2c8e 100644
--- a/core/modules/locale/src/Tests/LocaleTranslatedSchemaDefinitionTest.php
+++ b/core/modules/locale/src/Tests/LocaleTranslatedSchemaDefinitionTest.php
@@ -87,4 +87,5 @@ class LocaleTranslatedSchemaDefinitionTest extends WebTestBase {
$this->assertRaw('messages--status', 'No pending updates.');
$this->assertNoLinkByHref('fr/update.php/run', 'No link to run updates.');
}
+
}
diff --git a/core/modules/locale/src/Tests/LocaleTranslationUiTest.php b/core/modules/locale/src/Tests/LocaleTranslationUiTest.php
index 1f790b6b9..aad0119fa 100644
--- a/core/modules/locale/src/Tests/LocaleTranslationUiTest.php
+++ b/core/modules/locale/src/Tests/LocaleTranslationUiTest.php
@@ -205,7 +205,7 @@ class LocaleTranslationUiTest extends WebTestBase {
$this->assertNoText(t('No strings available.'), 'The translation has been removed');
}
- /*
+ /**
* Adds a language and checks that the JavaScript translation files are
* properly created and rebuilt on deletion.
*/
@@ -539,4 +539,5 @@ class LocaleTranslationUiTest extends WebTestBase {
$this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
$this->assertText($string->getString(), "Translation is marked as customized.");
}
+
}
diff --git a/core/modules/locale/src/Tests/LocaleUpdateBase.php b/core/modules/locale/src/Tests/LocaleUpdateBase.php
index a76345839..85196ad7c 100644
--- a/core/modules/locale/src/Tests/LocaleUpdateBase.php
+++ b/core/modules/locale/src/Tests/LocaleUpdateBase.php
@@ -301,4 +301,5 @@ EOF;
$db_translation = $db_translation == FALSE ? '' : $db_translation;
$this->assertEqual($translation, $db_translation, $message ? $message : format_string('Correct translation of %source (%language)', array('%source' => $source, '%language' => $langcode)));
}
+
}
diff --git a/core/modules/locale/src/Tests/LocaleUpdateCronTest.php b/core/modules/locale/src/Tests/LocaleUpdateCronTest.php
index 073258d3e..569b818bd 100644
--- a/core/modules/locale/src/Tests/LocaleUpdateCronTest.php
+++ b/core/modules/locale/src/Tests/LocaleUpdateCronTest.php
@@ -106,4 +106,5 @@ class LocaleUpdateCronTest extends LocaleUpdateBase {
$this->assertTrue($current->timestamp > $initial->timestamp, 'Timestamp is updated');
$this->assertTrue($current->last_checked > $initial->last_checked, 'Last checked is updated');
}
+
}
diff --git a/core/modules/locale/src/Tests/LocaleUpdateDevelopmentReleaseTest.php b/core/modules/locale/src/Tests/LocaleUpdateDevelopmentReleaseTest.php
index 4dd79134d..cfd2446fc 100644
--- a/core/modules/locale/src/Tests/LocaleUpdateDevelopmentReleaseTest.php
+++ b/core/modules/locale/src/Tests/LocaleUpdateDevelopmentReleaseTest.php
@@ -28,4 +28,5 @@ class LocaleUpdateDevelopmentReleaseTest extends WebTestBase {
$this->verbose($projects['contrib']->info['version']);
$this->assertEqual($projects['contrib']->info['version'], '12.x-10.x', 'The branch of the contrib module dev release.');
}
+
}
diff --git a/core/modules/menu_link_content/menu_link_content.module b/core/modules/menu_link_content/menu_link_content.module
index cd9a97300..98357c6cd 100644
--- a/core/modules/menu_link_content/menu_link_content.module
+++ b/core/modules/menu_link_content/menu_link_content.module
@@ -49,7 +49,6 @@ function menu_link_content_path_insert($path) {
*
* @param string $path
* The path alias.
- *
*/
function _menu_link_content_update_path_alias($path) {
/** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
diff --git a/core/modules/menu_link_content/src/Plugin/Deriver/MenuLinkContentDeriver.php b/core/modules/menu_link_content/src/Plugin/Deriver/MenuLinkContentDeriver.php
index 6f631345c..e05fa2158 100644
--- a/core/modules/menu_link_content/src/Plugin/Deriver/MenuLinkContentDeriver.php
+++ b/core/modules/menu_link_content/src/Plugin/Deriver/MenuLinkContentDeriver.php
@@ -43,7 +43,6 @@ class MenuLinkContentDeriver extends DeriverBase implements ContainerDeriverInte
*
* @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
* The query factory.
- *
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager
diff --git a/core/modules/menu_link_content/src/Tests/MenuLinkContentFormTest.php b/core/modules/menu_link_content/src/Tests/MenuLinkContentFormTest.php
index 5be8bed6b..1bdc927f7 100644
--- a/core/modules/menu_link_content/src/Tests/MenuLinkContentFormTest.php
+++ b/core/modules/menu_link_content/src/Tests/MenuLinkContentFormTest.php
@@ -64,4 +64,5 @@ class MenuLinkContentFormTest extends WebTestBase {
);
$this->assertText(t('Manually entered paths should start with /, ? or #.'));
}
+
}
diff --git a/core/modules/menu_ui/menu_ui.module b/core/modules/menu_ui/menu_ui.module
index 463f8cabd..d642247f5 100644
--- a/core/modules/menu_ui/menu_ui.module
+++ b/core/modules/menu_ui/menu_ui.module
@@ -257,7 +257,7 @@ function menu_ui_get_menu_link_defaults(NodeInterface $node) {
}
/**
- * Implements hook_form_BASE_FORM_ID_alter() for node_form.
+ * Implements hook_form_BASE_FORM_ID_alter() for \Drupal\node\NodeForm.
*
* Adds menu item fields to the node form.
*
@@ -371,7 +371,7 @@ function menu_ui_form_node_form_submit($form, FormStateInterface $form_state) {
$entity->delete();
}
}
- elseif (trim($values['title'])) {
+ elseif (trim($values['title'])) {
// Decompose the selected menu parent option into 'menu_name' and 'parent',
// if the form used the default parent selection widget.
if (!empty($values['menu_parent'])) {
@@ -385,12 +385,12 @@ function menu_ui_form_node_form_submit($form, FormStateInterface $form_state) {
}
/**
- * Implements hook_form_FORM_ID_alter().
+ * Implements hook_form_FORM_ID_alter() for \Drupal\node\NodeTypeForm.
*
* Adds menu options to the node type form.
*
- * @see NodeTypeForm::form().
- * @see menu_ui_form_node_type_form_submit().
+ * @see NodeTypeForm::form()
+ * @see menu_ui_form_node_type_form_submit()
*/
function menu_ui_form_node_type_form_alter(&$form, FormStateInterface $form_state) {
/** @var \Drupal\Core\Menu\MenuParentFormSelectorInterface $menu_parent_selector */
@@ -437,7 +437,7 @@ function menu_ui_form_node_type_form_alter(&$form, FormStateInterface $form_stat
/**
* Submit handler for forms with menu options.
*
- * @see menu_ui_form_node_type_form_alter().
+ * @see menu_ui_form_node_type_form_alter()
*/
function menu_ui_form_node_type_form_validate(&$form, FormStateInterface $form_state) {
$available_menus = array_filter($form_state->getValue('menu_options'));
@@ -457,7 +457,7 @@ function menu_ui_form_node_type_form_validate(&$form, FormStateInterface $form_s
/**
* Entity builder for the node type form with menu options.
*
- * @see menu_ui_form_node_type_form_alter().
+ * @see menu_ui_form_node_type_form_alter()
*/
function menu_ui_form_node_type_form_builder($entity_type, NodeTypeInterface $type, &$form, FormStateInterface $form_state) {
$type->setThirdPartySetting('menu_ui', 'available_menus', array_values(array_filter($form_state->getValue('menu_options'))));
diff --git a/core/modules/menu_ui/src/Form/MenuDeleteForm.php b/core/modules/menu_ui/src/Form/MenuDeleteForm.php
index 86fbd6b81..22bfb0ac3 100644
--- a/core/modules/menu_ui/src/Form/MenuDeleteForm.php
+++ b/core/modules/menu_ui/src/Form/MenuDeleteForm.php
@@ -92,4 +92,5 @@ class MenuDeleteForm extends EntityDeleteForm {
parent::submitForm($form, $form_state);
}
+
}
diff --git a/core/modules/menu_ui/src/Tests/MenuLinkReorderTest.php b/core/modules/menu_ui/src/Tests/MenuLinkReorderTest.php
index c0e985698..0396f173e 100644
--- a/core/modules/menu_ui/src/Tests/MenuLinkReorderTest.php
+++ b/core/modules/menu_ui/src/Tests/MenuLinkReorderTest.php
@@ -63,4 +63,5 @@ class MenuLinkReorderTest extends WebTestBase {
$this->assertLink('Home');
}
+
}
diff --git a/core/modules/menu_ui/src/Tests/MenuNodeTest.php b/core/modules/menu_ui/src/Tests/MenuNodeTest.php
index cdc0b12c7..3fc8423fe 100644
--- a/core/modules/menu_ui/src/Tests/MenuNodeTest.php
+++ b/core/modules/menu_ui/src/Tests/MenuNodeTest.php
@@ -229,10 +229,10 @@ class MenuNodeTest extends WebTestBase {
));
$child_item->save();
// Edit the first node.
- $this->drupalGet('node/'. $node->id() .'/edit');
+ $this->drupalGet('node/' . $node->id() . '/edit');
// Assert that it is not possible to set the parent of the first node to itself or the second node.
- $this->assertNoOption('edit-menu-menu-parent', 'tools:'. $item->getPluginId());
- $this->assertNoOption('edit-menu-menu-parent', 'tools:'. $child_item->getPluginId());
+ $this->assertNoOption('edit-menu-menu-parent', 'tools:' . $item->getPluginId());
+ $this->assertNoOption('edit-menu-menu-parent', 'tools:' . $child_item->getPluginId());
// Assert that unallowed Administration menu is not available in options.
$this->assertNoOption('edit-menu-menu-parent', 'admin:');
}
@@ -337,4 +337,5 @@ class MenuNodeTest extends WebTestBase {
$this->drupalGet($url);
$this->assertFieldById('edit-menu-title', $translated_node_title);
}
+
}
diff --git a/core/modules/menu_ui/src/Tests/MenuTest.php b/core/modules/menu_ui/src/Tests/MenuTest.php
index 74c09af0e..f640cc749 100644
--- a/core/modules/menu_ui/src/Tests/MenuTest.php
+++ b/core/modules/menu_ui/src/Tests/MenuTest.php
@@ -571,7 +571,7 @@ class MenuTest extends MenuWebTestBase {
$id = 'block:block=' . $block->id() . ':langcode=en|menu:menu=' . $custom_menu->id() . ':langcode=en';
// @see \Drupal\contextual\Tests\ContextualDynamicContextTest:assertContextualLinkPlaceHolder()
- $this->assertRaw('
', format_string('Contextual link placeholder with id @id exists.', array('@id' => $id)));
+ $this->assertRaw('
', format_string('Contextual link placeholder with id @id exists.', array('@id' => $id)));
// Get server-rendered contextual links.
// @see \Drupal\contextual\Tests\ContextualDynamicContextTest:renderContextualLinks()
diff --git a/core/modules/migrate/src/Annotation/MigrateProcessPlugin.php b/core/modules/migrate/src/Annotation/MigrateProcessPlugin.php
index 121276c49..f08da3bd9 100644
--- a/core/modules/migrate/src/Annotation/MigrateProcessPlugin.php
+++ b/core/modules/migrate/src/Annotation/MigrateProcessPlugin.php
@@ -44,4 +44,5 @@ class MigrateProcessPlugin extends Plugin {
* @var bool (optional)
*/
public $handle_multiples = FALSE;
+
}
diff --git a/core/modules/migrate/src/MigrateBuildDependencyInterface.php b/core/modules/migrate/src/MigrateBuildDependencyInterface.php
index 5c52998f1..bb02c8887 100644
--- a/core/modules/migrate/src/MigrateBuildDependencyInterface.php
+++ b/core/modules/migrate/src/MigrateBuildDependencyInterface.php
@@ -18,4 +18,5 @@ interface MigrateBuildDependencyInterface {
* An array of migrations.
*/
public function buildDependencyMigration(array $migrations, array $dynamic_ids);
+
}
diff --git a/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php
index 89eb0e4b2..c0b3537ac 100644
--- a/core/modules/migrate/src/MigrateExecutable.php
+++ b/core/modules/migrate/src/MigrateExecutable.php
@@ -378,6 +378,7 @@ class MigrateExecutable implements MigrateExecutableInterface {
$new_value[] = $plugin->transform($scalar_value, $this, $row, $destination);
}
catch (MigrateSkipProcessException $e) {
+ $new_value[] = NULL;
$break = TRUE;
}
}
@@ -391,6 +392,7 @@ class MigrateExecutable implements MigrateExecutableInterface {
$value = $plugin->transform($value, $this, $row, $destination);
}
catch (MigrateSkipProcessException $e) {
+ $value = NULL;
break;
}
$multiple = $multiple || $plugin->multiple();
diff --git a/core/modules/migrate/src/MigrateMessageInterface.php b/core/modules/migrate/src/MigrateMessageInterface.php
index 2b55651ca..628a684fe 100644
--- a/core/modules/migrate/src/MigrateMessageInterface.php
+++ b/core/modules/migrate/src/MigrateMessageInterface.php
@@ -14,4 +14,5 @@ interface MigrateMessageInterface {
* The type of message, for example: status or warning.
*/
public function display($message, $type = 'status');
+
}
diff --git a/core/modules/migrate/src/Plugin/MigrateIdMapInterface.php b/core/modules/migrate/src/Plugin/MigrateIdMapInterface.php
index 58ec334d6..d3bdb8923 100644
--- a/core/modules/migrate/src/Plugin/MigrateIdMapInterface.php
+++ b/core/modules/migrate/src/Plugin/MigrateIdMapInterface.php
@@ -209,10 +209,32 @@ interface MigrateIdMapInterface extends \Iterator, PluginInspectionInterface {
* The source identifier keyed values of the record, e.g. ['nid' => 5].
*
* @return array
- * The destination identifier values of the record, or NULL on failure.
+ * The destination identifier values of the record, or empty on failure.
+ *
+ * @deprecated in Drupal 8.1.x, will be removed before Drupal 9.0.x. Use
+ * lookupDestinationIds() instead.
*/
public function lookupDestinationId(array $source_id_values);
+ /**
+ * Looks up the destination identifiers corresponding to a source key.
+ *
+ * This can look up a subset of source keys if only some are provided, and
+ * will return all destination keys that match.
+ *
+ * @param array $source_id_values
+ * The source identifier keyed values of the records, e.g. ['nid' => 5].
+ * If unkeyed, the first count($source_id_values) keys will be assumed.
+ *
+ * @return array
+ * An array of arrays of destination identifier values.
+ *
+ * @throws \Drupal\migrate\MigrateException
+ * Thrown when $source_id_values contains unknown keys, or is the wrong
+ * length.
+ */
+ public function lookupDestinationIds(array $source_id_values);
+
/**
* Looks up the destination identifier currently being iterated.
*
diff --git a/core/modules/migrate/src/Plugin/Migration.php b/core/modules/migrate/src/Plugin/Migration.php
index 9b22e359f..86294b540 100644
--- a/core/modules/migrate/src/Plugin/Migration.php
+++ b/core/modules/migrate/src/Plugin/Migration.php
@@ -217,7 +217,7 @@ class Migration extends PluginBase implements MigrationInterface, RequirementsIn
protected $migrationPluginManager;
/**
- * The source plugin manager.
+ * The source plugin manager.
*
* @var \Drupal\migrate\Plugin\MigratePluginManager
*/
@@ -712,4 +712,5 @@ class Migration extends PluginBase implements MigrationInterface, RequirementsIn
public function getDestinationIds() {
$this->destinationIds;
}
+
}
diff --git a/core/modules/migrate/src/Plugin/MigrationInterface.php b/core/modules/migrate/src/Plugin/MigrationInterface.php
index f61add01b..7572760b5 100644
--- a/core/modules/migrate/src/Plugin/MigrationInterface.php
+++ b/core/modules/migrate/src/Plugin/MigrationInterface.php
@@ -279,7 +279,7 @@ interface MigrationInterface extends PluginInspectionInterface, DerivativeInspec
* @return $this
* The migration entity.
*
- * @see Drupal\migrate_drupal\Plugin\migrate\load\LoadEntity::processLinkField().
+ * @see Drupal\migrate_drupal\Plugin\migrate\load\LoadEntity::processLinkField()
*/
public function mergeProcessOfProperty($property, array $process_of_property);
diff --git a/core/modules/migrate/src/Plugin/MigrationPluginManager.php b/core/modules/migrate/src/Plugin/MigrationPluginManager.php
index f0e6493d8..d082c11d7 100644
--- a/core/modules/migrate/src/Plugin/MigrationPluginManager.php
+++ b/core/modules/migrate/src/Plugin/MigrationPluginManager.php
@@ -157,6 +157,7 @@ class MigrationPluginManager extends DefaultPluginManager implements MigrationPl
// current migration.
$dependency_graph = [];
$required_dependency_graph = [];
+ $have_optional = FALSE;
foreach ($migrations as $migration) {
/** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
$id = $migration->id();
@@ -172,14 +173,15 @@ class MigrationPluginManager extends DefaultPluginManager implements MigrationPl
$this->addDependency($dependency_graph, $id, $dependency, $dynamic_ids);
}
}
- if (isset($migration_dependencies['optional'])) {
+ if (!empty($migration_dependencies['optional'])) {
foreach ($migration_dependencies['optional'] as $dependency) {
$this->addDependency($dependency_graph, $id, $dependency, $dynamic_ids);
}
+ $have_optional = TRUE;
}
}
$dependency_graph = (new Graph($dependency_graph))->searchAndSort();
- if (!empty($migration_dependencies['optional'])) {
+ if ($have_optional) {
$required_dependency_graph = (new Graph($required_dependency_graph))->searchAndSort();
}
else {
diff --git a/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
index 82699570d..cf39275f8 100644
--- a/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
+++ b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
@@ -517,16 +517,56 @@ class Sql extends PluginBase implements MigrateIdMapInterface, ContainerFactoryP
* {@inheritdoc}
*/
public function lookupDestinationId(array $source_id_values) {
+ $results = $this->lookupDestinationIds($source_id_values);
+ return $results ? reset($results) : array();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function lookupDestinationIds(array $source_id_values) {
if (empty($source_id_values)) {
return array();
}
- $query = $this->getDatabase()->select($this->mapTableName(), 'map')
- ->fields('map', $this->destinationIdFields());
- $query->condition(static::SOURCE_IDS_HASH, $this->getSourceIDsHash($source_id_values));
- $result = $query->execute();
- $destination_id = $result->fetchAssoc();
- return array_values($destination_id ?: array());
+ // Canonicalize the keys into a hash of DB-field => value.
+ $is_associative = !isset($source_id_values[0]);
+ $conditions = [];
+ foreach ($this->sourceIdFields() as $field_name => $db_field) {
+ if ($is_associative) {
+ // Associative $source_id_values can have fields out of order.
+ if (isset($source_id_values[$field_name])) {
+ $conditions[$db_field] = $source_id_values[$field_name];
+ unset($source_id_values[$field_name]);
+ }
+ }
+ else {
+ // For non-associative $source_id_values, we assume they're the first
+ // few fields.
+ if (empty($source_id_values)) {
+ break;
+ }
+ $conditions[$db_field] = array_shift($source_id_values);
+ }
+ }
+
+ if (!empty($source_id_values)) {
+ throw new MigrateException("Extra unknown items in source IDs");
+ }
+
+ $query = $this->getDatabase()->select($this->mapTableName(), 'map')
+ ->fields('map', $this->destinationIdFields());
+ if (count($this->sourceIdFields()) === count($conditions)) {
+ // Optimization: Use the primary key.
+ $query->condition(self::SOURCE_IDS_HASH, $this->getSourceIDsHash(array_values($conditions)));
+ }
+ else {
+ foreach ($conditions as $db_field => $value) {
+ $query->condition($db_field, $value);
+ }
+ }
+
+ return $query->execute()->fetchAll(\PDO::FETCH_NUM);
}
/**
diff --git a/core/modules/migrate/src/Row.php b/core/modules/migrate/src/Row.php
index 4f07ef4ab..94cb8b2bd 100644
--- a/core/modules/migrate/src/Row.php
+++ b/core/modules/migrate/src/Row.php
@@ -335,4 +335,5 @@ class Row {
public function isStub() {
return $this->isStub;
}
+
}
diff --git a/core/modules/migrate/tests/src/Unit/Exception/RequirementsExceptionTest.php b/core/modules/migrate/tests/src/Unit/Exception/RequirementsExceptionTest.php
index 97009751b..72d37ed73 100644
--- a/core/modules/migrate/tests/src/Unit/Exception/RequirementsExceptionTest.php
+++ b/core/modules/migrate/tests/src/Unit/Exception/RequirementsExceptionTest.php
@@ -47,4 +47,5 @@ class RequirementsExceptionTest extends UnitTestCase {
),
);
}
+
}
diff --git a/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php b/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
index f0e783270..a9d1313f5 100644
--- a/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
@@ -430,6 +430,123 @@ class MigrateSqlIdMapTest extends MigrateTestCase {
$this->assertSame(0, count($destination_id));
}
+ /**
+ * Setup a database with the given rows.
+ *
+ * @param array $source_keys
+ * The source keys for the ID map table.
+ * @param array $dest_keys
+ * The destination keys for the ID map table.
+ * @param array $rows
+ * An array of source and destination value arrays for the ID map table.
+ *
+ * @return \Drupal\Tests\migrate\Unit\TestSqlIdMap
+ * An ID map instance for testing.
+ */
+ protected function setupRows($source_keys, $dest_keys, $rows) {
+ $this->database = $this->getDatabase([]);
+ $this->sourceIds = array_fill_keys($source_keys, []);
+ $this->destinationIds = array_fill_keys($dest_keys, []);
+
+ $db_keys = [];
+ foreach (array_keys($source_keys) as $i) {
+ $db_keys[] = 'sourceid' . ($i + 1);
+ }
+ foreach (array_keys($dest_keys) as $i) {
+ $db_keys[] = 'destid' . ($i + 1);
+ }
+ foreach ($rows as $row) {
+ $values = array_combine($db_keys, $row);
+ $source_values = array_slice($row, 0, count($source_keys));
+ $values['source_ids_hash'] = $this->getIdMap()->getSourceIDsHash($source_values);
+ $this->saveMap($values);
+ }
+
+ return $this->getIdMap();
+ }
+
+ /**
+ * Tests lookupDestinationIds().
+ */
+ public function testLookupDestinationIds() {
+ // Simple map with one source and one destination ID.
+ $id_map = $this->setupRows(['nid'], ['nid'], [
+ [1, 101],
+ [2, 102],
+ [3, 103],
+ ]);
+
+ // Lookup nothing, gives nothing.
+ $this->assertEquals([], $id_map->lookupDestinationIds([]));
+ // Lookup by complete non-associative list.
+ $this->assertEquals([[101]], $id_map->lookupDestinationIds([1]));
+ $this->assertEquals([[102]], $id_map->lookupDestinationIds([2]));
+ $this->assertEquals([], $id_map->lookupDestinationIds([99]));
+ // Lookup by complete associative list.
+ $this->assertEquals([[101]], $id_map->lookupDestinationIds(['nid' => 1]));
+ $this->assertEquals([[102]], $id_map->lookupDestinationIds(['nid' => 2]));
+ $this->assertEquals([], $id_map->lookupDestinationIds(['nid' => 99]));
+
+ // Map with multiple source and destination IDs.
+ $id_map = $this->setupRows(['nid', 'language'], ['nid', 'langcode'], [
+ [1, 'en', 101, 'en'],
+ [1, 'fr', 101, 'fr'],
+ [1, 'de', 101, 'de'],
+ [2, 'en', 102, 'en'],
+ ]);
+
+ // Lookup nothing, gives nothing.
+ $this->assertEquals([], $id_map->lookupDestinationIds([]));
+ // Lookup by complete non-associative list.
+ $this->assertEquals([[101, 'en']], $id_map->lookupDestinationIds([1, 'en']));
+ $this->assertEquals([[101, 'fr']], $id_map->lookupDestinationIds([1, 'fr']));
+ $this->assertEquals([[102, 'en']], $id_map->lookupDestinationIds([2, 'en']));
+ $this->assertEquals([], $id_map->lookupDestinationIds([2, 'fr']));
+ $this->assertEquals([], $id_map->lookupDestinationIds([99, 'en']));
+ // Lookup by complete associative list.
+ $this->assertEquals([[101, 'en']], $id_map->lookupDestinationIds(['nid' => 1, 'language' => 'en']));
+ $this->assertEquals([[101, 'fr']], $id_map->lookupDestinationIds(['nid' => 1, 'language' => 'fr']));
+ $this->assertEquals([[102, 'en']], $id_map->lookupDestinationIds(['nid' => 2, 'language' => 'en']));
+ $this->assertEquals([], $id_map->lookupDestinationIds(['nid' => 2, 'language' => 'fr']));
+ $this->assertEquals([], $id_map->lookupDestinationIds(['nid' => 99, 'language' => 'en']));
+ // Lookup by partial non-associative list.
+ $this->assertEquals([[101, 'en'], [101, 'fr'], [101, 'de']], $id_map->lookupDestinationIds([1]));
+ $this->assertEquals([[102, 'en']], $id_map->lookupDestinationIds([2]));
+ $this->assertEquals([], $id_map->lookupDestinationIds([99]));
+ // Lookup by partial associative list.
+ $this->assertEquals([[101, 'en'], [101, 'fr'], [101, 'de']], $id_map->lookupDestinationIds(['nid' => 1]));
+ $this->assertEquals([[102, 'en']], $id_map->lookupDestinationIds(['nid' => 2]));
+ $this->assertEquals([], $id_map->lookupDestinationIds(['nid' => 99]));
+ // Out-of-order partial associative list.
+ $this->assertEquals([[101, 'en'], [102, 'en']], $id_map->lookupDestinationIds(['language' => 'en']));
+ $this->assertEquals([[101, 'fr']], $id_map->lookupDestinationIds(['language' => 'fr']));
+ $this->assertEquals([], $id_map->lookupDestinationIds(['language' => 'zh']));
+ // Error conditions.
+ try {
+ $id_map->lookupDestinationIds([1, 2, 3]);
+ $this->fail('Too many source IDs should throw');
+ }
+ catch (MigrateException $e) {
+ $this->assertEquals("Extra unknown items in source IDs", $e->getMessage());
+ }
+ try {
+ $id_map->lookupDestinationIds(['nid' => 1, 'aaa' => '2']);
+ $this->fail('Unknown source ID key should throw');
+ }
+ catch (MigrateException $e) {
+ $this->assertEquals("Extra unknown items in source IDs", $e->getMessage());
+ }
+
+ // Verify that we are looking up by source_id_hash when all source IDs are
+ // passed in.
+ $id_map->getDatabase()->update($id_map->mapTableName())
+ ->condition('sourceid1', 1)
+ ->condition('sourceid2', 'en')
+ ->fields([TestSqlIdMap::SOURCE_IDS_HASH => uniqid()])
+ ->execute();
+ $this->assertNotEquals([[101, 'en']], $id_map->lookupDestinationIds([1, 'en']));
+ }
+
/**
* Tests the getRowByDestination method.
*/
diff --git a/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php b/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php
new file mode 100644
index 000000000..91351cfc1
--- /dev/null
+++ b/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php
@@ -0,0 +1,220 @@
+getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+ $cache_backend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
+ $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
+ $this->pluginManager = new MigrationPluginManager($module_handler, $cache_backend, $language_manager);
+ }
+
+ /**
+ * Tests building dependencies for multiple migrations.
+ *
+ * @dataProvider dependencyProvider
+ */
+ public function testDependencyBuilding($migrations_data, $result_ids) {
+ $migrations = [];
+ foreach ($migrations_data as $migration_id => $migration_data) {
+ $migrations[$migration_id] = new TestMigrationMock($migration_id, $migration_data['dependencies']);
+ }
+
+ $ordered_migrations = $this->pluginManager->buildDependencyMigration($migrations, []);
+
+ // Verify results.
+ $this->assertEquals($result_ids, array_keys($ordered_migrations));
+ foreach ($migrations_data as $migration_id => $migration_data) {
+ $migration = $migrations[$migration_id];
+
+ $requirements = $migration_data['result_requirements'];
+ if (empty($requirements)) {
+ $this->assertEquals([], $migration->set);
+ }
+ else {
+ $requirements = array_combine($requirements, $requirements);
+
+ $this->assertEquals(1, count($migration->set));
+ list($set_prop, $set_requirements) = reset($migration->set);
+ $this->assertEquals('requirements', $set_prop);
+ $this->assertEquals($requirements, $set_requirements);
+ }
+ }
+ }
+
+ /**
+ * Provide dependency data for testing.
+ */
+ public function dependencyProvider() {
+ return [
+ // Just one migration, with no dependencies.
+ [
+ [
+ 'm1' => [
+ 'dependencies' => [],
+ 'result_requirements' => [],
+ ],
+ ],
+ ['m1'],
+ ],
+
+ // Just one migration, with required dependencies.
+ [
+ [
+ 'm1' => [
+ 'dependencies' => [
+ 'required' => ['required1', 'required2'],
+ ],
+ 'result_requirements' => ['required1', 'required2'],
+ ],
+ ],
+ ['m1'],
+ ],
+
+ // Just one migration, with optional dependencies.
+ [
+ [
+ 'm1' => [
+ 'dependencies' => [
+ 'optional' => ['optional1'],
+ ],
+ 'result_requirements' => [],
+ ],
+ ],
+ ['m1'],
+ ],
+
+ // Multiple migrations.
+ [
+ [
+ 'm1' => [
+ 'dependencies' => [
+ 'required' => ['required1', 'required2'],
+ ],
+ 'result_requirements' => ['required1', 'required2'],
+ ],
+ 'm2' => [
+ 'dependencies' => [
+ 'optional' => ['optional1'],
+ ],
+ 'result_requirements' => [],
+ ],
+ ],
+ ['m1', 'm2'],
+ ],
+
+ // Multiple migrations, reordered due to optional requirement.
+ [
+ [
+ 'm1' => [
+ 'dependencies' => [
+ 'optional' => ['m2'],
+ ],
+ 'result_requirements' => [],
+ ],
+ 'm2' => [
+ 'dependencies' => [
+ 'optional' => ['optional1'],
+ ],
+ 'result_requirements' => [],
+ ],
+ ],
+ ['m2', 'm1'],
+ ],
+
+ // Ensure that optional requirements aren't turned into required ones,
+ // if the last migration has no optional deps.
+ [
+ [
+ 'm1' => [
+ 'dependencies' => [
+ 'optional' => ['m2'],
+ ],
+ 'result_requirements' => [],
+ ],
+ 'm2' => [
+ 'dependencies' => [],
+ 'result_requirements' => [],
+ ],
+ ],
+ ['m2', 'm1'],
+ ],
+ ];
+ }
+
+}
+
+/**
+ * A mock migration plugin.
+ *
+ * Why are we using a custom class here?
+ *
+ * 1. The function buildDependencyMigration() calls $migration->set(), which
+ * is not actually in MigrationInterface.
+ *
+ * 2. The function buildDependencyMigration() calls array_multisort on an
+ * array with mocks in it. PHPUnit mocks are really complex, and if PHP tries
+ * to compare them it will die with "Nesting level too deep".
+ */
+class TestMigrationMock extends Migration {
+ /**
+ * The values passed into set().
+ *
+ * @var array $set
+ */
+ public $set = [];
+
+ /**
+ * TestMigrationMock constructor.
+ */
+ public function __construct($id, $dependencies) {
+ // Intentionally ignore parent constructor.
+ $this->id = $id;
+ $this->dependencies = $dependencies;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function id() {
+ return $this->id;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getMigrationDependencies() {
+ return $this->dependencies;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function set($prop, $value) {
+ $this->set[] = func_get_args();
+ }
+
+}
diff --git a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php
index d08e035ab..da20b4920 100644
--- a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php
+++ b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php
@@ -115,4 +115,5 @@ class EntityTestDestination extends EntityContentBase {
protected function getEntity(Row $row, array $old_destination_id_values) {
return $this->entity;
}
+
}
diff --git a/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php b/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php
index c12478b8c..1be14bc56 100644
--- a/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php
+++ b/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php
@@ -63,4 +63,5 @@ class TestPerComponentEntityDisplay extends ComponentEntityDisplayBase {
public function getTestValues() {
return $this->testValues;
}
+
}
diff --git a/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php b/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php
index a99af4240..18df3621a 100644
--- a/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php
+++ b/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php
@@ -63,4 +63,5 @@ class TestPerComponentEntityFormDisplay extends PerComponentEntityFormDisplay {
public function getTestValues() {
return $this->testValues;
}
+
}
diff --git a/core/modules/migrate/tests/src/Unit/process/ConcatTest.php b/core/modules/migrate/tests/src/Unit/process/ConcatTest.php
index d13c33b80..1d0d4c377 100644
--- a/core/modules/migrate/tests/src/Unit/process/ConcatTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/ConcatTest.php
@@ -49,6 +49,7 @@ class ConcatTest extends MigrateProcessTestCase {
$value = $this->plugin->transform(array('foo', 'bar'), $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, 'foo_bar');
}
+
}
class TestConcat extends Concat {
diff --git a/core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php b/core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php
index 27aad89b7..a1960deab 100644
--- a/core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php
@@ -160,4 +160,5 @@ class DedupeEntityTest extends MigrateProcessTestCase {
->method('execute')
->will($this->returnCallback(function () use (&$count) { return $count--;}));
}
+
}
diff --git a/core/modules/migrate/tests/src/Unit/process/GetTest.php b/core/modules/migrate/tests/src/Unit/process/GetTest.php
index bdbb551e5..316cbfc5c 100644
--- a/core/modules/migrate/tests/src/Unit/process/GetTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/GetTest.php
@@ -114,4 +114,5 @@ class TestGet extends Get {
public function setSource($source) {
$this->configuration['source'] = $source;
}
+
}
diff --git a/core/modules/migrate/tests/src/Unit/process/IteratorTest.php b/core/modules/migrate/tests/src/Unit/process/IteratorTest.php
index 48f564785..7c731a2e0 100644
--- a/core/modules/migrate/tests/src/Unit/process/IteratorTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/IteratorTest.php
@@ -78,4 +78,5 @@ class IteratorTest extends MigrateTestCase {
$this->assertSame($new_value[42]['foo'], 'test');
$this->assertSame($new_value[42]['id'], 42);
}
+
}
diff --git a/core/modules/migrate/tests/src/Unit/process/MachineNameTest.php b/core/modules/migrate/tests/src/Unit/process/MachineNameTest.php
index d11c65702..7f44157f3 100644
--- a/core/modules/migrate/tests/src/Unit/process/MachineNameTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/MachineNameTest.php
@@ -44,7 +44,7 @@ class MachineNameTest extends MigrateProcessTestCase {
// - Uppercase -> lowercase,
// - Multiple consecutive underscore -> single underscore.
$human_name_ascii = 'foo2, the.bar;2*&the%baz!YEE____HaW ';
- $human_name = $human_name_ascii .'áéő';
+ $human_name = $human_name_ascii . 'áéő';
$expected_result = 'foo2_the_bar_2_the_baz_yee_haw_aeo';
// Test for calling transliterate on mock object.
$this->transliteration
diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/cckfield/CckFieldPluginBase.php b/core/modules/migrate_drupal/src/Plugin/migrate/cckfield/CckFieldPluginBase.php
index abe3d0439..87d545730 100644
--- a/core/modules/migrate_drupal/src/Plugin/migrate/cckfield/CckFieldPluginBase.php
+++ b/core/modules/migrate_drupal/src/Plugin/migrate/cckfield/CckFieldPluginBase.php
@@ -17,7 +17,7 @@ use Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface;
*
* @ingroup migration
*/
-abstract class CckFieldPluginBase extends PluginBase implements MigrateCckFieldInterface {
+abstract class CckFieldPluginBase extends PluginBase implements MigrateCckFieldInterface {
/**
* {@inheritdoc}
diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php
index 0a43d30de..e27a35310 100644
--- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php
+++ b/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php
@@ -125,6 +125,7 @@ class Drupal6SqlBaseTest extends MigrateTestCase {
// Test non-default.
$this->assertSame(TRUE, $this->base->variableGetWrapper('my_variable', FALSE));
}
+
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
@@ -217,4 +218,5 @@ class TestDrupal6SqlBase extends DrupalSqlBase {
public function getIds() {
return array();
}
+
}
diff --git a/core/modules/migrate_drupal_ui/src/Tests/d6/MigrateUpgrade6Test.php b/core/modules/migrate_drupal_ui/src/Tests/d6/MigrateUpgrade6Test.php
index fd22c6ee4..d073c186d 100644
--- a/core/modules/migrate_drupal_ui/src/Tests/d6/MigrateUpgrade6Test.php
+++ b/core/modules/migrate_drupal_ui/src/Tests/d6/MigrateUpgrade6Test.php
@@ -43,7 +43,7 @@ class MigrateUpgrade6Test extends MigrateUpgradeTestBase {
'field_config' => 62,
'field_storage_config' => 43,
'file' => 7,
- 'filter_format' => 8,
+ 'filter_format' => 7,
'image_style' => 5,
'migration' => 105,
'node' => 9,
diff --git a/core/modules/node/src/Controller/NodeController.php b/core/modules/node/src/Controller/NodeController.php
index edb568231..9fbd60350 100644
--- a/core/modules/node/src/Controller/NodeController.php
+++ b/core/modules/node/src/Controller/NodeController.php
@@ -6,7 +6,6 @@ use Drupal\Component\Utility\Xss;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
-use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Render\RendererInterface;
use Drupal\Core\Url;
use Drupal\node\NodeTypeInterface;
@@ -157,8 +156,8 @@ class NodeController extends ControllerBase implements ContainerInjectionInterfa
*/
public function revisionOverview(NodeInterface $node) {
$account = $this->currentUser();
- $langcode = $this->languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId();
- $langname = $this->languageManager()->getLanguageName($langcode);
+ $langcode = $node->language()->getId();
+ $langname = $node->language()->getName();
$languages = $node->getTranslationLanguages();
$has_translations = (count($languages) > 1);
$node_storage = $this->entityManager()->getStorage('node');
@@ -179,6 +178,8 @@ class NodeController extends ControllerBase implements ContainerInjectionInterfa
foreach (array_reverse($vids) as $vid) {
/** @var \Drupal\node\NodeInterface $revision */
$revision = $node_storage->loadRevision($vid);
+ // Only show revisions that are affected by the language that is being
+ // displayed.
if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) {
$username = [
'#theme' => 'username',
diff --git a/core/modules/node/src/NodeStorageInterface.php b/core/modules/node/src/NodeStorageInterface.php
index 70562ff46..b09d7b767 100644
--- a/core/modules/node/src/NodeStorageInterface.php
+++ b/core/modules/node/src/NodeStorageInterface.php
@@ -64,4 +64,5 @@ interface NodeStorageInterface extends ContentEntityStorageInterface {
* The language object.
*/
public function clearRevisionsLanguage(LanguageInterface $language);
+
}
diff --git a/core/modules/node/src/NodeTypeInterface.php b/core/modules/node/src/NodeTypeInterface.php
index 7e657bddd..c034ffbee 100644
--- a/core/modules/node/src/NodeTypeInterface.php
+++ b/core/modules/node/src/NodeTypeInterface.php
@@ -80,4 +80,5 @@ interface NodeTypeInterface extends ConfigEntityInterface {
* The description of this node type.
*/
public function getDescription();
+
}
diff --git a/core/modules/node/src/Plugin/Condition/NodeType.php b/core/modules/node/src/Plugin/Condition/NodeType.php
index dccf5862e..ace42e620 100644
--- a/core/modules/node/src/Plugin/Condition/NodeType.php
+++ b/core/modules/node/src/Plugin/Condition/NodeType.php
@@ -18,7 +18,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* "node" = @ContextDefinition("entity:node", label = @Translation("Node"))
* }
* )
- *
*/
class NodeType extends ConditionPluginBase implements ContainerFactoryPluginInterface {
diff --git a/core/modules/node/src/Plugin/Search/NodeSearch.php b/core/modules/node/src/Plugin/Search/NodeSearch.php
index 1a1f0529d..d161a0a0d 100644
--- a/core/modules/node/src/Plugin/Search/NodeSearch.php
+++ b/core/modules/node/src/Plugin/Search/NodeSearch.php
@@ -151,6 +151,8 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter
* A config object for 'search.settings'.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
+ * @param \Drupal\Core\Render\RendererInterface $renderer
+ * The renderer.
* @param \Drupal\Core\Session\AccountInterface $account
* The $account object to use for checking for access to advanced search.
*/
@@ -621,7 +623,7 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter
}
}
- /*
+ /**
* {@inheritdoc}
*/
public function buildSearchUrlQuery(FormStateInterface $form_state) {
diff --git a/core/modules/node/src/Plugin/views/argument_default/Node.php b/core/modules/node/src/Plugin/views/argument_default/Node.php
index b65ed4128..e5149f652 100644
--- a/core/modules/node/src/Plugin/views/argument_default/Node.php
+++ b/core/modules/node/src/Plugin/views/argument_default/Node.php
@@ -35,7 +35,6 @@ class Node extends ArgumentDefaultPluginBase implements CacheableDependencyInter
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
- *
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* The route match.
*/
diff --git a/core/modules/node/src/Plugin/views/field/RevisionLinkRevert.php b/core/modules/node/src/Plugin/views/field/RevisionLinkRevert.php
index 248b15ca9..33b20b888 100644
--- a/core/modules/node/src/Plugin/views/field/RevisionLinkRevert.php
+++ b/core/modules/node/src/Plugin/views/field/RevisionLinkRevert.php
@@ -29,4 +29,5 @@ class RevisionLinkRevert extends RevisionLink {
protected function getDefaultLabel() {
return $this->t('Revert');
}
+
}
diff --git a/core/modules/node/src/Plugin/views/row/Rss.php b/core/modules/node/src/Plugin/views/row/Rss.php
index c2a5f0a65..097655a20 100644
--- a/core/modules/node/src/Plugin/views/row/Rss.php
+++ b/core/modules/node/src/Plugin/views/row/Rss.php
@@ -22,12 +22,12 @@ use Drupal\views\Plugin\views\row\RssPluginBase;
class Rss extends RssPluginBase {
// Basic properties that let the row style follow relationships.
- var $base_table = 'node_field_data';
+ public $base_table = 'node_field_data';
- var $base_field = 'nid';
+ public $base_field = 'nid';
// Stores the nodes loaded with preRender.
- var $nodes = array();
+ public $nodes = array();
/**
* {@inheritdoc}
diff --git a/core/modules/node/src/Tests/AssertButtonsTrait.php b/core/modules/node/src/Tests/AssertButtonsTrait.php
index 89d3bcedf..58d484d9e 100644
--- a/core/modules/node/src/Tests/AssertButtonsTrait.php
+++ b/core/modules/node/src/Tests/AssertButtonsTrait.php
@@ -44,4 +44,5 @@ trait AssertButtonsTrait {
$this->assertNoRaw('dropbutton-wrapper');
}
}
+
}
diff --git a/core/modules/node/src/Tests/NodeAccessBaseTableTest.php b/core/modules/node/src/Tests/NodeAccessBaseTableTest.php
index e84fc0e99..74e2340ca 100644
--- a/core/modules/node/src/Tests/NodeAccessBaseTableTest.php
+++ b/core/modules/node/src/Tests/NodeAccessBaseTableTest.php
@@ -222,4 +222,5 @@ class NodeAccessBaseTableTest extends NodeTestBase {
}
}
}
+
}
diff --git a/core/modules/node/src/Tests/NodeAccessFieldTest.php b/core/modules/node/src/Tests/NodeAccessFieldTest.php
index e3a775414..dcfa43d9b 100644
--- a/core/modules/node/src/Tests/NodeAccessFieldTest.php
+++ b/core/modules/node/src/Tests/NodeAccessFieldTest.php
@@ -109,4 +109,5 @@ class NodeAccessFieldTest extends NodeTestBase {
$this->drupalGet('node/add/page');
$this->assertRaw($default, 'The updated default value is displayed when creating a new node.');
}
+
}
diff --git a/core/modules/node/src/Tests/NodeAccessPagerTest.php b/core/modules/node/src/Tests/NodeAccessPagerTest.php
index cfd351b51..7db264cd9 100644
--- a/core/modules/node/src/Tests/NodeAccessPagerTest.php
+++ b/core/modules/node/src/Tests/NodeAccessPagerTest.php
@@ -96,4 +96,5 @@ class NodeAccessPagerTest extends WebTestBase {
$this->assertRaw('page=1');
$this->assertNoRaw('page=2');
}
+
}
diff --git a/core/modules/node/src/Tests/NodeAccessRebuildTest.php b/core/modules/node/src/Tests/NodeAccessRebuildTest.php
index b6c3723f7..187f3a059 100644
--- a/core/modules/node/src/Tests/NodeAccessRebuildTest.php
+++ b/core/modules/node/src/Tests/NodeAccessRebuildTest.php
@@ -32,4 +32,5 @@ class NodeAccessRebuildTest extends NodeTestBase {
$this->drupalPostForm(NULL, array(), t('Rebuild permissions'));
$this->assertText(t('Content permissions have been rebuilt.'));
}
+
}
diff --git a/core/modules/node/src/Tests/NodeAccessRecordsTest.php b/core/modules/node/src/Tests/NodeAccessRecordsTest.php
index 9e05d84c7..412653905 100644
--- a/core/modules/node/src/Tests/NodeAccessRecordsTest.php
+++ b/core/modules/node/src/Tests/NodeAccessRecordsTest.php
@@ -80,4 +80,5 @@ class NodeAccessRecordsTest extends NodeTestBase {
$records = db_query('SELECT realm, gid FROM {node_access} WHERE nid = :nid', array(':nid' => $node6->id()))->fetchAll();
$this->assertEqual(count($records), 0, 'Returned no records for unpublished node.');
}
+
}
diff --git a/core/modules/node/src/Tests/NodeEditFormTest.php b/core/modules/node/src/Tests/NodeEditFormTest.php
index 659567dc8..b1ed31956 100644
--- a/core/modules/node/src/Tests/NodeEditFormTest.php
+++ b/core/modules/node/src/Tests/NodeEditFormTest.php
@@ -73,10 +73,8 @@ class NodeEditFormTest extends NodeTestBase {
$this->assertUrl($node->url('edit-form', ['absolute' => TRUE]));
// Check that the title and body fields are displayed with the correct values.
- // As you see the expected link text has no HTML, but we are using
- $link_text = 'Edit(active tab) ';
// @todo Ideally assertLink would support HTML, but it doesn't.
- $this->assertRaw($link_text, 'Edit tab found and marked active.');
+ $this->assertRaw('Edit(active tab) ', 'Edit tab found and marked active.');
$this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.');
$this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.');
diff --git a/core/modules/node/src/Tests/NodeEntityViewModeAlterTest.php b/core/modules/node/src/Tests/NodeEntityViewModeAlterTest.php
index 3ffd3a33b..25ae6b68b 100644
--- a/core/modules/node/src/Tests/NodeEntityViewModeAlterTest.php
+++ b/core/modules/node/src/Tests/NodeEntityViewModeAlterTest.php
@@ -46,4 +46,5 @@ class NodeEntityViewModeAlterTest extends NodeTestBase {
$build = $this->drupalBuildEntityView($node);
$this->assertEqual($build['#view_mode'], 'teaser', 'The view mode has correctly been set to teaser.');
}
+
}
diff --git a/core/modules/node/src/Tests/NodeFieldMultilingualTest.php b/core/modules/node/src/Tests/NodeFieldMultilingualTest.php
index e9a96a95c..9beae5df8 100644
--- a/core/modules/node/src/Tests/NodeFieldMultilingualTest.php
+++ b/core/modules/node/src/Tests/NodeFieldMultilingualTest.php
@@ -97,7 +97,7 @@ class NodeFieldMultilingualTest extends WebTestBase {
$this->assertRaw($body_value, 'Body correctly displayed using English as requested language');
}
- /*
+ /**
* Tests multilingual field display settings.
*/
function testMultilingualDisplaySettings() {
diff --git a/core/modules/node/src/Tests/NodeFormButtonsTest.php b/core/modules/node/src/Tests/NodeFormButtonsTest.php
index bf555d66f..9f6732bfc 100644
--- a/core/modules/node/src/Tests/NodeFormButtonsTest.php
+++ b/core/modules/node/src/Tests/NodeFormButtonsTest.php
@@ -131,4 +131,5 @@ class NodeFormButtonsTest extends NodeTestBase {
$node_3 = $node_storage->load(3);
$this->assertFalse($node_3->isPublished(), 'Node is unpublished');
}
+
}
diff --git a/core/modules/node/src/Tests/NodeFormSaveChangedTimeTest.php b/core/modules/node/src/Tests/NodeFormSaveChangedTimeTest.php
index 69f3963f2..aecf8a93e 100644
--- a/core/modules/node/src/Tests/NodeFormSaveChangedTimeTest.php
+++ b/core/modules/node/src/Tests/NodeFormSaveChangedTimeTest.php
@@ -68,4 +68,5 @@ class NodeFormSaveChangedTimeTest extends WebTestBase {
$node = entity_load('node', 1, TRUE);
$this->assertNotEqual($changed_timestamp, $node->getChangedTime(), "The entity's changed time was updated after form save without changes.");
}
+
}
diff --git a/core/modules/node/src/Tests/NodeHelpTest.php b/core/modules/node/src/Tests/NodeHelpTest.php
index 9ede4abcd..29460111c 100644
--- a/core/modules/node/src/Tests/NodeHelpTest.php
+++ b/core/modules/node/src/Tests/NodeHelpTest.php
@@ -73,4 +73,5 @@ class NodeHelpTest extends WebTestBase {
$this->assertResponse(200);
$this->assertText($this->testText);
}
+
}
diff --git a/core/modules/node/src/Tests/NodeLoadMultipleTest.php b/core/modules/node/src/Tests/NodeLoadMultipleTest.php
index d7c4360c3..31a30eea8 100644
--- a/core/modules/node/src/Tests/NodeLoadMultipleTest.php
+++ b/core/modules/node/src/Tests/NodeLoadMultipleTest.php
@@ -58,4 +58,5 @@ class NodeLoadMultipleTest extends NodeTestBase {
$this->assertTrue(is_object($node), 'Node is an object');
}
}
+
}
diff --git a/core/modules/node/src/Tests/NodePostSettingsTest.php b/core/modules/node/src/Tests/NodePostSettingsTest.php
index 3cfca2abb..bc3dd9943 100644
--- a/core/modules/node/src/Tests/NodePostSettingsTest.php
+++ b/core/modules/node/src/Tests/NodePostSettingsTest.php
@@ -54,4 +54,5 @@ class NodePostSettingsTest extends NodeTestBase {
$elements = $this->xpath('//div[contains(@class, :class)]', array(':class' => 'node__submitted'));
$this->assertEqual(count($elements), 0, 'Post information is not displayed.');
}
+
}
diff --git a/core/modules/node/src/Tests/NodeQueryAlterTest.php b/core/modules/node/src/Tests/NodeQueryAlterTest.php
index 2f1b11b8f..022625bdc 100644
--- a/core/modules/node/src/Tests/NodeQueryAlterTest.php
+++ b/core/modules/node/src/Tests/NodeQueryAlterTest.php
@@ -193,4 +193,5 @@ class NodeQueryAlterTest extends NodeTestBase {
}
\Drupal::state()->delete('node_access_test.no_access_uid');
}
+
}
diff --git a/core/modules/node/src/Tests/NodeRevisionPermissionsTest.php b/core/modules/node/src/Tests/NodeRevisionPermissionsTest.php
index 1f5c9b786..e000fb808 100644
--- a/core/modules/node/src/Tests/NodeRevisionPermissionsTest.php
+++ b/core/modules/node/src/Tests/NodeRevisionPermissionsTest.php
@@ -165,4 +165,5 @@ class NodeRevisionPermissionsTest extends NodeTestBase {
$this->assertFalse($node_revision_access->checkAccess($revision, $case['account'], $case['op']), "{$this->typeMap[$case['op']]} did not grant revision permission for articles.");
}
}
+
}
diff --git a/core/modules/node/src/Tests/NodeRevisionsAllTest.php b/core/modules/node/src/Tests/NodeRevisionsAllTest.php
index f7b81bcbe..582ca5bef 100644
--- a/core/modules/node/src/Tests/NodeRevisionsAllTest.php
+++ b/core/modules/node/src/Tests/NodeRevisionsAllTest.php
@@ -146,4 +146,5 @@ class NodeRevisionsAllTest extends NodeTestBase {
'%revision-date' => format_date($old_revision_date),
)));
}
+
}
diff --git a/core/modules/node/src/Tests/NodeRevisionsTest.php b/core/modules/node/src/Tests/NodeRevisionsTest.php
index a1047f59d..de8288e8d 100644
--- a/core/modules/node/src/Tests/NodeRevisionsTest.php
+++ b/core/modules/node/src/Tests/NodeRevisionsTest.php
@@ -42,6 +42,8 @@ class NodeRevisionsTest extends NodeTestBase {
protected function setUp() {
parent::setUp();
+ // Enable additional languages.
+ ConfigurableLanguage::createFromLangcode('de')->save();
ConfigurableLanguage::createFromLangcode('it')->save();
$field_storage_definition = array(
@@ -70,6 +72,7 @@ class NodeRevisionsTest extends NodeTestBase {
'edit any page content',
'delete any page content',
'translate any entity',
+ 'administer content types',
)
);
@@ -211,6 +214,60 @@ class NodeRevisionsTest extends NodeTestBase {
->fetchCol();
$default_revision_vid = $default_revision[0];
$this->assertTrue($new_node_revision->getRevisionId() > $default_revision_vid, 'Revision vid is greater than default revision vid.');
+
+ // Create an 'EN' node with a revision log message.
+ $node = $this->drupalCreateNode();
+ $node->title = 'Node title in EN';
+ $node->revision_log = 'Simple revision message (EN)';
+ $node->save();
+
+ $this->drupalGet("node/" . $node->id() . "/revisions");
+ $this->assertResponse(403);
+
+ // Create a new revision and new log message.
+ $node = Node::load($node->id());
+ $node->body->value = 'New text (EN)';
+ $node->revision_log = 'New revision message (EN)';
+ $node->setNewRevision();
+ $node->save();
+
+ // Check both revisions are shown on the node revisions overview page.
+ $this->drupalGet("node/" . $node->id() . "/revisions");
+ $this->assertText('Simple revision message (EN)');
+ $this->assertText('New revision message (EN)');
+
+ // Create an 'EN' node with a revision log message.
+ $node = $this->drupalCreateNode();
+ $node->langcode = 'en';
+ $node->title = 'Node title in EN';
+ $node->revision_log = 'Simple revision message (EN)';
+ $node->save();
+
+ $this->drupalGet("node/" . $node->id() . "/revisions");
+ $this->assertResponse(403);
+
+ // Add a translation in 'DE' and create a new revision and new log message.
+ $translation = $node->addTranslation('de');
+ $translation->title->value = 'Node title in DE';
+ $translation->body->value = 'New text (DE)';
+ $translation->revision_log = 'New revision message (DE)';
+ $translation->setNewRevision();
+ $translation->save();
+
+ // View the revision UI in 'IT', only the original node revision is shown.
+ $this->drupalGet("it/node/" . $node->id() . "/revisions");
+ $this->assertText('Simple revision message (EN)');
+ $this->assertNoText('New revision message (DE)');
+
+ // View the revision UI in 'DE', only the translated node revision is shown.
+ $this->drupalGet("de/node/" . $node->id() . "/revisions");
+ $this->assertNoText('Simple revision message (EN)');
+ $this->assertText('New revision message (DE)');
+
+ // View the revision UI in 'EN', only the original node revision is shown.
+ $this->drupalGet("node/" . $node->id() . "/revisions");
+ $this->assertText('Simple revision message (EN)');
+ $this->assertNoText('New revision message (DE)');
}
/**
diff --git a/core/modules/node/src/Tests/NodeSaveTest.php b/core/modules/node/src/Tests/NodeSaveTest.php
index 9c7d70fd5..f01724bbc 100644
--- a/core/modules/node/src/Tests/NodeSaveTest.php
+++ b/core/modules/node/src/Tests/NodeSaveTest.php
@@ -178,4 +178,5 @@ class NodeSaveTest extends NodeTestBase {
$node = $this->drupalCreateNode(array('title' => 'new'));
$this->assertEqual($node->getTitle(), 'Node ' . $node->id(), 'Node saved on node insert.');
}
+
}
diff --git a/core/modules/node/src/Tests/NodeTitleTest.php b/core/modules/node/src/Tests/NodeTitleTest.php
index 93a02d835..59ee02149 100644
--- a/core/modules/node/src/Tests/NodeTitleTest.php
+++ b/core/modules/node/src/Tests/NodeTitleTest.php
@@ -41,7 +41,7 @@ class NodeTitleTest extends NodeTestBase {
}
/**
- * Creates one node and tests if the node title has the correct value.
+ * Creates one node and tests if the node title has the correct value.
*/
function testNodeTitle() {
// Create "Basic page" content with title.
@@ -56,7 +56,7 @@ class NodeTitleTest extends NodeTestBase {
// Test tag.
$this->drupalGet('node/' . $node->id());
$xpath = '//title';
- $this->assertEqual(current($this->xpath($xpath)), $node->label() .' | Drupal', 'Page title is equal to node title.', 'Node');
+ $this->assertEqual(current($this->xpath($xpath)), $node->label() . ' | Drupal', 'Page title is equal to node title.', 'Node');
// Test breadcrumb in comment preview.
$this->drupalGet('comment/reply/node/' . $node->id() . '/comment');
@@ -99,4 +99,5 @@ class NodeTitleTest extends NodeTestBase {
$this->assertTitle($edge_case_title_escaped . ' | Drupal', 'Page title is equal to article\'s "title".', 'Node');
}
+
}
diff --git a/core/modules/node/src/Tests/NodeTitleXSSTest.php b/core/modules/node/src/Tests/NodeTitleXSSTest.php
index 2a3e94f1a..c41027514 100644
--- a/core/modules/node/src/Tests/NodeTitleXSSTest.php
+++ b/core/modules/node/src/Tests/NodeTitleXSSTest.php
@@ -38,4 +38,5 @@ class NodeTitleXSSTest extends NodeTestBase {
$this->drupalGet('node/' . $node->id() . '/edit');
$this->assertNoRaw($xss, 'Harmful tags are escaped when editing a node.');
}
+
}
diff --git a/core/modules/node/src/Tests/PageViewTest.php b/core/modules/node/src/Tests/PageViewTest.php
index 6cac96325..086b3e17c 100644
--- a/core/modules/node/src/Tests/PageViewTest.php
+++ b/core/modules/node/src/Tests/PageViewTest.php
@@ -38,4 +38,5 @@ class PageViewTest extends NodeTestBase {
$this->drupalGet("node/" . $node->id() . "/edit");
$this->assertResponse(200);
}
+
}
diff --git a/core/modules/node/src/Tests/Views/BulkFormAccessTest.php b/core/modules/node/src/Tests/Views/BulkFormAccessTest.php
index d24539973..050068b25 100644
--- a/core/modules/node/src/Tests/Views/BulkFormAccessTest.php
+++ b/core/modules/node/src/Tests/Views/BulkFormAccessTest.php
@@ -169,4 +169,5 @@ class BulkFormAccessTest extends NodeTestBase {
$own_node = Node::load($own_node->id());
$this->assertNull($own_node, 'The own node is deleted.');
}
+
}
diff --git a/core/modules/node/src/Tests/Views/NodeFieldFilterTest.php b/core/modules/node/src/Tests/Views/NodeFieldFilterTest.php
index 682280761..6b6d5e246 100644
--- a/core/modules/node/src/Tests/Views/NodeFieldFilterTest.php
+++ b/core/modules/node/src/Tests/Views/NodeFieldFilterTest.php
@@ -105,4 +105,5 @@ class NodeFieldFilterTest extends NodeTestBase {
$this->assertEqual(substr_count($text, $this->nodeTitles[$langcode]), 2 * $count, 'Translation ' . $langcode . ' has count ' . $count . ' with ' . $message);
}
}
+
}
diff --git a/core/modules/node/tests/modules/node_test/node_test.module b/core/modules/node/tests/modules/node_test/node_test.module
index ab1777ea1..00cff3b95 100644
--- a/core/modules/node/tests/modules/node_test/node_test.module
+++ b/core/modules/node/tests/modules/node_test/node_test.module
@@ -170,7 +170,7 @@ function node_test_entity_view_mode_alter(&$view_mode, EntityInterface $entity,
function node_test_node_insert(NodeInterface $node) {
// Set the node title to the node ID and save.
if ($node->getTitle() == 'new') {
- $node->setTitle('Node '. $node->id());
+ $node->setTitle('Node ' . $node->id());
$node->setNewRevision(FALSE);
$node->save();
}
diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php
index 24676ddf5..60fb6be81 100644
--- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php
+++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php
@@ -13,7 +13,7 @@ use Drupal\node\NodeInterface;
*/
class MigrateNodeTest extends MigrateDrupal7TestBase {
- static $modules = array(
+ public static $modules = array(
'comment',
'datetime',
'filter',
diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php
index 118b08a4e..8b98ec304 100644
--- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php
+++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php
@@ -35,6 +35,7 @@ class MigrateNodeTypeTest extends MigrateDrupal7TestBase {
* Tests a single node type.
*
* @dataProvider testNodeTypeDataProvider
+ *
* @param string $id
* The node type ID.
* @param string $label
diff --git a/core/modules/node/tests/src/Kernel/NodeConditionTest.php b/core/modules/node/tests/src/Kernel/NodeConditionTest.php
index 07986cc6a..7636d5298 100644
--- a/core/modules/node/tests/src/Kernel/NodeConditionTest.php
+++ b/core/modules/node/tests/src/Kernel/NodeConditionTest.php
@@ -79,4 +79,5 @@ class NodeConditionTest extends EntityKernelTestBase {
$condition = $manager->createInstance('node_type', array('bundles' => array('article' => 'article'), 'context' => array('node' => $article)));
$this->assertTrue($condition->execute(), 'Constructor injection of context and configuration working as anticipated.');
}
+
}
diff --git a/core/modules/node/tests/src/Kernel/NodeValidationTest.php b/core/modules/node/tests/src/Kernel/NodeValidationTest.php
index ae0bf0144..9fd646e61 100644
--- a/core/modules/node/tests/src/Kernel/NodeValidationTest.php
+++ b/core/modules/node/tests/src/Kernel/NodeValidationTest.php
@@ -68,4 +68,5 @@ class NodeValidationTest extends EntityKernelTestBase {
$this->assertEqual($violations[0]->getPropertyPath(), '');
$this->assertEqual($violations[0]->getMessage(), 'The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved.');
}
+
}
diff --git a/core/modules/node/tests/src/Kernel/Views/RevisionCreateTimestampTest.php b/core/modules/node/tests/src/Kernel/Views/RevisionCreateTimestampTest.php
index 8ceb7a7ea..287bf4839 100644
--- a/core/modules/node/tests/src/Kernel/Views/RevisionCreateTimestampTest.php
+++ b/core/modules/node/tests/src/Kernel/Views/RevisionCreateTimestampTest.php
@@ -71,5 +71,4 @@ class RevisionCreateTimestampTest extends ViewsKernelTestBase {
], ['vid' => 'vid', 'revision_timestamp' => 'revision_timestamp']);
}
-
}
diff --git a/core/modules/options/options.api.php b/core/modules/options/options.api.php
index f17f102ce..a4ac605d4 100644
--- a/core/modules/options/options.api.php
+++ b/core/modules/options/options.api.php
@@ -18,7 +18,6 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface;
* \Drupal\Core\TypedData\OptionsProviderInterface::getSettableOptions(). An
* empty option (_none) might have been added, depending on the field
* properties.
- *
* @param array $context
* An associative array containing:
* - field_definition: The field definition
diff --git a/core/modules/options/src/Tests/OptionsDynamicValuesTestBase.php b/core/modules/options/src/Tests/OptionsDynamicValuesTestBase.php
index 9015758bc..2d3f0fbed 100644
--- a/core/modules/options/src/Tests/OptionsDynamicValuesTestBase.php
+++ b/core/modules/options/src/Tests/OptionsDynamicValuesTestBase.php
@@ -75,4 +75,5 @@ abstract class OptionsDynamicValuesTestBase extends FieldTestBase {
'uri' => $this->entity->url(),
];
}
+
}
diff --git a/core/modules/options/src/Tests/OptionsSelectDynamicValuesTest.php b/core/modules/options/src/Tests/OptionsSelectDynamicValuesTest.php
index 4c571a8ee..df3365ca0 100644
--- a/core/modules/options/src/Tests/OptionsSelectDynamicValuesTest.php
+++ b/core/modules/options/src/Tests/OptionsSelectDynamicValuesTest.php
@@ -30,4 +30,5 @@ class OptionsSelectDynamicValuesTest extends OptionsDynamicValuesTestBase {
}
}
}
+
}
diff --git a/core/modules/options/tests/options_test/options_test.module b/core/modules/options/tests/options_test/options_test.module
index 59b8e1c26..d20401af6 100644
--- a/core/modules/options/tests/options_test/options_test.module
+++ b/core/modules/options/tests/options_test/options_test.module
@@ -11,7 +11,7 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface;
/**
* Implements callback_allowed_values_function().
*
- * @see options_allowed_values().
+ * @see options_allowed_values()
*/
function options_test_allowed_values_callback(FieldStorageDefinitionInterface $definition, FieldableEntityInterface $entity = NULL) {
$values = array(
@@ -38,7 +38,7 @@ function options_test_allowed_values_callback(FieldStorageDefinitionInterface $d
* NULL. Since this is not yet used for testing Views integration, that is
* alright for now. Fix this in https://www.drupal.org/node/2012130.
*
- * @see options_allowed_values().
+ * @see options_allowed_values()
*/
function options_test_dynamic_values_callback(FieldStorageDefinitionInterface $definition, FieldableEntityInterface $entity = NULL, &$cacheable = NULL) {
$values = array();
diff --git a/core/modules/options/tests/src/Kernel/OptionsFieldTest.php b/core/modules/options/tests/src/Kernel/OptionsFieldTest.php
index b3437f32b..89ac12716 100644
--- a/core/modules/options/tests/src/Kernel/OptionsFieldTest.php
+++ b/core/modules/options/tests/src/Kernel/OptionsFieldTest.php
@@ -96,4 +96,5 @@ class OptionsFieldTest extends OptionsFieldUnitTestBase {
$entity->{$this->fieldName}->generateSampleItems();
$this->entityValidateAndSave($entity);
}
+
}
diff --git a/core/modules/page_cache/page_cache.module b/core/modules/page_cache/page_cache.module
index 96abbcb18..3b8baf4ca 100644
--- a/core/modules/page_cache/page_cache.module
+++ b/core/modules/page_cache/page_cache.module
@@ -23,7 +23,7 @@ function page_cache_help($route_name, RouteMatchInterface $route_match) {
$output .= '' . t('Pages are usually identical for all anonymous users, while they can be personalized for each authenticated user. This is why entire pages can be cached for anonymous users, whereas they will have to be rebuilt for every authenticated user.') . ' ';
$output .= '' . t('To speed up your site for authenticated users, see the Dynamic Page Cache module .', [':dynamic_page_cache-help' => (\Drupal::moduleHandler()->moduleExists('dynamic_page_cache')) ? Url::fromRoute('help.page', ['name' => 'dynamic_page_cache'])->toString() : '#']) . '';
$output .= ' ' . t('Configuring the internal page cache') . ' ';
- $output .= '' . t('On the Performance page , you can configure how long browsers and proxies may cache pages; that setting is also respected by the Internal Page Cache module. There is no other configuration.', array(':cache-settings' => \Drupal::url('system.performance_settings'))) . ' ';
+ $output .= '' . t('On the Performance page , you can configure how long browsers and proxies may cache pages; that setting is also respected by the Internal Page Cache module. There is no other configuration.', array(':cache-settings' => \Drupal::url('system.performance_settings'))) . ' ';
$output .= '';
return $output;
diff --git a/core/modules/path/path.module b/core/modules/path/path.module
index 06efa7bfe..3d7f1d053 100644
--- a/core/modules/path/path.module
+++ b/core/modules/path/path.module
@@ -38,7 +38,7 @@ function path_help($route_name, RouteMatchInterface $route_match) {
}
/**
- * Implements hook_form_BASE_FORM_ID_alter() for node_form().
+ * Implements hook_form_BASE_FORM_ID_alter() for \Drupal\node\NodeForm.
*/
function path_form_node_form_alter(&$form, FormStateInterface $form_state) {
$node = $form_state->getFormObject()->getEntity();
diff --git a/core/modules/path/src/Plugin/Field/FieldType/PathItem.php b/core/modules/path/src/Plugin/Field/FieldType/PathItem.php
index 4a1a779d3..ef9a2d178 100644
--- a/core/modules/path/src/Plugin/Field/FieldType/PathItem.php
+++ b/core/modules/path/src/Plugin/Field/FieldType/PathItem.php
@@ -90,4 +90,11 @@ class PathItem extends FieldItemBase {
return $values;
}
+ /**
+ * {@inheritdoc}
+ */
+ public static function mainPropertyName() {
+ return 'alias';
+ }
+
}
diff --git a/core/modules/path/src/Tests/PathAliasTest.php b/core/modules/path/src/Tests/PathAliasTest.php
index e6b17385b..df4e18db6 100644
--- a/core/modules/path/src/Tests/PathAliasTest.php
+++ b/core/modules/path/src/Tests/PathAliasTest.php
@@ -59,7 +59,7 @@ class PathAliasTest extends PathTestBase {
// @todo Remove this once https://www.drupal.org/node/2480077 lands.
Cache::invalidateTags(['rendered']);
$this->drupalGet(trim($edit['alias'], '/'));
- $this->assertTrue(\Drupal::cache('data')->get('preload-paths:' . $edit['source']), 'Cache entry was created.');
+ $this->assertTrue(\Drupal::cache('data')->get('preload-paths:' . $edit['source']), 'Cache entry was created.');
}
/**
@@ -345,4 +345,5 @@ class PathAliasTest extends PathTestBase {
$this->assertText(t('The alias is already in use.'));
$this->assertFieldByXPath("//input[@name='path[0][alias]' and contains(@class, 'error')]", $edit['path[0][alias]'], 'Textfield exists and has the error class.');
}
+
}
diff --git a/core/modules/path/src/Tests/PathLanguageTest.php b/core/modules/path/src/Tests/PathLanguageTest.php
index 028d3593d..695f6be61 100644
--- a/core/modules/path/src/Tests/PathLanguageTest.php
+++ b/core/modules/path/src/Tests/PathLanguageTest.php
@@ -187,4 +187,5 @@ class PathLanguageTest extends PathTestBase {
$english_node->save();
$this->assertFalse($this->container->get('path.alias_storage')->aliasExists('/' . $french_alias, 'fr'), 'Alias for French translation is removed when translation is deleted.');
}
+
}
diff --git a/core/modules/path/src/Tests/PathLanguageUiTest.php b/core/modules/path/src/Tests/PathLanguageUiTest.php
index 9ff0ea2ee..540cc85db 100644
--- a/core/modules/path/src/Tests/PathLanguageUiTest.php
+++ b/core/modules/path/src/Tests/PathLanguageUiTest.php
@@ -77,4 +77,5 @@ class PathLanguageUiTest extends PathTestBase {
$this->drupalGet('fr/' . $name);
$this->assertText(t('Filter aliases'), 'Foreign URL alias works');
}
+
}
diff --git a/core/modules/path/src/Tests/PathTaxonomyTermTest.php b/core/modules/path/src/Tests/PathTaxonomyTermTest.php
index faeceabc7..f62fb6c4c 100644
--- a/core/modules/path/src/Tests/PathTaxonomyTermTest.php
+++ b/core/modules/path/src/Tests/PathTaxonomyTermTest.php
@@ -82,4 +82,5 @@ class PathTaxonomyTermTest extends PathTestBase {
$this->assertNoText($description, 'Old URL alias has been removed after altering.');
$this->assertResponse(404, 'Old URL alias returns 404.');
}
+
}
diff --git a/core/modules/path/src/Tests/PathTestBase.php b/core/modules/path/src/Tests/PathTestBase.php
index c16c4d149..c4a88af7d 100644
--- a/core/modules/path/src/Tests/PathTestBase.php
+++ b/core/modules/path/src/Tests/PathTestBase.php
@@ -25,4 +25,5 @@ abstract class PathTestBase extends WebTestBase {
$this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
}
}
+
}
diff --git a/core/modules/quickedit/src/Tests/QuickEditAutocompleteTermTest.php b/core/modules/quickedit/src/Tests/QuickEditAutocompleteTermTest.php
index a88490a7d..aa46a77bf 100644
--- a/core/modules/quickedit/src/Tests/QuickEditAutocompleteTermTest.php
+++ b/core/modules/quickedit/src/Tests/QuickEditAutocompleteTermTest.php
@@ -128,7 +128,7 @@ class QuickEditAutocompleteTermTest extends WebTestBase {
public function testAutocompleteQuickEdit() {
$this->drupalLogin($this->editorUser);
- $quickedit_uri = 'quickedit/form/node/'. $this->node->id() . '/' . $this->fieldName . '/' . $this->node->language()->getId() . '/full';
+ $quickedit_uri = 'quickedit/form/node/' . $this->node->id() . '/' . $this->fieldName . '/' . $this->node->language()->getId() . '/full';
$post = array('nocssjs' => 'true') + $this->getAjaxPageStatePostData();
$response = $this->drupalPost($quickedit_uri, 'application/vnd.drupal-ajax', $post);
$ajax_commands = Json::decode($response);
@@ -159,7 +159,7 @@ class QuickEditAutocompleteTermTest extends WebTestBase {
// Load the form again, which should now get it back from
// PrivateTempStore.
- $quickedit_uri = 'quickedit/form/node/'. $this->node->id() . '/' . $this->fieldName . '/' . $this->node->language()->getId() . '/full';
+ $quickedit_uri = 'quickedit/form/node/' . $this->node->id() . '/' . $this->fieldName . '/' . $this->node->language()->getId() . '/full';
$post = array('nocssjs' => 'true') + $this->getAjaxPageStatePostData();
$response = $this->drupalPost($quickedit_uri, 'application/vnd.drupal-ajax', $post);
$ajax_commands = Json::decode($response);
diff --git a/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php b/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php
index b9ebf1228..6baaed354 100644
--- a/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php
+++ b/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php
@@ -559,4 +559,5 @@ class QuickEditLoadingTest extends WebTestBase {
$ajax_commands = Json::decode($response);
$this->assertIdentical('