diff --git a/core/includes/install.inc b/core/includes/install.inc index 211eadb3d0616bd6cec6a38972d27cc587f79330..ce7df4759e9500462f613110c4b72e55cbc3a044 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -301,6 +301,7 @@ function drupal_rewrite_settings($settings = [], $settings_file = NULL) { $state = 'candidate_left'; } break; + case 'candidate_left': if ($value == '[') { $state = 'array_index'; @@ -309,6 +310,7 @@ function drupal_rewrite_settings($settings = [], $settings_file = NULL) { $state = 'candidate_right'; } break; + case 'array_index': if (_drupal_rewrite_settings_is_array_index($type, $value)) { $index = trim($value, '\'"'); @@ -319,6 +321,7 @@ function drupal_rewrite_settings($settings = [], $settings_file = NULL) { throw new Exception('invalid array index'); } break; + case 'right_bracket': if ($value == ']') { if (isset($current[$index])) { @@ -337,6 +340,7 @@ function drupal_rewrite_settings($settings = [], $settings_file = NULL) { throw new Exception('] expected'); } break; + case 'candidate_right': if (_drupal_rewrite_settings_is_simple($type, $value)) { $value = _drupal_rewrite_settings_dump_one($current); @@ -349,11 +353,13 @@ function drupal_rewrite_settings($settings = [], $settings_file = NULL) { $state = 'wait_for_semicolon'; } break; + case 'wait_for_semicolon': if ($value == ';') { $state = 'default'; } break; + case 'semicolon_skip': if ($value == ';') { $value = ''; @@ -672,31 +678,37 @@ function drupal_verify_install_file($file, $mask = NULL, $type = 'file', $autofi } } break; + case FILE_READABLE: if (!is_readable($file)) { $return = FALSE; } break; + case FILE_WRITABLE: if (!is_writable($file)) { $return = FALSE; } break; + case FILE_EXECUTABLE: if (!is_executable($file)) { $return = FALSE; } break; + case FILE_NOT_READABLE: if (is_readable($file)) { $return = FALSE; } break; + case FILE_NOT_WRITABLE: if (is_writable($file)) { $return = FALSE; } break; + case FILE_NOT_EXECUTABLE: if (is_executable($file)) { $return = FALSE; @@ -734,9 +746,11 @@ function drupal_install_mkdir($file, $mask, $message = TRUE) { case FILE_READABLE: $mod |= 0444; break; + case FILE_WRITABLE: $mod |= 0222; break; + case FILE_EXECUTABLE: $mod |= 0111; break; @@ -795,26 +809,31 @@ function drupal_install_fix_file($file, $mask, $message = TRUE) { $mod |= 0444; } break; + case FILE_WRITABLE: if (!is_writable($file)) { $mod |= 0222; } break; + case FILE_EXECUTABLE: if (!is_executable($file)) { $mod |= 0111; } break; + case FILE_NOT_READABLE: if (is_readable($file)) { $mod &= ~0444; } break; + case FILE_NOT_WRITABLE: if (is_writable($file)) { $mod &= ~0222; } break; + case FILE_NOT_EXECUTABLE: if (is_executable($file)) { $mod &= ~0111; diff --git a/core/lib/Drupal/Component/Datetime/DateTimePlus.php b/core/lib/Drupal/Component/Datetime/DateTimePlus.php index cadc4d93d52f8d3f4f47ca1a84291ad0007fc876..ef200d19f1646ebf1086948ccd46e227744aa2a1 100644 --- a/core/lib/Drupal/Component/Datetime/DateTimePlus.php +++ b/core/lib/Drupal/Component/Datetime/DateTimePlus.php @@ -641,6 +641,7 @@ public static function checkArray($array) { $valid_time = FALSE; } break; + case 'minute': case 'second': default: diff --git a/core/lib/Drupal/Component/Gettext/PoHeader.php b/core/lib/Drupal/Component/Gettext/PoHeader.php index 5d38de57f8f3a1924d70f4145bcce7cb809a0385..1d841cc1242370def91fc5f401dcd78429547ac3 100644 --- a/core/lib/Drupal/Component/Gettext/PoHeader.php +++ b/core/lib/Drupal/Component/Gettext/PoHeader.php @@ -400,6 +400,7 @@ private function tokenizeFormula($formula) { $tokens[] = $formula[$i]; } break; + case 5: if ($next == '&') { $tokens[] = '&&'; @@ -409,6 +410,7 @@ private function tokenizeFormula($formula) { $tokens[] = $formula[$i]; } break; + case 6: if ($next == '|') { $tokens[] = '||'; @@ -502,42 +504,55 @@ protected function evaluatePlural($element_stack, $n) { case '==': $f = $element_stack[$i - 2] == $element_stack[$i - 1]; break; + case '!=': $f = $element_stack[$i - 2] != $element_stack[$i - 1]; break; + case '<=': $f = $element_stack[$i - 2] <= $element_stack[$i - 1]; break; + case '>=': $f = $element_stack[$i - 2] >= $element_stack[$i - 1]; break; + case '<': $f = $element_stack[$i - 2] < $element_stack[$i - 1]; break; + case '>': $f = $element_stack[$i - 2] > $element_stack[$i - 1]; break; + case '+': $f = $element_stack[$i - 2] + $element_stack[$i - 1]; break; + case '-': $f = $element_stack[$i - 2] - $element_stack[$i - 1]; break; + case '*': $f = $element_stack[$i - 2] * $element_stack[$i - 1]; break; + case '/': $f = $element_stack[$i - 2] / $element_stack[$i - 1]; break; + case '%': $f = $element_stack[$i - 2] % $element_stack[$i - 1]; break; + case '&&': $f = $element_stack[$i - 2] && $element_stack[$i - 1]; break; + case '||': $f = $element_stack[$i - 2] || $element_stack[$i - 1]; break; + case ':': $f = $element_stack[$i - 3] ? $element_stack[$i - 2] : $element_stack[$i - 1]; // This operator has 3 preceding elements, instead of the default 2. diff --git a/core/lib/Drupal/Component/Utility/Unicode.php b/core/lib/Drupal/Component/Utility/Unicode.php index 7258c621015cf1e25821c9c617e6e0de0cde81e0..3729c7d9ee948e8240081493346ab33db5d4a40c 100644 --- a/core/lib/Drupal/Component/Utility/Unicode.php +++ b/core/lib/Drupal/Component/Utility/Unicode.php @@ -103,6 +103,7 @@ public static function getStatus() { switch (static::check()) { case 'mb_strlen': return Unicode::STATUS_SINGLEBYTE; + case '': return Unicode::STATUS_MULTIBYTE; } diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php index e123e397bae8c5ca46bc37c39c8dbf60bbaf16d0..235a7c1a4126ee728f371dc3a07b5760f63f1b7a 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -621,6 +621,7 @@ protected function getMissingDependencies($config_name, array $data, array $enab case 'theme': $list_to_check = $enabled_extensions; break; + case 'config': $list_to_check = $all_config; break; diff --git a/core/lib/Drupal/Core/Config/Entity/Query/Condition.php b/core/lib/Drupal/Core/Config/Entity/Query/Condition.php index 3410a6ef53ce157f53b458caab4acdb84619b5d8..2adfd80d5fd2cd429b0e545aae958444883f3bed 100644 --- a/core/lib/Drupal/Core/Config/Entity/Query/Condition.php +++ b/core/lib/Drupal/Core/Config/Entity/Query/Condition.php @@ -169,26 +169,37 @@ protected function match(array $condition, $value) { switch ($condition['operator']) { case '=': return $value == $condition['value']; + case '>': return $value > $condition['value']; + case '<': return $value < $condition['value']; + case '>=': return $value >= $condition['value']; + case '<=': return $value <= $condition['value']; + case '<>': return $value != $condition['value']; + case 'IN': return array_search($value, $condition['value']) !== FALSE; + case 'NOT IN': return array_search($value, $condition['value']) === FALSE; + case 'STARTS_WITH': return strpos($value, $condition['value']) === 0; + case 'CONTAINS': return strpos($value, $condition['value']) !== FALSE; + case 'ENDS_WITH': return substr($value, -strlen($condition['value'])) === (string) $condition['value']; + default: throw new QueryException('Invalid condition operator.'); } diff --git a/core/lib/Drupal/Core/Config/Entity/Query/Query.php b/core/lib/Drupal/Core/Config/Entity/Query/Query.php index 4566cb11d58f525043142a827aa34c7e7523d889..5c14c9ac1a675785d59898e41d670fb0e96e60f5 100644 --- a/core/lib/Drupal/Core/Config/Entity/Query/Query.php +++ b/core/lib/Drupal/Core/Config/Entity/Query/Query.php @@ -183,18 +183,21 @@ protected function loadRecords() { return $id !== $value; }; break; + case 'STARTS_WITH': $filter = function ($name) use ($value, $prefix_length) { $id = substr($name, $prefix_length); return strpos($id, $value) === 0; }; break; + case 'CONTAINS': $filter = function ($name) use ($value, $prefix_length) { $id = substr($name, $prefix_length); return strpos($id, $value) !== FALSE; }; break; + case 'ENDS_WITH': $filter = function ($name) use ($value, $prefix_length) { $id = substr($name, $prefix_length); diff --git a/core/lib/Drupal/Core/Database/Connection.php b/core/lib/Drupal/Core/Database/Connection.php index ee757249b2fbfbaa017fa9bd452065e5020a7e4b..3ca7de7b3aabe743f1bc684ac1337734c22db601 100644 --- a/core/lib/Drupal/Core/Database/Connection.php +++ b/core/lib/Drupal/Core/Database/Connection.php @@ -744,14 +744,18 @@ public function query($query, array $args = [], $options = []) { switch ($options['return']) { case Database::RETURN_STATEMENT: return $stmt; + case Database::RETURN_AFFECTED: $stmt->allowRowCount = TRUE; return $stmt->rowCount(); + case Database::RETURN_INSERT_ID: $sequence_name = isset($options['sequence_name']) ? $options['sequence_name'] : NULL; return $this->connection->lastInsertId($sequence_name); + case Database::RETURN_NULL: return NULL; + default: throw new \PDOException('Invalid return directive: ' . $options['return']); } @@ -891,33 +895,43 @@ public function getDriverClass($class) { case 'Condition': $this->driverClasses[$class] = Condition::class; break; + case 'Delete': $this->driverClasses[$class] = Delete::class; break; + case 'Insert': $this->driverClasses[$class] = Insert::class; break; + case 'Merge': $this->driverClasses[$class] = Merge::class; break; + case 'Schema': $this->driverClasses[$class] = Schema::class; break; + case 'Select': $this->driverClasses[$class] = Select::class; break; + case 'Transaction': $this->driverClasses[$class] = Transaction::class; break; + case 'Truncate': $this->driverClasses[$class] = Truncate::class; break; + case 'Update': $this->driverClasses[$class] = Update::class; break; + case 'Upsert': $this->driverClasses[$class] = Upsert::class; break; + default: $this->driverClasses[$class] = $class; } diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php index 71165a6838f8d5e704eb9428b32e68a7ccd5b21b..6cf476414d0293ccc18079d229aec80c1642a9ef 100644 --- a/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php +++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php @@ -395,7 +395,8 @@ protected function processField($field) { case 'smallint': $field['pgsql_type'] = $map['int:medium']; break; - case 'int' : + + case 'int': $field['pgsql_type'] = $map['int:big']; break; } diff --git a/core/lib/Drupal/Core/Database/Statement.php b/core/lib/Drupal/Core/Database/Statement.php index 8060fbcde596e92466de1a26cada061fb65086f3..c6a120d61166b09f271335f6f86d7346955e4baa 100644 --- a/core/lib/Drupal/Core/Database/Statement.php +++ b/core/lib/Drupal/Core/Database/Statement.php @@ -153,8 +153,10 @@ public function setFetchMode($mode, $a1 = NULL, $a2 = []) { switch (func_num_args()) { case 1: return parent::setFetchMode($mode); + case 2: return parent::setFetchMode($mode, $a1); + case 3: default: return parent::setFetchMode($mode, $a1, $a2); @@ -171,10 +173,13 @@ public function fetchAll($mode = NULL, $column_index = NULL, $constructor_argume switch (func_num_args()) { case 0: return parent::fetchAll(); + case 1: return parent::fetchAll($mode); + case 2: return parent::fetchAll($mode, $column_index); + case 3: default: return parent::fetchAll($mode, $column_index, $constructor_arguments); diff --git a/core/lib/Drupal/Core/Database/StatementPrefetch.php b/core/lib/Drupal/Core/Database/StatementPrefetch.php index 5bdee33e72265ed495b78e9d8e7e85d4495bad28..da0fea5b68c49d4090457f30f5a89f4be3875fcb 100644 --- a/core/lib/Drupal/Core/Database/StatementPrefetch.php +++ b/core/lib/Drupal/Core/Database/StatementPrefetch.php @@ -243,9 +243,11 @@ public function setFetchMode($mode, $a1 = NULL, $a2 = []) { $this->defaultFetchOptions['constructor_args'] = $a2; } break; + case \PDO::FETCH_COLUMN: $this->defaultFetchOptions['column'] = $a1; break; + case \PDO::FETCH_INTO: $this->defaultFetchOptions['object'] = $a1; break; @@ -271,17 +273,21 @@ public function current() { switch ($this->fetchStyle) { case \PDO::FETCH_ASSOC: return $this->currentRow; + case \PDO::FETCH_BOTH: // \PDO::FETCH_BOTH returns an array indexed by both the column name // and the column number. return $this->currentRow + array_values($this->currentRow); + case \PDO::FETCH_NUM: return array_values($this->currentRow); + case \PDO::FETCH_LAZY: // We do not do lazy as everything is fetched already. Fallback to // \PDO::FETCH_OBJ. case \PDO::FETCH_OBJ: return (object) $this->currentRow; + case \PDO::FETCH_CLASS | \PDO::FETCH_CLASSTYPE: $class_name = array_shift($this->currentRow); // Deliberate no break. @@ -300,11 +306,13 @@ public function current() { $result->$k = $v; } return $result; + case \PDO::FETCH_INTO: foreach ($this->currentRow as $k => $v) { $this->fetchOptions['object']->$k = $v; } return $this->fetchOptions['object']; + case \PDO::FETCH_COLUMN: if (isset($this->columnNames[$this->fetchOptions['column']])) { return $this->currentRow[$this->columnNames[$this->fetchOptions['column']]]; diff --git a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/PhpSelection.php b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/PhpSelection.php index 52cf33d29d7dac7dbb2e449e2d5193214e7b8497..0309f76bbfd82f592c710091dc8ae26dec3bd386 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/PhpSelection.php +++ b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/PhpSelection.php @@ -93,30 +93,43 @@ protected function matchLabel($match, $match_operator, $label) { switch ($match_operator) { case '=': return $label == $match; + case '>': return $label > $match; + case '<': return $label < $match; + case '>=': return $label >= $match; + case '<=': return $label <= $match; + case '<>': return $label != $match; + case 'IN': return array_search($label, $match) !== FALSE; + case 'NOT IN': return array_search($label, $match) === FALSE; + case 'STARTS_WITH': return strpos($label, $match) === 0; + case 'CONTAINS': return strpos($label, $match) !== FALSE; + case 'ENDS_WITH': return mb_substr($label, -mb_strlen($match)) === (string) $match; + case 'IS NOT NULL': return TRUE; + case 'IS NULL': return FALSE; + default: // Invalid match operator. return FALSE; diff --git a/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php b/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php index 02bcb34003cbdf4b31219201920c246d9f9c6d92..258d1f4507c977f347e38542e627fd45a86fad31 100644 --- a/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php @@ -120,6 +120,7 @@ public static function translateCondition(&$condition, SelectInterface $sql_quer $condition['operator'] = 'LIKE'; } break; + case '<>': // If a field explicitly requests that queries should not be case // sensitive, use the NOT LIKE operator, otherwise keep <>. @@ -128,6 +129,7 @@ public static function translateCondition(&$condition, SelectInterface $sql_quer $condition['operator'] = 'NOT LIKE'; } break; + case 'STARTS_WITH': if ($case_sensitive) { $condition['operator'] = 'LIKE BINARY'; diff --git a/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php index f521bb1655862f5b75c93db684f69277c72e7ec1..dd0b355c79f1e309b94c8cd84147c430dd775153 100644 --- a/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php @@ -276,6 +276,7 @@ protected function validateDependencies(ConfigImporter $config_importer) { ['%name' => $name, '%module' => implode(', ', $this->getNames($diffs, $module_data))] ); break; + case 'theme': $message = $this->formatPlural( count($diffs), @@ -284,6 +285,7 @@ protected function validateDependencies(ConfigImporter $config_importer) { ['%name' => $name, '%theme' => implode(', ', $this->getNames($diffs, $theme_data))] ); break; + case 'config': $message = $this->formatPlural( count($diffs), diff --git a/core/lib/Drupal/Core/Password/PhpassHashedPassword.php b/core/lib/Drupal/Core/Password/PhpassHashedPassword.php index 45ea3eadb48e1f96328dc7e3e3b61da5a509b0cf..8a53607121f9cf34a06f81af6db87388dac058a2 100644 --- a/core/lib/Drupal/Core/Password/PhpassHashedPassword.php +++ b/core/lib/Drupal/Core/Password/PhpassHashedPassword.php @@ -237,6 +237,7 @@ public function check($password, $hash) { // A normal Drupal 7 password using sha512. $computed_hash = $this->crypt('sha512', $password, $stored_hash); break; + case '$H$': // phpBB3 uses "$H$" for the same thing as "$P$". case '$P$': @@ -244,6 +245,7 @@ public function check($password, $hash) { // imported password or from an earlier Drupal version. $computed_hash = $this->crypt('md5', $password, $stored_hash); break; + default: return FALSE; } diff --git a/core/modules/aggregator/tests/src/Functional/Rest/FeedResourceTestBase.php b/core/modules/aggregator/tests/src/Functional/Rest/FeedResourceTestBase.php index e17c0573f07205a5a3bc1f69c8f148864582b9dc..b271fc83195da85e67e2a4420fad17381e15b087 100644 --- a/core/modules/aggregator/tests/src/Functional/Rest/FeedResourceTestBase.php +++ b/core/modules/aggregator/tests/src/Functional/Rest/FeedResourceTestBase.php @@ -35,6 +35,7 @@ protected function setUpAuthorization($method) { case 'GET': $this->grantPermissionsToTestedRole(['access news feeds']); break; + case 'POST': case 'PATCH': case 'DELETE': @@ -182,10 +183,12 @@ protected function getExpectedUnauthorizedAccessMessage($method) { switch ($method) { case 'GET': return "The 'access news feeds' permission is required."; + case 'POST': case 'PATCH': case 'DELETE': return "The 'administer news feeds' permission is required."; + default: return parent::getExpectedUnauthorizedAccessMessage($method); } diff --git a/core/modules/block/src/Plugin/migrate/process/BlockSettings.php b/core/modules/block/src/Plugin/migrate/process/BlockSettings.php index 68e8f186ba2474846db7bea5a7d4554488e67a3b..5e146d783787fb40d02a3e53cfed2666e588ae31 100644 --- a/core/modules/block/src/Plugin/migrate/process/BlockSettings.php +++ b/core/modules/block/src/Plugin/migrate/process/BlockSettings.php @@ -35,21 +35,26 @@ public function transform($value, MigrateExecutableInterface $migrate_executable $settings['block_count'] = $old_settings['aggregator']['item_count']; $settings['feed'] = $id; break; + case 'book_navigation': $settings['block_mode'] = $old_settings['book']['block_mode']; break; + case 'forum_active_block': case 'forum_new_block': $settings['block_count'] = $old_settings['forum']['block_num']; break; + case 'statistics_popular_block': $settings['top_day_num'] = $old_settings['statistics']['statistics_block_top_day_num']; $settings['top_all_num'] = $old_settings['statistics']['statistics_block_top_all_num']; $settings['top_last_num'] = $old_settings['statistics']['statistics_block_top_last_num']; break; + case 'views_block:who_s_new-block_1': $settings['items_per_page'] = $old_settings['user']['block_whois_new_count']; break; + case 'views_block:who_s_online-who_s_online_block': $settings['items_per_page'] = $old_settings['user']['max_list_count']; break; diff --git a/core/modules/block/src/Plugin/migrate/source/Block.php b/core/modules/block/src/Plugin/migrate/source/Block.php index 2ef0beff0c6d999fa35cce1bc27cb47b0f02d1cb..da06acee3a2d4b965718ce0196b450e5f8720082 100644 --- a/core/modules/block/src/Plugin/migrate/source/Block.php +++ b/core/modules/block/src/Plugin/migrate/source/Block.php @@ -145,23 +145,28 @@ public function prepareRow(Row $row) { } $settings['aggregator']['item_count'] = $item_count; break; + case 'book': $settings['book']['block_mode'] = $this->variableGet('book_block_mode', 'all pages'); break; + case 'forum': $settings['forum']['block_num'] = $this->variableGet('forum_block_num_' . $delta, 5); break; + case 'statistics': foreach (['statistics_block_top_day_num', 'statistics_block_top_all_num', 'statistics_block_top_last_num'] as $name) { $settings['statistics'][$name] = $this->variableGet($name, 0); } break; + case 'user': switch ($delta) { case 2: case 'new': $settings['user']['block_whois_new_count'] = $this->variableGet('user_block_whois_new_count', 5); break; + case 3: case 'online': $settings['user']['block_seconds_online'] = $this->variableGet('user_block_seconds_online', 900); diff --git a/core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php b/core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php index 916e2d950b9e58472f266ae9a7f76620499effb8..503322c1f6fa8b53cb45dbdd1396e91ade5e0be9 100644 --- a/core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php +++ b/core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php @@ -31,9 +31,11 @@ protected function setUpAuthorization($method) { case 'GET': $this->entity->setVisibilityConfig('user_role', [])->save(); break; + case 'POST': $this->grantPermissionsToTestedRole(['administer blocks']); break; + case 'PATCH': $this->grantPermissionsToTestedRole(['administer blocks']); break; @@ -133,6 +135,7 @@ protected function getExpectedUnauthorizedAccessMessage($method) { switch ($method) { case 'GET': return "The block visibility condition 'user_role' denied access."; + default: return parent::getExpectedUnauthorizedAccessMessage($method); } diff --git a/core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php b/core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php index c6a96eff0019d6a2679294a68c34dc40ebb55b1a..2bf2b9b9e54ddd654e7dbb431b977d479b63c16e 100644 --- a/core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php +++ b/core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php @@ -55,9 +55,11 @@ protected function setUpAuthorization($method) { case 'GET': $this->grantPermissionsToTestedRole(['access comments', 'view test entity']); break; + case 'POST': $this->grantPermissionsToTestedRole(['post comments']); break; + case 'PATCH': // Anonymous users are not ever allowed to edit their own comments. To // be able to test PATCHing comments as the anonymous user, the more @@ -70,6 +72,7 @@ protected function setUpAuthorization($method) { $this->grantPermissionsToTestedRole(['administer comments']); } break; + case 'DELETE': $this->grantPermissionsToTestedRole(['administer comments']); break; @@ -316,10 +319,13 @@ protected function getExpectedUnauthorizedAccessMessage($method) { switch ($method) { case 'GET'; return "The 'access comments' permission is required and the comment must be published."; + case 'POST'; return "The 'post comments' permission is required."; + case 'PATCH'; return "The 'edit own comments' permission is required, the user must be the comment author, and the comment must be published."; + case 'DELETE': // \Drupal\comment\CommentAccessControlHandler::checkAccess() does not // specify a reason for not allowing a comment to be deleted. diff --git a/core/modules/config/tests/config_test/tests/src/Functional/Rest/ConfigTestResourceTestBase.php b/core/modules/config/tests/config_test/tests/src/Functional/Rest/ConfigTestResourceTestBase.php index d1ae8f5d86aab2a5d4b7985ec33b3c1b1152fe3b..b3e425eda9b181f72cd8f620c355b9733e2ca905 100644 --- a/core/modules/config/tests/config_test/tests/src/Functional/Rest/ConfigTestResourceTestBase.php +++ b/core/modules/config/tests/config_test/tests/src/Functional/Rest/ConfigTestResourceTestBase.php @@ -81,6 +81,7 @@ protected function getExpectedUnauthorizedAccessMessage($method) { switch ($method) { case 'GET': return "The 'view config_test' permission is required."; + default: return parent::getExpectedUnauthorizedAccessMessage($method); } diff --git a/core/modules/config_translation/src/ConfigEntityMapper.php b/core/modules/config_translation/src/ConfigEntityMapper.php index 133ddcc1f124944d680c627ec80700ec851b0e66..9471a6294919eab044f7852825b5dd2115552db7 100644 --- a/core/modules/config_translation/src/ConfigEntityMapper.php +++ b/core/modules/config_translation/src/ConfigEntityMapper.php @@ -244,8 +244,10 @@ public function getContextualLinkGroup() { case 'menu': case 'block': return $this->entityType; + case 'view': return 'entity.view.edit_form'; + default: return NULL; } diff --git a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php index 902857a0010e6c01bb8de7a5688cfefb3fcf7b57..730599008bcc8703a1807383d62cf262fd69acbb 100644 --- a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php +++ b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php @@ -172,10 +172,12 @@ public function manageFieldsPage($type = '') { $this->assertIdentical($url, $link->getAttribute('href')); $number_of_links_found++; break; + case 'Edit storage settings.': $this->assertIdentical("$url/storage", $link->getAttribute('href')); $number_of_links_found++; break; + case 'Delete field.': $this->assertIdentical("$url/delete", $link->getAttribute('href')); $number_of_links_found++; diff --git a/core/modules/filter/src/Plugin/migrate/process/FilterID.php b/core/modules/filter/src/Plugin/migrate/process/FilterID.php index 9a95bfe967e017610b92c7fcbb0569d0e9d6d051..8358cd626004c7b1b1f42686ab84ce477783bc3b 100644 --- a/core/modules/filter/src/Plugin/migrate/process/FilterID.php +++ b/core/modules/filter/src/Plugin/migrate/process/FilterID.php @@ -114,14 +114,19 @@ protected static function getSourceFilterType($filter_id) { // - https://git.drupalcode.org/project/drupal/blob/7.69/modules/php/php.module#L139 case 'filter_html': return FilterInterface::TYPE_HTML_RESTRICTOR; + case 'filter_url': return FilterInterface::TYPE_MARKUP_LANGUAGE; + case 'filter_autop': return FilterInterface::TYPE_MARKUP_LANGUAGE; + case 'filter_htmlcorrector': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + case 'filter_html_escape': return FilterInterface::TYPE_HTML_RESTRICTOR; + case 'php_code': return FilterInterface::TYPE_MARKUP_LANGUAGE; @@ -129,307 +134,406 @@ protected static function getSourceFilterType($filter_id) { // https://www.drupal.org/project/abbrfilter case 'abbrfilter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/ace_editor case 'ace_editor': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/adsense case 'adsense': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/api case 'api_filter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/api_tokens case 'api_tokens': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/autofloat case 'filter_autofloat': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/bbcode case 'bbcode': return FilterInterface::TYPE_MARKUP_LANGUAGE; + // https://www.drupal.org/project/biblio case 'biblio_filter_reference': case 'biblio_filter_inline_reference': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/caption case 'caption': return FilterInterface::TYPE_TRANSFORM_REVERSIBLE; + // https://www.drupal.org/project/caption_filter case 'caption_filter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/cincopa case 'filter_cincopa': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/ckeditor_blocks case 'ckeditor_blocks': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/ckeditor_filter case 'ckeditor_filter': return FilterInterface::TYPE_HTML_RESTRICTOR; + // https://www.drupal.org/project/ckeditor_link case 'ckeditor_link_filter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/ckeditor_swf case 'ckeditor_swf_filter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/codefilter case 'codefilter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/collapse_text case 'collapse_text_filter': return FilterInterface::TYPE_TRANSFORM_REVERSIBLE; + // https://www.drupal.org/project/columns_filter case 'columns_filter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/commonmark case 'commonmark': return FilterInterface::TYPE_MARKUP_LANGUAGE; + // https://www.drupal.org/project/commons_hashtags case 'filter_hashtags': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/deepzoom case 'deepzoom': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/editor case 'editor_align': case 'editor_caption': return FilterInterface::TYPE_TRANSFORM_REVERSIBLE; + // https://www.drupal.org/project/elf case 'elf': return FilterInterface::TYPE_TRANSFORM_REVERSIBLE; + // https://www.drupal.org/project/emogrifier case 'filter_emogrifier': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/emptyparagraphkiller case 'emptyparagraphkiller': return FilterInterface::TYPE_HTML_RESTRICTOR; + // https://www.drupal.org/project/entity_embed case 'emtity_embed': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + case 'filter_align': return FilterInterface::TYPE_TRANSFORM_REVERSIBLE; + // https://www.drupal.org/project/ext_link_page case 'ext_link_page': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/filter_html_image_secure case 'filter_html_image_secure': return FilterInterface::TYPE_HTML_RESTRICTOR; + // https://www.drupal.org/project/filter_transliteration case 'filter_transliteration': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/flickr case 'flickr_filter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/float_filter case 'float_filter': return FilterInterface::TYPE_TRANSFORM_REVERSIBLE; + // https://www.drupal.org/project/footnotes case 'filter_footnotes': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/forena case 'forena_report': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/g2 case 'filter_g2': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/geo_filter case 'geo_filter_filter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/google_analytics_counter case 'filter_google_analytics_counter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/google_analytics_referrer case 'filter_google_analytics_referrer': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/gotwo case 'gotwo_link': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/h5p case 'h5p_content': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/highlightjs case 'highlight_js': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/htmLawed case 'htmLawed': return FilterInterface::TYPE_HTML_RESTRICTOR; + // https://www.drupal.org/project/htmlpurifier case 'htmlpurifier_basic': case 'htmlpurifier_advanced': return FilterInterface::TYPE_HTML_RESTRICTOR; + // https://www.drupal.org/project/htmltidy case 'htmltidy': return FilterInterface::TYPE_HTML_RESTRICTOR; + // https://www.drupal.org/project/icon case 'icon_filter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/iframe_filter case 'iframe': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/image_resize_filter case 'image_resize_filter': return FilterInterface::TYPE_TRANSFORM_REVERSIBLE; + // https://www.drupal.org/project/insert_view case 'insert_view': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/intlinks case 'intlinks title': case 'intlinks hide bad': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/jquery_ui_filter case 'accordion': case 'dialog': case 'tabs': return FilterInterface::TYPE_MARKUP_LANGUAGE; + // https://www.drupal.org/project/language_sections case 'language_sections': return FilterInterface::TYPE_MARKUP_LANGUAGE; + // https://www.drupal.org/project/lazy case 'lazy_filter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/lazyloader_filter case 'lazyloader_filter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/link_node case 'filter_link_node': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/linktitle case 'linktitle': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/markdown case 'filter_markdown': return FilterInterface::TYPE_MARKUP_LANGUAGE; + // https://www.drupal.org/project/media_wysiwyg case 'media_filter': case 'media_filter_paragraph_fix': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/mentions case 'filter_mentions': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/menu_filter case 'menu_filter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/mobile_codes case 'mobile_codes': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/multicolumn case 'multicolumn': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/multilink case 'multilink_filter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/mytube case 'mytube': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/node_embed case 'node_embed': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/node_field_embed case 'node_field_embed': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/noindex_external_links case 'external_links': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/noreferrer case 'noreferrer': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/oembed case 'oembed': case 'oembed_legacy': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/office_html case 'office_html_strip': return FilterInterface::TYPE_HTML_RESTRICTOR; + case 'office_html_convert': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/openlayers_filters case 'openlayers': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/opengraph_filter case 'opengraph_filter': return FilterInterface::TYPE_TRANSFORM_REVERSIBLE; + // https://www.drupal.org/project/pathologic case 'pathologic': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/popup case 'popup_tags': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/prettify case 'prettify': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/rel_to_abs case 'rel_to_abs': return FilterInterface::TYPE_TRANSFORM_REVERSIBLE; + // https://www.drupal.org/project/rollover_filter case 'rollover_filter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/sanitizable case 'sanitizable': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/smart_paging case 'smart_paging_filter': case 'smart_paging_filter_autop': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/spamspan case 'spamspan': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/scald case 'mee_scald_widgets': return FilterInterface::TYPE_TRANSFORM_REVERSIBLE; + // https://www.drupal.org/project/script_filter case 'script_filter': return FilterInterface::TYPE_TRANSFORM_REVERSIBLE; + // https://www.drupal.org/project/shortcode case 'shortcode': return FilterInterface::TYPE_MARKUP_LANGUAGE; + case 'shortcode_text_corrector': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/smiley case 'smiley': return FilterInterface::TYPE_TRANSFORM_REVERSIBLE; + // https://www.drupal.org/project/svg_embed case 'filter_svg_embed': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/spoiler case 'spoiler': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/tableofcontents case 'filter_toc': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/tables case 'filter_tables': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/target_filter_url case 'target_filter_url': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/textile case 'textile': return FilterInterface::TYPE_MARKUP_LANGUAGE; + // https://www.drupal.org/project/theme_filter case 'theme_filter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/token_filter case 'filter_tokens': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/transliteration case 'transliteration': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/typogrify case 'typogrify': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/uuid_link case 'uuid_link_filter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/wysiwyg case 'wysiwyg': case 'wysiwyg_template_cleanup': return FilterInterface::TYPE_HTML_RESTRICTOR; + // https://www.drupal.org/project/word_link case 'word_link': return FilterInterface::TYPE_TRANSFORM_REVERSIBLE; + // https://www.drupal.org/project/wordfilter case 'wordfilter': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; + // https://www.drupal.org/project/xbbcode case 'xbbcode': return FilterInterface::TYPE_MARKUP_LANGUAGE; diff --git a/core/modules/help/tests/modules/help_page_test/help_page_test.module b/core/modules/help/tests/modules/help_page_test/help_page_test.module index f57728d53ff90bbc5af3a0d43ba84ee419fd8197..49aac7a6b75f95a6e02eedf1bf4a4d5efa8f7a41 100644 --- a/core/modules/help/tests/modules/help_page_test/help_page_test.module +++ b/core/modules/help/tests/modules/help_page_test/help_page_test.module @@ -17,8 +17,10 @@ function help_page_test_help($route_name, RouteMatchInterface $route_match) { // Make the help text conform to core standards. See // \Drupal\system\Tests\Module\InstallUninstallTest::assertHelp(). return t('Read the <a href=":url">online documentation for the Help Page Test module</a>.', [':url' => 'http://www.example.com']); + case 'help_page_test.has_help': return t('I have help!'); + case 'help_page_test.test_array': return ['#markup' => 'Help text from help_page_test_help module.']; } diff --git a/core/modules/language/src/Plugin/migrate/process/LanguageNegotiation.php b/core/modules/language/src/Plugin/migrate/process/LanguageNegotiation.php index 837dbbbc60dd439633f416aaccefe28a64e93f7f..ad8af296ca4d8e6973583e2c8b162f1c8e48c4f2 100644 --- a/core/modules/language/src/Plugin/migrate/process/LanguageNegotiation.php +++ b/core/modules/language/src/Plugin/migrate/process/LanguageNegotiation.php @@ -61,18 +61,25 @@ protected function mapNewMethods($value) { switch ($value) { case 'language-default': return 'language-selected'; + case 'locale-browser': return 'language-browser'; + case 'locale-interface': return 'language-interface'; + case 'locale-session': return 'language-session'; + case 'locale-url': return 'language-url'; + case 'locale-url-fallback': return 'language-url-fallback'; + case 'locale-user': return 'language-user'; + default: return $value; } diff --git a/core/modules/link/src/Plugin/Field/FieldType/LinkItem.php b/core/modules/link/src/Plugin/Field/FieldType/LinkItem.php index 674c2eeb28c01282b300ba7443a11e34272bed49..84556f8be093cebb0e965aab320dad7df20ccb89 100644 --- a/core/modules/link/src/Plugin/Field/FieldType/LinkItem.php +++ b/core/modules/link/src/Plugin/Field/FieldType/LinkItem.php @@ -127,9 +127,11 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin case DRUPAL_DISABLED: $values['title'] = ''; break; + case DRUPAL_REQUIRED: $values['title'] = $random->sentences(4); break; + case DRUPAL_OPTIONAL: // In case of optional title, randomize its generation. $values['title'] = mt_rand(0, 1) ? $random->sentences(4) : ''; diff --git a/core/modules/locale/tests/modules/locale_test/locale_test.module b/core/modules/locale/tests/modules/locale_test/locale_test.module index 4a0a786445d380a439c7ceec748ac462035fbf4f..ff7c3dccc889ed4c6c8c2575c4517377d745212e 100644 --- a/core/modules/locale/tests/modules/locale_test/locale_test.module +++ b/core/modules/locale/tests/modules/locale_test/locale_test.module @@ -204,6 +204,7 @@ function locale_test_tokens($type, $tokens, array $data = [], array $options = [ case 'security_test1': $return[$original] = "javascript:alert('Mooooh!');"; break; + case 'security_test2': $return[$original] = "<script>alert('Mooooh!');</script>"; break; diff --git a/core/modules/media/src/OEmbed/ResourceFetcher.php b/core/modules/media/src/OEmbed/ResourceFetcher.php index e58e7e26adae0494d5925b09d20f83dee4c4d29d..155eb02dd60a195b43b40b8cebdc617fa3b2639e 100644 --- a/core/modules/media/src/OEmbed/ResourceFetcher.php +++ b/core/modules/media/src/OEmbed/ResourceFetcher.php @@ -168,6 +168,7 @@ protected function createResource(array $data, $url) { $data['thumbnail_width'], $data['thumbnail_height'] ); + case Resource::TYPE_VIDEO: return Resource::video( $data['html'], diff --git a/core/modules/menu_link_content/tests/src/Functional/Rest/MenuLinkContentResourceTestBase.php b/core/modules/menu_link_content/tests/src/Functional/Rest/MenuLinkContentResourceTestBase.php index 3cdf2eff736e4145f2e2b0acb9187518c221f2d4..448dfd2394f0c5176d46b4840ab0f9ad2c7a28af 100644 --- a/core/modules/menu_link_content/tests/src/Functional/Rest/MenuLinkContentResourceTestBase.php +++ b/core/modules/menu_link_content/tests/src/Functional/Rest/MenuLinkContentResourceTestBase.php @@ -223,6 +223,7 @@ protected function getExpectedUnauthorizedAccessMessage($method) { switch ($method) { case 'DELETE': return "The 'administer menu' permission is required."; + default: return parent::getExpectedUnauthorizedAccessMessage($method); } diff --git a/core/modules/migrate/src/Plugin/migrate/process/FileProcessBase.php b/core/modules/migrate/src/Plugin/migrate/process/FileProcessBase.php index ad0aa58b45580727d42199b12ad8a3bd80485e4e..9a184858234a348acd0788dcdd48099d19ba66b2 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/FileProcessBase.php +++ b/core/modules/migrate/src/Plugin/migrate/process/FileProcessBase.php @@ -34,9 +34,11 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi case 'use existing': $configuration['file_exists'] = FileSystemInterface::EXISTS_ERROR; break; + case 'rename': $configuration['file_exists'] = FileSystemInterface::EXISTS_RENAME; break; + default: $configuration['file_exists'] = FileSystemInterface::EXISTS_REPLACE; } diff --git a/core/modules/node/src/Plugin/views/wizard/Node.php b/core/modules/node/src/Plugin/views/wizard/Node.php index 576c3158ed1381e11f7ed89e44004dd86d1353ca..3e6b9ea6d26b891d27be16d557ade4510d6fe57b 100644 --- a/core/modules/node/src/Plugin/views/wizard/Node.php +++ b/core/modules/node/src/Plugin/views/wizard/Node.php @@ -214,10 +214,12 @@ protected function display_options_row(&$display_options, $row_plugin, $row_opt $display_options['row']['type'] = 'entity:node'; $display_options['row']['options']['view_mode'] = 'full'; break; + case 'teasers': $display_options['row']['type'] = 'entity:node'; $display_options['row']['options']['view_mode'] = 'teaser'; break; + case 'titles_linked': case 'titles': $display_options['row']['type'] = 'fields'; diff --git a/core/modules/node/tests/src/Functional/Rest/NodeResourceTestBase.php b/core/modules/node/tests/src/Functional/Rest/NodeResourceTestBase.php index ecfbc78c32b7706a80f504612def3a43d35b0ed7..1832ca50931afac47f09bac2a816b7ebfb4a9a12 100644 --- a/core/modules/node/tests/src/Functional/Rest/NodeResourceTestBase.php +++ b/core/modules/node/tests/src/Functional/Rest/NodeResourceTestBase.php @@ -46,9 +46,11 @@ protected function setUpAuthorization($method) { case 'GET': $this->grantPermissionsToTestedRole(['access content']); break; + case 'POST': $this->grantPermissionsToTestedRole(['access content', 'create camelids content']); break; + case 'PATCH': // Do not grant the 'create url aliases' permission to test the case // when the path field is protected/not accessible, see @@ -56,6 +58,7 @@ protected function setUpAuthorization($method) { // for a positive test. $this->grantPermissionsToTestedRole(['access content', 'edit any camelids content']); break; + case 'DELETE': $this->grantPermissionsToTestedRole(['access content', 'delete any camelids content']); break; diff --git a/core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php b/core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php index bf1943aa1d283af4e2edfd28bb5b167e49bd2eca..508c8f43302ec87af69d8b1d8197a748fb37581d 100644 --- a/core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php +++ b/core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php @@ -237,6 +237,7 @@ public static function isEmptyImageStyleMapping(array $image_style_mapping) { return FALSE; } break; + case 'image_style': // The image style mapping must have an image style selected. if ($image_style_mapping['image_mapping']) { @@ -270,6 +271,7 @@ public function getImageStyleIds() { case 'image_style': $image_styles[] = $image_style_mapping['image_mapping']; break; + case 'sizes': $image_styles = array_merge($image_styles, $image_style_mapping['image_mapping']['sizes_image_styles']); break; diff --git a/core/modules/rest/src/Entity/ConfigDependencies.php b/core/modules/rest/src/Entity/ConfigDependencies.php index 4b03057e570f9b869a502483f05c5bd9c1e3a71a..5acaacd6a0c2285b0700daaf62277443d6d890e0 100644 --- a/core/modules/rest/src/Entity/ConfigDependencies.php +++ b/core/modules/rest/src/Entity/ConfigDependencies.php @@ -78,9 +78,11 @@ public function calculateDependencies(RestResourceConfigInterface $rest_config) case RestResourceConfigInterface::METHOD_GRANULARITY: $methods = $rest_config->getMethods(); break; + case RestResourceConfigInterface::RESOURCE_GRANULARITY: $methods = array_slice($rest_config->getMethods(), 0, 1); break; + default: throw new \InvalidArgumentException('Invalid granularity specified.'); } @@ -127,8 +129,10 @@ public function onDependencyRemoval(RestResourceConfigInterface $rest_config, ar switch ($granularity) { case RestResourceConfigInterface::METHOD_GRANULARITY: return $this->onDependencyRemovalForMethodGranularity($rest_config, $dependencies); + case RestResourceConfigInterface::RESOURCE_GRANULARITY: return $this->onDependencyRemovalForResourceGranularity($rest_config, $dependencies); + default: throw new \InvalidArgumentException('Invalid granularity specified.'); } diff --git a/core/modules/rest/src/Entity/RestResourceConfig.php b/core/modules/rest/src/Entity/RestResourceConfig.php index 2b49e9c227bc6e1c543d8aa6140cf61880714a53..027eb5e6c5f5eec41f4f0e1d059c15df3bdba124 100644 --- a/core/modules/rest/src/Entity/RestResourceConfig.php +++ b/core/modules/rest/src/Entity/RestResourceConfig.php @@ -113,8 +113,10 @@ public function getMethods() { switch ($this->granularity) { case RestResourceConfigInterface::METHOD_GRANULARITY: return $this->getMethodsForMethodGranularity(); + case RestResourceConfigInterface::RESOURCE_GRANULARITY: return $this->configuration['methods']; + default: throw new \InvalidArgumentException('Invalid granularity specified.'); } @@ -138,8 +140,10 @@ public function getAuthenticationProviders($method) { switch ($this->granularity) { case RestResourceConfigInterface::METHOD_GRANULARITY: return $this->getAuthenticationProvidersForMethodGranularity($method); + case RestResourceConfigInterface::RESOURCE_GRANULARITY: return $this->configuration['authentication']; + default: throw new \InvalidArgumentException('Invalid granularity specified.'); } @@ -169,8 +173,10 @@ public function getFormats($method) { switch ($this->granularity) { case RestResourceConfigInterface::METHOD_GRANULARITY: return $this->getFormatsForMethodGranularity($method); + case RestResourceConfigInterface::RESOURCE_GRANULARITY: return $this->configuration['formats']; + default: throw new \InvalidArgumentException('Invalid granularity specified.'); } diff --git a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php index 33acfbf0501f9f33b06dc5dfde2465698db00f96..45025ff4b9c171e2efd3d664580615077ac3e43f 100644 --- a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php +++ b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php @@ -371,13 +371,16 @@ protected function getBaseRoute($canonical_path, $method) { case 'GET': $route->setRequirement('_entity_access', $this->entityType->id() . '.view'); break; + case 'POST': $route->setRequirement('_entity_create_any_access', $this->entityType->id()); $route->setOption('_ignore_create_bundle_access', TRUE); break; + case 'PATCH': $route->setRequirement('_entity_access', $this->entityType->id() . '.update'); break; + case 'DELETE': $route->setRequirement('_entity_access', $this->entityType->id() . '.delete'); break; diff --git a/core/modules/rest/tests/modules/rest_test/rest_test.module b/core/modules/rest/tests/modules/rest_test/rest_test.module index 9839edbf39a180e2305f516da95c3118265fa219..67aa7cd54104c5a4b7ff295eb1b1a97440e59061 100644 --- a/core/modules/rest/tests/modules/rest_test/rest_test.module +++ b/core/modules/rest/tests/modules/rest_test/rest_test.module @@ -26,6 +26,7 @@ function rest_test_entity_field_access($operation, FieldDefinitionInterface $fie // Never ever allow this field to be viewed: this lets // EntityResourceTestBase::testGet() test in a "vanilla" way. return AccessResult::forbidden(); + case 'edit': return AccessResult::forbidden(); } diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php index 5f7130e169b27b499b0a72dae132f92c751fd2f1..910c7c610182c168fe134b96befcb05d79e06e20 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php @@ -1285,17 +1285,20 @@ protected static function getModifiedEntityForPatchTesting(EntityInterface $enti // is valid, we only care that it's different. $field->setValue(['target_id' => 99999]); break; + case BooleanItem::class: // BooleanItem::generateSampleValue() picks either 0 or 1. So a 50% // chance of not picking a different value. $field->value = ((int) $field->value) === 1 ? '0' : '1'; break; + case PathItem::class: // PathItem::generateSampleValue() doesn't set a PID, which causes // PathItem::postSave() to fail. Keep the PID (and other properties), // just modify the alias. $field->alias = str_replace(' ', '-', strtolower((new Random())->sentences(3))); break; + default: $original_field = clone $field; while ($field->equals($original_field)) { @@ -1328,9 +1331,11 @@ protected function makeNormalizationInvalid(array $normalization, $entity_key) { $normalization[$label_field][1]['value'] = 'Second Title'; } break; + case 'id': $normalization[$entity_type->getKey('id')][0]['value'] = $this->anotherEntity->id(); break; + case 'uuid': $normalization[$entity_type->getKey('uuid')][0]['value'] = $this->anotherEntity->uuid(); break; diff --git a/core/modules/rest/tests/src/Functional/EntityResource/XmlEntityNormalizationQuirksTrait.php b/core/modules/rest/tests/src/Functional/EntityResource/XmlEntityNormalizationQuirksTrait.php index a7e588ad356e29fad3802cb866950fc17024e256..243b01bc88968cf5507d678e752dbee592d91b4a 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/XmlEntityNormalizationQuirksTrait.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/XmlEntityNormalizationQuirksTrait.php @@ -70,20 +70,24 @@ protected function applyXmlFieldDecodingQuirks(array $normalization) { $value = &$normalization[$field_name][$i]['value']; $value = $value === TRUE ? '1' : '0'; break; + case IntegerItem::class: case ListIntegerItem::class: $value = &$normalization[$field_name][$i]['value']; $value = (string) $value; break; + case PathItem::class: $pid = &$normalization[$field_name][$i]['pid']; $pid = (string) $pid; break; + case EntityReferenceItem::class: case FileItem::class: $target_id = &$normalization[$field_name][$i]['target_id']; $target_id = (string) $target_id; break; + case ChangedItem::class: case CreatedItem::class: case TimestampItem::class: @@ -92,6 +96,7 @@ protected function applyXmlFieldDecodingQuirks(array $normalization) { $value = (string) $value; } break; + case ImageItem::class: $height = &$normalization[$field_name][$i]['height']; $height = (string) $height; diff --git a/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php b/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php index 0ae7fbda7ed19125f1789b61e68e9285307e3318..619af887f5bae2904a73f3b0615200d04488868d 100644 --- a/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php @@ -741,6 +741,7 @@ protected function setUpAuthorization($method) { case 'GET': $this->grantPermissionsToTestedRole(['view test entity']); break; + case 'POST': $this->grantPermissionsToTestedRole(['create entity_test entity_test_with_bundle entities', 'access content']); break; diff --git a/core/modules/search/tests/src/Functional/SearchRankingTest.php b/core/modules/search/tests/src/Functional/SearchRankingTest.php index 592c951b2fa8863f3dc9f40b71ee82f0ace3e116..834c3d0174ee37e0ba9e71d39c8167ee727e70a6 100644 --- a/core/modules/search/tests/src/Functional/SearchRankingTest.php +++ b/core/modules/search/tests/src/Functional/SearchRankingTest.php @@ -81,13 +81,16 @@ public function testRankings() { case 'promote': $settings[$node_rank] = 1; break; + case 'relevance': $settings['body'][0]['value'] .= " really rocks"; break; + case 'recent': // Node is 1 hour hold. $settings['created'] = REQUEST_TIME - 3600; break; + case 'comments': $settings['comment'][0]['status'] = CommentItemInterface::OPEN; break; @@ -233,9 +236,11 @@ public function testHTMLRankings() { case 'a': $settings['body'] = [['value' => Link::fromTextAndUrl('Drupal Rocks', Url::fromRoute('<front>'))->toString(), 'format' => 'full_html']]; break; + case 'notag': $settings['body'] = [['value' => 'Drupal Rocks']]; break; + default: $settings['body'] = [['value' => "<$tag>Drupal Rocks</$tag>", 'format' => 'full_html']]; break; diff --git a/core/modules/shortcut/src/ShortcutSetAccessControlHandler.php b/core/modules/shortcut/src/ShortcutSetAccessControlHandler.php index 87be25d2d06a8dc28a1a1841f5de9a589978e94a..6bdb3b93c0943f76190aca649aa69b5d845e233f 100644 --- a/core/modules/shortcut/src/ShortcutSetAccessControlHandler.php +++ b/core/modules/shortcut/src/ShortcutSetAccessControlHandler.php @@ -21,6 +21,7 @@ protected function checkAccess(EntityInterface $entity, $operation, AccountInter switch ($operation) { case 'view': return AccessResult::allowedIfHasPermission($account, 'access shortcuts'); + case 'update': if ($account->hasPermission('administer shortcuts')) { return AccessResult::allowed()->cachePerPermissions(); diff --git a/core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php b/core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php index 580f35cd321070a871fca6eb1eb638aab4f924e2..a1ec71b3026052c168d8896e049e01f1ddc0ff57 100644 --- a/core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php +++ b/core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php @@ -96,6 +96,7 @@ protected function getExpectedUnauthorizedAccessMessage($method) { switch ($method) { case 'GET': return "The 'access shortcuts' permission is required."; + default: return parent::getExpectedUnauthorizedAccessMessage($method); } diff --git a/core/modules/system/src/Controller/DbUpdateController.php b/core/modules/system/src/Controller/DbUpdateController.php index ef54a705a0edb5e516fb980a9bbc4d0c9069f154..b8ea203de6c8773d0a59d9dfa30d6f8792fb9e3a 100644 --- a/core/modules/system/src/Controller/DbUpdateController.php +++ b/core/modules/system/src/Controller/DbUpdateController.php @@ -273,6 +273,7 @@ protected function selection(Request $request) { case 'update': $updates = update_get_update_list(); break; + case 'post_update': $updates = $this->postUpdateRegistry->getPendingUpdateInformation(); break; diff --git a/core/modules/system/tests/modules/batch_test/src/Form/BatchTestMultiStepForm.php b/core/modules/system/tests/modules/batch_test/src/Form/BatchTestMultiStepForm.php index 151b50b7b8647b321d12cefee412a752236cfb9b..0289fc440db0f375ffadb3c0db456a555c893881 100644 --- a/core/modules/system/tests/modules/batch_test/src/Form/BatchTestMultiStepForm.php +++ b/core/modules/system/tests/modules/batch_test/src/Form/BatchTestMultiStepForm.php @@ -56,6 +56,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { case 1: batch_set(_batch_test_batch_1()); break; + case 2: batch_set(_batch_test_batch_2()); break; diff --git a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestLabelResourceTestBase.php b/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestLabelResourceTestBase.php index a13556dbf4b60fd25926c2e707e9113e56dcf2d8..c5b3d9787623e26b787ff1f0a17bd2bf9a8ffb5b 100644 --- a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestLabelResourceTestBase.php +++ b/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestLabelResourceTestBase.php @@ -36,6 +36,7 @@ protected function setUpAuthorization($method) { case 'GET': $this->grantPermissionsToTestedRole(['view test entity']); break; + case 'POST': $this->grantPermissionsToTestedRole([ 'administer entity_test content', @@ -43,6 +44,7 @@ protected function setUpAuthorization($method) { 'create entity_test entity_test_with_bundle entities', ]); break; + case 'PATCH': case 'DELETE': $this->grantPermissionsToTestedRole(['administer entity_test content']); @@ -144,11 +146,14 @@ protected function getExpectedUnauthorizedAccessMessage($method) { switch ($method) { case 'GET': return "The 'view test entity' permission is required."; + case 'POST': return "The following permissions are required: 'administer entity_test content' OR 'administer entity_test_with_bundle content' OR 'create entity_test_label entity_test_with_bundle entities'."; + case 'PATCH': case 'DELETE': return "The 'administer entity_test content' permission is required."; + default: return parent::getExpectedUnauthorizedAccessMessage($method); } diff --git a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestResourceTestBase.php b/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestResourceTestBase.php index b1b376eaa7c15a986093496aeab388d6f18cd838..c05982924e1370ec3af436c039eabc7c68218775 100644 --- a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestResourceTestBase.php +++ b/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestResourceTestBase.php @@ -41,9 +41,11 @@ protected function setUpAuthorization($method) { case 'GET': $this->grantPermissionsToTestedRole(['view test entity']); break; + case 'POST': $this->grantPermissionsToTestedRole(['create entity_test entity_test_with_bundle entities']); break; + case 'PATCH': case 'DELETE': $this->grantPermissionsToTestedRole(['administer entity_test content']); @@ -152,8 +154,10 @@ protected function getExpectedUnauthorizedAccessMessage($method) { switch ($method) { case 'GET': return "The 'view test entity' permission is required."; + case 'POST': return "The following permissions are required: 'administer entity_test content' OR 'administer entity_test_with_bundle content' OR 'create entity_test entity_test_with_bundle entities'."; + default: return parent::getExpectedUnauthorizedAccessMessage($method); } diff --git a/core/modules/system/tests/modules/update_script_test/update_script_test.install b/core/modules/system/tests/modules/update_script_test/update_script_test.install index ce3874320dca139d4e3fa56e5c5759b0d874fc38..b49e7cf978dac5c4fa9f53f1b1bc5db816de4fdb 100644 --- a/core/modules/system/tests/modules/update_script_test/update_script_test.install +++ b/core/modules/system/tests/modules/update_script_test/update_script_test.install @@ -23,6 +23,7 @@ function update_script_test_requirements($phase) { 'severity' => REQUIREMENT_WARNING, ]; break; + case REQUIREMENT_ERROR: $requirements['update_script_test'] = [ 'title' => 'Update script test', diff --git a/core/modules/taxonomy/src/Form/OverviewTerms.php b/core/modules/taxonomy/src/Form/OverviewTerms.php index ec5d08f9e392dcefe7170a63d584f2ee643be3fd..52827f029e0b11d9d55b11833462af5c4378296c 100644 --- a/core/modules/taxonomy/src/Form/OverviewTerms.php +++ b/core/modules/taxonomy/src/Form/OverviewTerms.php @@ -256,9 +256,11 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular case VocabularyInterface::HIERARCHY_DISABLED: $help_message = $this->t('You can reorganize the terms in %capital_name using their drag-and-drop handles, and group terms under a parent term by sliding them under and to the right of the parent.', $args); break; + case VocabularyInterface::HIERARCHY_SINGLE: $help_message = $this->t('%capital_name contains terms grouped under parent terms. You can reorganize the terms in %capital_name using their drag-and-drop handles.', $args); break; + case VocabularyInterface::HIERARCHY_MULTIPLE: $help_message = $this->t('%capital_name contains terms with multiple parents. Drag and drop of terms with multiple parents is not supported, but you can re-enable drag-and-drop support by editing each term to include only a single parent.', $args); break; @@ -269,9 +271,11 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular case VocabularyInterface::HIERARCHY_DISABLED: $help_message = $this->t('%capital_name contains the following terms.', $args); break; + case VocabularyInterface::HIERARCHY_SINGLE: $help_message = $this->t('%capital_name contains terms grouped under parent terms', $args); break; + case VocabularyInterface::HIERARCHY_MULTIPLE: $help_message = $this->t('%capital_name contains terms with multiple parents.', $args); break; diff --git a/core/modules/taxonomy/src/TermForm.php b/core/modules/taxonomy/src/TermForm.php index 1ba191c7e5844cfad101bf566f7fef0ace7f094f..eb3463dd89510f713e4c09d65287225dacc6c43e 100644 --- a/core/modules/taxonomy/src/TermForm.php +++ b/core/modules/taxonomy/src/TermForm.php @@ -162,6 +162,7 @@ public function save(array $form, FormStateInterface $form_state) { $this->messenger()->addStatus($this->t('Created new term %term.', ['%term' => $view_link])); $this->logger('taxonomy')->notice('Created new term %term.', ['%term' => $term->getName(), 'link' => $edit_link]); break; + case SAVED_UPDATED: $this->messenger()->addStatus($this->t('Updated term %term.', ['%term' => $view_link])); $this->logger('taxonomy')->notice('Updated term %term.', ['%term' => $term->getName(), 'link' => $edit_link]); diff --git a/core/modules/taxonomy/tests/src/Functional/Hal/TermHalJsonAnonTest.php b/core/modules/taxonomy/tests/src/Functional/Hal/TermHalJsonAnonTest.php index b6370f8728e528a154eeeff037cd996e335258a4..ff8d4e2889016ff6bc99f9072d83b152f690b667 100644 --- a/core/modules/taxonomy/tests/src/Functional/Hal/TermHalJsonAnonTest.php +++ b/core/modules/taxonomy/tests/src/Functional/Hal/TermHalJsonAnonTest.php @@ -65,6 +65,7 @@ protected function getExpectedNormalizedEntity() { NULL, ]; break; + case [2]: $expected_parent_normalization_links = [ [ @@ -87,6 +88,7 @@ protected function getExpectedNormalizedEntity() { ], ]; break; + case [0, 2]: $expected_parent_normalization_links = [ NULL, @@ -111,6 +113,7 @@ protected function getExpectedNormalizedEntity() { ], ]; break; + case [3, 2]: $expected_parent_normalization_links = [ [ diff --git a/core/modules/taxonomy/tests/src/Functional/Rest/TermResourceTestBase.php b/core/modules/taxonomy/tests/src/Functional/Rest/TermResourceTestBase.php index db261e04b6b78b3015a4ab00183c5f2d43c3632f..16f1d3734e7456fce4b542fe45f03ecdc14fbcd8 100644 --- a/core/modules/taxonomy/tests/src/Functional/Rest/TermResourceTestBase.php +++ b/core/modules/taxonomy/tests/src/Functional/Rest/TermResourceTestBase.php @@ -108,6 +108,7 @@ protected function getExpectedNormalizedEntity() { ], ]; break; + case [2]: $expected_parent_normalization = [ [ @@ -118,6 +119,7 @@ protected function getExpectedNormalizedEntity() { ], ]; break; + case [0, 2]: $expected_parent_normalization = [ [ @@ -131,6 +133,7 @@ protected function getExpectedNormalizedEntity() { ], ]; break; + case [3, 2]: $expected_parent_normalization = [ [ @@ -257,12 +260,16 @@ protected function getExpectedUnauthorizedAccessMessage($method) { switch ($method) { case 'GET': return "The 'access content' permission is required and the taxonomy term must be published."; + case 'POST': return "The following permissions are required: 'create terms in camelids' OR 'administer taxonomy'."; + case 'PATCH': return "The following permissions are required: 'edit terms in camelids' OR 'administer taxonomy'."; + case 'DELETE': return "The following permissions are required: 'delete terms in camelids' OR 'administer taxonomy'."; + default: return parent::getExpectedUnauthorizedAccessMessage($method); } diff --git a/core/modules/text/src/Plugin/migrate/field/d6/TextField.php b/core/modules/text/src/Plugin/migrate/field/d6/TextField.php index 6eeb95f6d0bd380eb27cbb2fca9253a1140c1e47..2472b29ea701b230f5f67137ed16bca730122eca 100644 --- a/core/modules/text/src/Plugin/migrate/field/d6/TextField.php +++ b/core/modules/text/src/Plugin/migrate/field/d6/TextField.php @@ -123,8 +123,10 @@ public function getFieldType(Row $row) { case 'optionwidgets_buttons': case 'optionwidgets_select': return 'list_string'; + case 'optionwidgets_onoff': return 'boolean'; + default: return parent::getFieldType($row); } diff --git a/core/modules/text/src/Plugin/migrate/field/d7/TextField.php b/core/modules/text/src/Plugin/migrate/field/d7/TextField.php index 14c36d35da6f43927e7a71580932fe332758157d..2d2396ed87070ff921d494ff089a8e63d7cc0b54 100644 --- a/core/modules/text/src/Plugin/migrate/field/d7/TextField.php +++ b/core/modules/text/src/Plugin/migrate/field/d7/TextField.php @@ -32,6 +32,7 @@ public function getFieldFormatterType(Row $row) { case 'string': $formatter_type = str_replace(['text_default', 'text_plain'], 'string', $formatter_type); break; + case 'string_long': $formatter_type = str_replace('text_default', 'basic_string', $formatter_type); break; @@ -51,6 +52,7 @@ public function getFieldWidgetType(Row $row) { case 'string': $widget_type = str_replace('text_textfield', 'string_textfield', $widget_type); break; + case 'string_long': $widget_type = str_replace('text_textarea', 'string_textarea', $widget_type); break; @@ -75,6 +77,7 @@ public function getFieldType(Row $row) { case '0': $plain_text = TRUE; break; + case '1': $filtered_text = TRUE; break; diff --git a/core/modules/update/tests/src/Functional/UpdateCoreTest.php b/core/modules/update/tests/src/Functional/UpdateCoreTest.php index 8d60257aad0d755ff3cc407356fd8770be6469f6..59257c7fcf00e1a0209626c6b5597962a4003665 100644 --- a/core/modules/update/tests/src/Functional/UpdateCoreTest.php +++ b/core/modules/update/tests/src/Functional/UpdateCoreTest.php @@ -134,6 +134,7 @@ public function testNormalUpdateAvailable() { $this->assertRaw('check.svg', 'Check icon was found.'); } break; + case 1: // Both stable and unstable releases are available. // A stable release is the latest. diff --git a/core/modules/update/update.compare.inc b/core/modules/update/update.compare.inc index fd72a7d174a1d431540826d9a8a6ce340fe2b5b0..02ca3ce8160b96529ea45e08bff2228c8ef57864 100644 --- a/core/modules/update/update.compare.inc +++ b/core/modules/update/update.compare.inc @@ -225,6 +225,7 @@ function update_calculate_project_update_status(&$project_data, $available) { 'data' => t('This project has been labeled insecure by the Drupal security team, and is no longer available for download. Immediately disabling everything included by this project is strongly recommended!'), ]; break; + case 'unpublished': case 'revoked': $project_data['status'] = UpdateManagerInterface::REVOKED; @@ -236,6 +237,7 @@ function update_calculate_project_update_status(&$project_data, $available) { 'data' => t('This project has been revoked, and is no longer available for download. Disabling everything included by this project is strongly recommended!'), ]; break; + case 'unsupported': $project_data['status'] = UpdateManagerInterface::NOT_SUPPORTED; if (empty($project_data['extra'])) { @@ -246,6 +248,7 @@ function update_calculate_project_update_status(&$project_data, $available) { 'data' => t('This project is no longer supported, and is no longer available for download. Disabling everything included by this project is strongly recommended!'), ]; break; + case 'not-fetched': $project_data['status'] = UpdateFetcherInterface::NOT_FETCHED; $project_data['reason'] = t('Failed to get available update data.'); diff --git a/core/modules/update/update.install b/core/modules/update/update.install index b9d6da90cf01e991044d6f775203a3cc90ae78dd..5c8da0da367f42a3cf25510155d2b4358b6a0da2 100644 --- a/core/modules/update/update.install +++ b/core/modules/update/update.install @@ -139,16 +139,20 @@ function _update_requirement_check($project, $type) { case UpdateManagerInterface::NOT_SECURE: $requirement_label = t('Not secure!'); break; + case UpdateManagerInterface::REVOKED: $requirement_label = t('Revoked!'); break; + case UpdateManagerInterface::NOT_SUPPORTED: $requirement_label = t('Unsupported release'); break; + case UpdateManagerInterface::NOT_CURRENT: $requirement_label = t('Out of date'); $requirement['severity'] = REQUIREMENT_WARNING; break; + case UpdateFetcherInterface::UNKNOWN: case UpdateFetcherInterface::NOT_CHECKED: case UpdateFetcherInterface::NOT_FETCHED: @@ -156,6 +160,7 @@ function _update_requirement_check($project, $type) { $requirement_label = isset($project['reason']) ? $project['reason'] : t('Can not determine status'); $requirement['severity'] = REQUIREMENT_WARNING; break; + default: $requirement_label = t('Up to date'); } diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc index 847f3c28a03161c71f9cd81e44fa4ace9267b3c8..172860f3fda9166adb6fd898d19c810eec5a2e0e 100644 --- a/core/modules/update/update.report.inc +++ b/core/modules/update/update.report.inc @@ -65,6 +65,7 @@ function template_preprocess_update_report(&$variables) { case UpdateManagerInterface::CURRENT: $rows[$project['project_type']][$row_key]['#attributes'] = ['class' => ['color-success']]; break; + case UpdateFetcherInterface::UNKNOWN: case UpdateFetcherInterface::FETCH_PENDING: case UpdateFetcherInterface::NOT_FETCHED: @@ -73,6 +74,7 @@ function template_preprocess_update_report(&$variables) { case UpdateManagerInterface::NOT_SUPPORTED: $rows[$project['project_type']][$row_key]['#attributes'] = ['class' => ['color-error']]; break; + case UpdateFetcherInterface::NOT_CHECKED: case UpdateManagerInterface::NOT_CURRENT: default: @@ -274,15 +276,19 @@ function template_preprocess_update_project_status(&$variables) { case UpdateManagerInterface::NOT_SECURE: $status_label = t('Security update required!'); break; + case UpdateManagerInterface::REVOKED: $status_label = t('Revoked!'); break; + case UpdateManagerInterface::NOT_SUPPORTED: $status_label = t('Not supported!'); break; + case UpdateManagerInterface::NOT_CURRENT: $status_label = t('Update available'); break; + case UpdateManagerInterface::CURRENT: $status_label = t('Up to date'); break; @@ -296,18 +302,21 @@ function template_preprocess_update_project_status(&$variables) { $uri = 'core/misc/icons/73b355/check.svg'; $text = t('Ok'); break; + case UpdateFetcherInterface::UNKNOWN: case UpdateFetcherInterface::FETCH_PENDING: case UpdateFetcherInterface::NOT_FETCHED: $uri = 'core/misc/icons/e29700/warning.svg'; $text = t('Warning'); break; + case UpdateManagerInterface::NOT_SECURE: case UpdateManagerInterface::REVOKED: case UpdateManagerInterface::NOT_SUPPORTED: $uri = 'core/misc/icons/e32700/error.svg'; $text = t('Error'); break; + case UpdateFetcherInterface::NOT_CHECKED: case UpdateManagerInterface::NOT_CURRENT: default: diff --git a/core/modules/user/tests/src/Functional/Rest/UserResourceTestBase.php b/core/modules/user/tests/src/Functional/Rest/UserResourceTestBase.php index 9ff6fb686f746ed26eefc36f4fe1fd8bfbd7525a..3b01a626a902a1ade8b04dcc0bbd2978f988896f 100644 --- a/core/modules/user/tests/src/Functional/Rest/UserResourceTestBase.php +++ b/core/modules/user/tests/src/Functional/Rest/UserResourceTestBase.php @@ -54,6 +54,7 @@ protected function setUpAuthorization($method) { case 'GET': $this->grantPermissionsToTestedRole(['access user profiles']); break; + case 'POST': case 'PATCH': case 'DELETE': @@ -307,10 +308,13 @@ protected function getExpectedUnauthorizedAccessMessage($method) { switch ($method) { case 'GET': return "The 'access user profiles' permission is required and the user must be active."; + case 'PATCH': return "Users can only update their own account, unless they have the 'administer users' permission."; + case 'DELETE': return "The 'cancel account' permission is required."; + default: return parent::getExpectedUnauthorizedAccessMessage($method); } diff --git a/core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php b/core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php index f8940d00a185d97d05582f087dbe4a4d6f76d307..7e1cb1a51a743527e6bdb13a31835f7540b94c29 100644 --- a/core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php +++ b/core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php @@ -169,30 +169,39 @@ public function onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeI case static::BASE_TABLE_RENAME: $this->baseTableRename($all_views, $entity_type->id(), $original->getBaseTable(), $entity_type->getBaseTable()); break; + case static::DATA_TABLE_RENAME: $this->dataTableRename($all_views, $entity_type->id(), $original->getDataTable(), $entity_type->getDataTable()); break; + case static::DATA_TABLE_ADDITION: $this->dataTableAddition($all_views, $entity_type, $entity_type->getDataTable(), $entity_type->getBaseTable()); break; + case static::DATA_TABLE_REMOVAL: $this->dataTableRemoval($all_views, $entity_type->id(), $original->getDataTable(), $entity_type->getBaseTable()); break; + case static::REVISION_TABLE_RENAME: $this->baseTableRename($all_views, $entity_type->id(), $original->getRevisionTable(), $entity_type->getRevisionTable()); break; + case static::REVISION_TABLE_ADDITION: // If we add revision support we don't have to do anything. break; + case static::REVISION_TABLE_REMOVAL: $this->revisionRemoval($all_views, $original); break; + case static::REVISION_DATA_TABLE_RENAME: $this->dataTableRename($all_views, $entity_type->id(), $original->getRevisionDataTable(), $entity_type->getRevisionDataTable()); break; + case static::REVISION_DATA_TABLE_ADDITION: $this->dataTableAddition($all_views, $entity_type, $entity_type->getRevisionDataTable(), $entity_type->getRevisionTable()); break; + case static::REVISION_DATA_TABLE_REMOVAL: $this->dataTableRemoval($all_views, $entity_type->id(), $original->getRevisionDataTable(), $entity_type->getRevisionTable()); break; diff --git a/core/modules/views/src/Plugin/views/HandlerBase.php b/core/modules/views/src/Plugin/views/HandlerBase.php index 28dfbfcab7d4cd75b50cc755922e232eb810082d..87aa79d4606e908f15b13752d19e929d14f7bb00 100644 --- a/core/modules/views/src/Plugin/views/HandlerBase.php +++ b/core/modules/views/src/Plugin/views/HandlerBase.php @@ -197,12 +197,15 @@ public function sanitizeValue($value, $type = NULL) { case 'xss': $value = Xss::filter($value); break; + case 'xss_admin': $value = Xss::filterAdmin($value); break; + case 'url': $value = Html::escape(UrlHelper::stripDangerousProtocols($value)); break; + default: $value = Html::escape($value); break; @@ -231,10 +234,13 @@ protected function caseTransform($string, $option) { return $string; case 'upper': return mb_strtoupper($string); + case 'lower': return mb_strtolower($string); + case 'ucfirst': return Unicode::ucfirst($string); + case 'ucwords': return Unicode::ucwords($string); } diff --git a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php index d4d6665df4bd4b1b45b3de2b6276bf509be382a8..da0eb95490b575ed3792263bb79984c851555e96 100644 --- a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php +++ b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php @@ -1096,6 +1096,7 @@ public function getPlugin($type = 'argument_default', $name = NULL) { $plugin_name = $this->options['default_argument_type']; $options_name = 'default_argument_options'; break; + case 'argument_validator': if (!isset($this->options['validate']['type'])) { return; @@ -1103,6 +1104,7 @@ public function getPlugin($type = 'argument_default', $name = NULL) { $plugin_name = $this->options['validate']['type']; $options_name = 'validate_options'; break; + case 'style': if (!isset($this->options['summary']['format'])) { return; diff --git a/core/modules/views/src/Plugin/views/cache/CachePluginBase.php b/core/modules/views/src/Plugin/views/cache/CachePluginBase.php index 14ac7994fdbcaabf0bbd3bddc9bca15c62326b33..fd9278876aa0c41c5fe1862b8dd8fbdae13ffafb 100644 --- a/core/modules/views/src/Plugin/views/cache/CachePluginBase.php +++ b/core/modules/views/src/Plugin/views/cache/CachePluginBase.php @@ -106,6 +106,7 @@ public function cacheSet($type) { case 'query': // Not supported currently, but this is certainly where we'd put it. break; + case 'results': $data = [ 'result' => $this->prepareViewResult($this->view->result), @@ -135,6 +136,7 @@ public function cacheGet($type) { case 'query': // Not supported currently, but this is certainly where we'd put it. return FALSE; + case 'results': // Values to set: $view->result, $view->total_rows, $view->execute_time, // $view->current_page. diff --git a/core/modules/views/src/Plugin/views/display/Attachment.php b/core/modules/views/src/Plugin/views/display/Attachment.php index 315ab59513452d76515f5447a2bb630d5b84fbfd..7dbbb2f88600e7385094638f432035bcf2f6cfca 100644 --- a/core/modules/views/src/Plugin/views/display/Attachment.php +++ b/core/modules/views/src/Plugin/views/display/Attachment.php @@ -149,6 +149,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->getOption('inherit_arguments'), ]; break; + case 'inherit_exposed_filters': $form['#title'] .= $this->t('Inherit exposed filters'); $form['inherit_exposed_filters'] = [ @@ -158,6 +159,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->getOption('inherit_exposed_filters'), ]; break; + case 'inherit_pager': $form['#title'] .= $this->t('Inherit pager'); $form['inherit_pager'] = [ @@ -167,6 +169,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->getOption('inherit_pager'), ]; break; + case 'render_pager': $form['#title'] .= $this->t('Render pager'); $form['render_pager'] = [ @@ -176,6 +179,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->getOption('render_pager'), ]; break; + case 'attachment_position': $form['#title'] .= $this->t('Position'); $form['attachment_position'] = [ @@ -186,6 +190,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->getOption('attachment_position'), ]; break; + case 'displays': $form['#title'] .= $this->t('Attach to'); $displays = []; @@ -254,9 +259,11 @@ public function attachTo(ViewExecutable $view, $display_id, array &$build) { case 'before': $this->view->attachment_before[] = $attachment; break; + case 'after': $this->view->attachment_after[] = $attachment; break; + case 'both': $this->view->attachment_before[] = $attachment; $this->view->attachment_after[] = $attachment; diff --git a/core/modules/views/src/Plugin/views/display/Block.php b/core/modules/views/src/Plugin/views/display/Block.php index 1a89f40de99f18cf4fd6fd70e6d282da9a21902e..c33fb8f1041170b02fcbe2d14b82b2a080a2a796 100644 --- a/core/modules/views/src/Plugin/views/display/Block.php +++ b/core/modules/views/src/Plugin/views/display/Block.php @@ -200,6 +200,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->getOption('block_description'), ]; break; + case 'block_category': $form['#title'] .= $this->t('Block category'); $form['block_category'] = [ @@ -209,6 +210,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->getOption('block_category'), ]; break; + case 'block_hide_empty': $form['#title'] .= $this->t('Block empty settings'); @@ -219,6 +221,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->getOption('block_hide_empty'), ]; break; + case 'exposed_form_options': $this->view->initHandlers(); if (!$this->usesExposed() && parent::usesExposed()) { @@ -228,6 +231,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ]; } break; + case 'allow': $form['#title'] .= $this->t('Allow settings in the block configuration'); diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index 4a67ac3dc3c4cd9a6e4c8f644ae028950363113d..40e264b0008a1d251485be39404f17de7d04930c 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -1404,6 +1404,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#size' => 64, ]; break; + case 'display_title': $form['#title'] .= $this->t('The name and the description of this display'); $form['display_title'] = [ @@ -1417,6 +1418,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->getOption('display_description'), ]; break; + case 'display_comment': $form['#title'] .= $this->t('Administrative comment'); $form['display_comment'] = [ @@ -1426,6 +1428,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->getOption('display_comment'), ]; break; + case 'title': $form['#title'] .= $this->t('The title of this view'); $form['title'] = [ @@ -1436,6 +1439,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#maxlength' => 255, ]; break; + case 'css_class': $form['#title'] .= $this->t('CSS class'); $form['css_class'] = [ @@ -1445,6 +1449,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->getOption('css_class'), ]; break; + case 'use_ajax': $form['#title'] .= $this->t('AJAX'); $form['use_ajax'] = [ @@ -1454,6 +1459,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->getOption('use_ajax') ? 1 : 0, ]; break; + case 'hide_attachment_summary': $form['#title'] .= $this->t('Hide attachments when displaying a contextual filter summary'); $form['hide_attachment_summary'] = [ @@ -1462,6 +1468,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->getOption('hide_attachment_summary') ? 1 : 0, ]; break; + case 'show_admin_links': $form['#title'] .= $this->t('Show contextual links on this view.'); $form['show_admin_links'] = [ @@ -1470,6 +1477,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->getOption('show_admin_links'), ]; break; + case 'use_more': $form['#title'] .= $this->t('Add a more link to the bottom of the display.'); $form['use_more'] = [ @@ -1501,6 +1509,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ], ]; break; + case 'group_by': $form['#title'] .= $this->t('Allow grouping and aggregation (calculation) of fields.'); $form['group_by'] = [ @@ -1510,6 +1519,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->getOption('group_by'), ]; break; + case 'access': $form['#title'] .= $this->t('Access restrictions'); $form['access'] = [ @@ -1537,6 +1547,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { } break; + case 'access_options': $plugin = $this->getPlugin('access'); $form['#title'] .= $this->t('Access options'); @@ -1547,6 +1558,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $plugin->buildOptionsForm($form['access_options'], $form_state); } break; + case 'cache': $form['#title'] .= $this->t('Caching'); $form['cache'] = [ @@ -1573,6 +1585,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ]; } break; + case 'cache_options': $plugin = $this->getPlugin('cache'); $form['#title'] .= $this->t('Caching options'); @@ -1583,6 +1596,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $plugin->buildOptionsForm($form['cache_options'], $form_state); } break; + case 'query': $query_options = $this->getOption('query'); $plugin_name = $query_options['type']; @@ -1604,6 +1618,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $this->view->query->buildOptionsForm($form['query']['options'], $form_state); } break; + case 'rendering_language': $form['#title'] .= $this->t('Rendering language'); if (\Drupal::languageManager()->isMultilingual() && $this->isBaseTableTranslatable()) { @@ -1620,6 +1635,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['rendering_language']['#markup'] = $this->t('The view is not based on a translatable entity type or the site is not multilingual.'); } break; + case 'style': $form['#title'] .= $this->t('How should this view be styled'); $style_plugin = $this->getPlugin('style'); @@ -1646,6 +1662,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { } break; + case 'style_options': $form['#title'] .= $this->t('Style options'); $style = TRUE; @@ -1669,6 +1686,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $plugin->buildOptionsForm($form[$section], $form_state); } break; + case 'row': $form['#title'] .= $this->t('How should each row in this view be styled'); $row_plugin_instance = $this->getPlugin('row'); @@ -1694,6 +1712,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { } break; + case 'link_display': $form['#title'] .= $this->t('Which display to use for path'); $options = [FALSE => $this->t('None'), 'custom_url' => $this->t('Custom URL')]; @@ -1757,6 +1776,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ], ]; break; + case 'exposed_block': $form['#title'] .= $this->t('Put the exposed form in a block'); $form['description'] = [ @@ -1768,6 +1788,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->getOption('exposed_block') ? 1 : 0, ]; break; + case 'exposed_form': $form['#title'] .= $this->t('Exposed Form'); $form['exposed_form'] = [ @@ -1794,6 +1815,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ]; } break; + case 'exposed_form_options': $plugin = $this->getPlugin('exposed_form'); $form['#title'] .= $this->t('Exposed form options'); @@ -1804,6 +1826,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $plugin->buildOptionsForm($form['exposed_form_options'], $form_state); } break; + case 'pager': $form['#title'] .= $this->t('Select pager'); $form['pager'] = [ @@ -1831,6 +1854,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { } break; + case 'pager_options': $plugin = $this->getPlugin('pager'); $form['#title'] .= $this->t('Pager options'); @@ -1859,12 +1883,14 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) { $form_state->setError($form['display_title'], $this->t('Display title may not be empty.')); } break; + case 'css_class': $css_class = $form_state->getValue('css_class'); if (preg_match('/[^a-zA-Z0-9-_ ]/', $css_class)) { $form_state->setError($form['css_class'], $this->t('CSS classes must be alphanumeric or dashes only.')); } break; + case 'display_id': if ($form_state->getValue('display_id')) { if (preg_match('/[^a-z0-9_]/', $form_state->getValue('display_id'))) { @@ -1878,6 +1904,7 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) { } } break; + case 'query': if ($this->view->query) { $this->view->query->validateOptionsForm($form['query'], $form_state); @@ -1917,10 +1944,12 @@ public function submitOptionsForm(&$form, FormStateInterface $form_state) { $this->display['new_id'] = $form_state->getValue('display_id'); } break; + case 'display_title': $this->display['display_title'] = $form_state->getValue('display_title'); $this->setOption('display_description', $form_state->getValue('display_description')); break; + case 'query': $plugin = $this->getPlugin('query'); if ($plugin) { @@ -1938,15 +1967,18 @@ public function submitOptionsForm(&$form, FormStateInterface $form_state) { case 'group_by': $this->setOption($section, $form_state->getValue($section)); break; + case 'rendering_language': $this->setOption('rendering_language', $form_state->getValue('rendering_language')); break; + case 'use_ajax': case 'hide_attachment_summary': case 'show_admin_links': case 'exposed_block': $this->setOption($section, (bool) $form_state->getValue($section)); break; + case 'use_more': $this->setOption($section, intval($form_state->getValue($section))); $this->setOption('use_more_always', intval($form_state->getValue('use_more_always'))); diff --git a/core/modules/views/src/Plugin/views/display/Feed.php b/core/modules/views/src/Plugin/views/display/Feed.php index e269dc0bb1fc423253f173c830d2dc380ddf3d46..f48d61361be9d2221c7a2188130be4b7e96e0f1a 100644 --- a/core/modules/views/src/Plugin/views/display/Feed.php +++ b/core/modules/views/src/Plugin/views/display/Feed.php @@ -281,6 +281,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ], ]; break; + case 'displays': $form['#title'] .= $this->t('Attach to'); $displays = []; @@ -298,6 +299,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->getOption('displays'), ]; break; + case 'path': $form['path']['#description'] = $this->t('This view will be displayed by visiting this path on your site. It is recommended that the path be something like "path/%/%/feed" or "path/%/%/rss.xml", putting one % in the path for each contextual filter you have defined in the view.'); } @@ -313,6 +315,7 @@ public function submitOptionsForm(&$form, FormStateInterface $form_state) { case 'title': $this->setOption('sitename_title', $form_state->getValue('sitename_title')); break; + case 'displays': $this->setOption($section, $form_state->getValue($section)); break; diff --git a/core/modules/views/src/Plugin/views/display/Page.php b/core/modules/views/src/Plugin/views/display/Page.php index 3816ee179f11579565c65901b554ea86bfeb601a..c36066677f3417fba9fa81e34a251d813f3bbd76 100644 --- a/core/modules/views/src/Plugin/views/display/Page.php +++ b/core/modules/views/src/Plugin/views/display/Page.php @@ -209,9 +209,11 @@ public function optionsSummary(&$categories, &$options) { default: $menu_str = $this->t('No menu'); break; + case 'normal': $menu_str = $this->t('Normal: @title', ['@title' => $menu['title']]); break; + case 'tab': case 'default tab': $menu_str = $this->t('Tab: @title', ['@title' => $menu['title']]); @@ -371,6 +373,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ], ]; break; + case 'tab_options': $form['#title'] .= $this->t('Default tab options'); $tab_options = $this->getOption('tab_options'); @@ -488,6 +491,7 @@ public function submitOptionsForm(&$form, FormStateInterface $form_state) { $form_state->get('view')->addFormToStack('display', $this->display['id'], 'tab_options'); } break; + case 'tab_options': $this->setOption('tab_options', $form_state->getValue('tab_options')); break; diff --git a/core/modules/views/src/Plugin/views/field/FileSize.php b/core/modules/views/src/Plugin/views/field/FileSize.php index c8a0b95681b7b83be5a728050d125d66cc4be4a2..5af1b94a3c4016290a3242bdf1f0ce2976087c72 100644 --- a/core/modules/views/src/Plugin/views/field/FileSize.php +++ b/core/modules/views/src/Plugin/views/field/FileSize.php @@ -49,6 +49,7 @@ public function render(ResultRow $values) { switch ($this->options['file_size_display']) { case 'bytes': return $value; + case 'formatted': default: return format_size($value); diff --git a/core/modules/views/src/Plugin/views/filter/NumericFilter.php b/core/modules/views/src/Plugin/views/filter/NumericFilter.php index 05d0cc89796b75eb1ab3fd9f45aa407c68b56acf..ee39182077a1419aeb9d051c3f932e64ef3ff01a 100644 --- a/core/modules/views/src/Plugin/views/filter/NumericFilter.php +++ b/core/modules/views/src/Plugin/views/filter/NumericFilter.php @@ -428,6 +428,7 @@ public function acceptExposedInput($input) { return FALSE; } break; + case 2: if ($value['min'] === '' && $value['max'] === '') { return FALSE; diff --git a/core/modules/views/src/Plugin/views/sort/Date.php b/core/modules/views/src/Plugin/views/sort/Date.php index 0c7d9e14fc58e78e0be0f1abe7120bbe46f718a8..3deae3ed869eeb6968a5fdf27367b92081a85ac5 100644 --- a/core/modules/views/src/Plugin/views/sort/Date.php +++ b/core/modules/views/src/Plugin/views/sort/Date.php @@ -51,18 +51,23 @@ public function query() { default: $this->query->addOrderBy($this->tableAlias, $this->realField, $this->options['order']); return; + case 'minute': $formula = $this->getDateFormat('YmdHi'); break; + case 'hour': $formula = $this->getDateFormat('YmdH'); break; + case 'day': $formula = $this->getDateFormat('Ymd'); break; + case 'month': $formula = $this->getDateFormat('Ym'); break; + case 'year': $formula = $this->getDateFormat('Y'); break; diff --git a/core/modules/views/src/Views.php b/core/modules/views/src/Views.php index d34380c0787d27e60362a889b63ac3497c00e333..86dcdf7a9a013fe89d04c44c7c0b535bbac6b784 100644 --- a/core/modules/views/src/Views.php +++ b/core/modules/views/src/Views.php @@ -308,6 +308,7 @@ public static function getViewsAsOptions($views_only = FALSE, $filter = 'all', $ $filter = ucfirst($filter); $views = call_user_func("static::get{$filter}Views"); break; + default: return []; } diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php index 71aa2defcc5e63ed9f2dfc1454266b03b8c92603..2d475c97b12769d55eb9e8cc6f93a360f8221b05 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php @@ -135,6 +135,7 @@ public function match($element, $condition) { switch ($condition['operator']) { case '=': return $value == $condition['value']; + case 'IN': return in_array($value, $condition['value']); } diff --git a/core/modules/views/tests/src/Kernel/Handler/SortDateTest.php b/core/modules/views/tests/src/Kernel/Handler/SortDateTest.php index dd408f8786719ab957fbaca229fe8410cc94e2b5..09fc68ca779fdd14fb1deb91e1d6b47c86e1e37c 100644 --- a/core/modules/views/tests/src/Kernel/Handler/SortDateTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/SortDateTest.php @@ -33,6 +33,7 @@ protected function expectedResultSet($granularity, $reverse = TRUE) { ['name' => 'George'], ]; break; + case 'minute': $expected = [ ['name' => 'John'], @@ -42,6 +43,7 @@ protected function expectedResultSet($granularity, $reverse = TRUE) { ['name' => 'George'], ]; break; + case 'hour': $expected = [ ['name' => 'John'], @@ -51,6 +53,7 @@ protected function expectedResultSet($granularity, $reverse = TRUE) { ['name' => 'George'], ]; break; + case 'day': $expected = [ ['name' => 'John'], @@ -60,6 +63,7 @@ protected function expectedResultSet($granularity, $reverse = TRUE) { ['name' => 'George'], ]; break; + case 'month': $expected = [ ['name' => 'John'], @@ -69,6 +73,7 @@ protected function expectedResultSet($granularity, $reverse = TRUE) { ['name' => 'Meredith'], ]; break; + case 'year': $expected = [ ['name' => 'John'], @@ -91,6 +96,7 @@ protected function expectedResultSet($granularity, $reverse = TRUE) { ['name' => 'John'], ]; break; + case 'minute': $expected = [ ['name' => 'George'], @@ -100,6 +106,7 @@ protected function expectedResultSet($granularity, $reverse = TRUE) { ['name' => 'John'], ]; break; + case 'hour': $expected = [ ['name' => 'George'], @@ -109,6 +116,7 @@ protected function expectedResultSet($granularity, $reverse = TRUE) { ['name' => 'John'], ]; break; + case 'day': $expected = [ ['name' => 'George'], @@ -118,6 +126,7 @@ protected function expectedResultSet($granularity, $reverse = TRUE) { ['name' => 'Meredith'], ]; break; + case 'month': $expected = [ ['name' => 'John'], @@ -127,6 +136,7 @@ protected function expectedResultSet($granularity, $reverse = TRUE) { ['name' => 'Meredith'], ]; break; + case 'year': $expected = [ ['name' => 'John'], diff --git a/core/modules/views/tests/src/Kernel/Plugin/StyleGridTest.php b/core/modules/views/tests/src/Kernel/Plugin/StyleGridTest.php index f725d769e646465ead9dc513d143ce15db07fd64..521ab74ed43e28d06cf1939a51e907755577b161 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/StyleGridTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/StyleGridTest.php @@ -71,12 +71,16 @@ protected function assertGrid(ViewExecutable $view, $alignment, $columns) { switch ($columns) { case 5: $width = '20'; break; + case 4: $width = '25'; break; + case 3: $width = '33.3333'; break; + case 2: $width = '50'; break; + case 1: $width = '100'; break; } diff --git a/core/modules/views/views.tokens.inc b/core/modules/views/views.tokens.inc index 9bf5470a660e66d232c9c2e66559f62ce25e397e..915ad807f6ec09f3663540c02dcbbbd3dc9cc2bb 100644 --- a/core/modules/views/views.tokens.inc +++ b/core/modules/views/views.tokens.inc @@ -112,21 +112,27 @@ function views_tokens($type, $tokens, array $data, array $options, BubbleableMet $replacements[$original] = ''; } break; + case 'base-table': $replacements[$original] = $view->storage->get('base_table'); break; + case 'base-field': $replacements[$original] = $view->storage->get('base_field'); break; + case 'total-rows': $replacements[$original] = (int) $view->total_rows; break; + case 'items-per-page': $replacements[$original] = (int) $view->getItemsPerPage(); break; + case 'current-page': $replacements[$original] = (int) $view->getCurrentPage() + 1; break; + case 'page-count': // If there are no items per page, set this to 1 for the division. $per_page = $view->getItemsPerPage() ?: 1; diff --git a/core/modules/views/views.views.inc b/core/modules/views/views.views.inc index 673f342a05b0b9965be5f54e53a7e6f46a9ef1e0..304c0ec51350cdc036b2354ef4553c2e8611d72f 100644 --- a/core/modules/views/views.views.inc +++ b/core/modules/views/views.views.inc @@ -604,6 +604,7 @@ function views_field_default_views_data(FieldStorageConfigInterface $field_stora $filter = 'boolean'; } break; + case 'blob': // It does not make sense to sort by blob. $allow_sort = FALSE; diff --git a/core/modules/views_ui/src/ViewEditForm.php b/core/modules/views_ui/src/ViewEditForm.php index e9d7d33f47d4c4c6a1deca7091622a217669fdd7..2ca08f7e84358b666f09f3b55366d7a9da93e5d5 100644 --- a/core/modules/views_ui/src/ViewEditForm.php +++ b/core/modules/views_ui/src/ViewEditForm.php @@ -978,6 +978,7 @@ public function getFormBucket(ViewUI $view, $type, $display) { // TODO: Add another class to have another symbol for filter rearrange. $class = 'icon compact rearrange'; break; + case 'field': // Fetch the style plugin info so we know whether to list fields or not. $style_plugin = $executable->style_plugin; @@ -991,6 +992,7 @@ public function getFormBucket(ViewUI $view, $type, $display) { return $build; } break; + case 'header': case 'footer': case 'empty': diff --git a/core/modules/views_ui/views_ui.theme.inc b/core/modules/views_ui/views_ui.theme.inc index 69eff489fc4f80fe0e64d2b6482a6a52ed97b7cf..153d3d3544e245dbbfbc3a03a66fccb60833d890 100644 --- a/core/modules/views_ui/views_ui.theme.inc +++ b/core/modules/views_ui/views_ui.theme.inc @@ -495,40 +495,49 @@ function template_preprocess_views_ui_view_preview_section(&$variables) { $variables['title'] = t('Title'); $links = views_ui_view_preview_section_display_category_links($variables['view'], 'title', $variables['title']); break; + case 'header': $variables['title'] = t('Header'); $links = views_ui_view_preview_section_handler_links($variables['view'], $variables['section']); break; + case 'empty': $variables['title'] = t('No results behavior'); $links = views_ui_view_preview_section_handler_links($variables['view'], $variables['section']); break; + case 'exposed': // @todo Sorts can be exposed too, so we may need a better title. $variables['title'] = t('Exposed Filters'); $links = views_ui_view_preview_section_display_category_links($variables['view'], 'exposed_form_options', $variables['title']); break; + case 'rows': // @todo The title needs to depend on what is being viewed. $variables['title'] = t('Content'); $links = views_ui_view_preview_section_rows_links($variables['view']); break; + case 'pager': $variables['title'] = t('Pager'); $links = views_ui_view_preview_section_display_category_links($variables['view'], 'pager_options', $variables['title']); break; + case 'more': $variables['title'] = t('More'); $links = views_ui_view_preview_section_display_category_links($variables['view'], 'use_more', $variables['title']); break; + case 'footer': $variables['title'] = t('Footer'); $links = views_ui_view_preview_section_handler_links($variables['view'], $variables['section']); break; + case 'attachment_before': // @todo: Add links to the attachment configuration page. $variables['title'] = t('Attachment before'); break; + case 'attachment_after': // @todo: Add links to the attachment configuration page. $variables['title'] = t('Attachment after'); diff --git a/core/modules/workspaces/tests/src/Functional/EntityResource/WorkspaceResourceTestBase.php b/core/modules/workspaces/tests/src/Functional/EntityResource/WorkspaceResourceTestBase.php index 031f8c6ae22df467b70a05b3aa44748f4e9a5216..1c35e371dc649ac844277bdb4a36e4f302504120 100644 --- a/core/modules/workspaces/tests/src/Functional/EntityResource/WorkspaceResourceTestBase.php +++ b/core/modules/workspaces/tests/src/Functional/EntityResource/WorkspaceResourceTestBase.php @@ -53,12 +53,15 @@ protected function setUpAuthorization($method) { case 'GET': $this->grantPermissionsToTestedRole(['view any workspace']); break; + case 'POST': $this->grantPermissionsToTestedRole(['create workspace']); break; + case 'PATCH': $this->grantPermissionsToTestedRole(['edit any workspace']); break; + case 'DELETE': $this->grantPermissionsToTestedRole(['delete any workspace']); break; @@ -186,16 +189,16 @@ protected function getExpectedUnauthorizedAccessMessage($method) { switch ($method) { case 'GET': return "The 'view any workspace' permission is required."; - break; + case 'POST': return "The 'create workspace' permission is required."; - break; + case 'PATCH': return "The 'edit any workspace' permission is required."; - break; + case 'DELETE': return "The 'delete any workspace' permission is required."; - break; + } return parent::getExpectedUnauthorizedAccessMessage($method); } diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist index 91b150c4aa582ddc8d28e9585e71e9c6adb2db50..60eb1b427ef469e58d8dbef971e82d25938de65d 100644 --- a/core/phpcs.xml.dist +++ b/core/phpcs.xml.dist @@ -288,6 +288,41 @@ <rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingBeforeClose"> <severity>0</severity> </rule> + <rule ref="Squiz.ControlStructures.SwitchDeclaration" /> + <!-- Disable some error messages that we do not want. --> + <rule ref="Squiz.ControlStructures.SwitchDeclaration.BreakIndent"> + <severity>0</severity> + </rule> + <rule ref="Squiz.ControlStructures.SwitchDeclaration.CaseIndent"> + <severity>0</severity> + </rule> + <rule ref="Squiz.ControlStructures.SwitchDeclaration.CloseBraceAlign"> + <severity>0</severity> + </rule> + <rule ref="Squiz.ControlStructures.SwitchDeclaration.DefaultIndent"> + <severity>0</severity> + </rule> + <rule ref="Squiz.ControlStructures.SwitchDeclaration.DefaultNoBreak"> + <severity>0</severity> + </rule> + <rule ref="Squiz.ControlStructures.SwitchDeclaration.EmptyCase"> + <severity>0</severity> + </rule> + <rule ref="Squiz.ControlStructures.SwitchDeclaration.EmptyDefault"> + <severity>0</severity> + </rule> + <rule ref="Squiz.ControlStructures.SwitchDeclaration.MissingDefault"> + <severity>0</severity> + </rule> + <rule ref="Squiz.ControlStructures.SwitchDeclaration.SpacingAfterCase"> + <severity>0</severity> + </rule> + <rule ref="Squiz.ControlStructures.SwitchDeclaration.SpacingAfterDefaultBreak"> + <severity>0</severity> + </rule> + <rule ref="Squiz.ControlStructures.SwitchDeclaration.SpacingBeforeBreak"> + <severity>0</severity> + </rule> <rule ref="Squiz.Functions.MultiLineFunctionDeclaration"/> <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"> <severity>0</severity> diff --git a/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php index 6835cc3bd02525d3dbdbfd1f318b71c18bc5d96d..4538831bc465d4dfceafb1df97f94e875fdd3d73 100644 --- a/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php +++ b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php @@ -687,28 +687,36 @@ protected function processContent($bundle_machine_name, array $content, $langcod case 'recipe': $structured_content = $this->processRecipe($content, $langcode); break; + case 'article': $structured_content = $this->processArticle($content, $langcode); break; + case 'page': $structured_content = $this->processPage($content, $langcode); break; + case 'banner_block': $structured_content = $this->processBannerBlock($content, $langcode); break; + case 'disclaimer_block': $structured_content = $this->processDisclaimerBlock($content); break; + case 'footer_promo_block': $structured_content = $this->processFooterPromoBlock($content, $langcode); break; + case 'image': $structured_content = $this->processImage($content); break; + case 'recipe_category': case 'tags': $structured_content = $this->processTerm($content, $bundle_machine_name); break; + default: break; } diff --git a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php index be7d6147813b59386d81ca11db774174232e17c6..a5f5fb9e171a45f2dc39ccf59d68cfc3545cd361 100644 --- a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php +++ b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php @@ -237,6 +237,7 @@ public function testLostDatabaseConnection() { case 'mysql': $this->expectedExceptionMessage = $incorrect_username; break; + default: // We can not carry out this test. $this->pass('Unable to run \Drupal\system\Tests\System\UncaughtExceptionTest::testLostDatabaseConnection for this database type.'); diff --git a/core/tests/Drupal/KernelTests/AssertConfigTrait.php b/core/tests/Drupal/KernelTests/AssertConfigTrait.php index 7acab53b06636c7493e178e92f1274609547e29f..f4e04260ce81cf4ce33a63d10256c4e56b492ebe 100644 --- a/core/tests/Drupal/KernelTests/AssertConfigTrait.php +++ b/core/tests/Drupal/KernelTests/AssertConfigTrait.php @@ -30,6 +30,7 @@ protected function assertConfigDiff(Diff $result, $config_name, array $skipped_c case 'Drupal\Component\Diff\Engine\DiffOpCopy': // Nothing to do, a copy is what we expect. break; + case 'Drupal\Component\Diff\Engine\DiffOpDelete': case 'Drupal\Component\Diff\Engine\DiffOpChange': // It is not part of the skipped config, so we can directly throw the @@ -68,6 +69,7 @@ protected function assertConfigDiff(Diff $result, $config_name, array $skipped_c throw new \Exception($config_name . ': ' . var_export($op, TRUE)); } break; + case 'Drupal\Component\Diff\Engine\DiffOpAdd': // The _core property does not exist in the default config. if ($op->closing[0] === '_core:') { @@ -81,6 +83,7 @@ protected function assertConfigDiff(Diff $result, $config_name, array $skipped_c throw new \Exception($config_name . ': ' . var_export($op, TRUE)); } break; + default: throw new \Exception($config_name . ': ' . var_export($op, TRUE)); } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php index 54fb1c572089f8eb60969df41759763f1f6a94ef..75fb5d0c22853bd2000b5ada9a8fa6e25d2c9cba 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php @@ -86,17 +86,20 @@ protected function assertCRUD($entity_type) { $this->assertNotNull($entity->uuid()); $this->assertNotEqual($entity_duplicate->uuid(), $entity->uuid()); break; + case 'id': $this->assertNull($entity_duplicate->id()); $this->assertNotNull($entity->id()); $this->assertNotEqual($entity_duplicate->id(), $entity->id()); break; + case 'revision_id': $this->assertNull($entity_duplicate->getRevisionId()); $this->assertNotNull($entity->getRevisionId()); $this->assertNotEqual($entity_duplicate->getRevisionId(), $entity->getRevisionId()); $this->assertNotEqual($entity_duplicate->{$property}->getValue(), $entity->{$property}->getValue()); break; + default: $this->assertEqual($entity_duplicate->{$property}->getValue(), $entity->{$property}->getValue()); } diff --git a/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php b/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php index 771f7779dfc30f5066fffca9ad68ecd2125d83a9..cbc62397b5ad3b4ac58af4b658a83e0245bf0726 100644 --- a/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php +++ b/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php @@ -353,14 +353,17 @@ public function testManipulations() { $x = 0; $y = 0; break; + case 1: $x = $image->getWidth() - 1; $y = 0; break; + case 2: $x = $image->getWidth() - 1; $y = $image->getHeight() - 1; break; + case 3: $x = 0; $y = $image->getHeight() - 1; diff --git a/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php b/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php index 0a2a74a6e69fe592b402e121d81016d700cb2058..4a243dca74fd3153b33bd509d86408b26384c2e4 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php @@ -127,9 +127,11 @@ protected function setUp() { case 'details': $info = ['#theme_wrappers' => ['details']]; break; + case 'link': $info = ['#theme' => 'link']; break; + default: $info = []; } @@ -155,12 +157,15 @@ protected function setUp() { case 'user.roles': $keys[] = 'r.' . $current_user_role; break; + case 'languages:language_interface': $keys[] = 'en'; break; + case 'theme': $keys[] = 'stark'; break; + default: $keys[] = $context_id; } diff --git a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php index 53d872e710a3fbc7b173f8b93b45287b14e44464..b0cb5be9ca616edbbac2f531f40e46727a5d4615 100644 --- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php @@ -189,10 +189,13 @@ public function aliasManagerCallback() { switch ($args[0]) { case '/test/one': return '/hello/world'; + case '/test/two/5': return '/goodbye/cruel/world'; + case '/<front>': return '/'; + default: return $args[0]; } diff --git a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php index 20f1291ae4b7e870a93895ba9d2ca2e5d6f621cb..716003bf69195abf7282aff3b80779e86c7d6889 100644 --- a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php @@ -452,8 +452,10 @@ public function testGenerateActive() { switch ($name) { case 'test_route_1': return (new GeneratedUrl())->setGeneratedUrl('/test-route-1'); + case 'test_route_3': return (new GeneratedUrl())->setGeneratedUrl('/test-route-3'); + case 'test_route_4': if ($parameters['object'] == '1') { return (new GeneratedUrl())->setGeneratedUrl('/test-route-4/1'); diff --git a/core/tests/Drupal/Tests/TestFileCreationTrait.php b/core/tests/Drupal/Tests/TestFileCreationTrait.php index 3516f2eb8f4c7ab705124572abea56112af32f4b..5bc40fc5ece69d17d73cc7b67bea9d6b7c69f223 100644 --- a/core/tests/Drupal/Tests/TestFileCreationTrait.php +++ b/core/tests/Drupal/Tests/TestFileCreationTrait.php @@ -153,9 +153,11 @@ public static function generateFile($filename, $width, $lines, $type = 'binary-t case 'text': $text .= chr(rand(32, 126)); break; + case 'binary': $text .= chr(rand(0, 31)); break; + case 'binary-text': default: $text .= rand(0, 1); diff --git a/core/tests/Drupal/Tests/UpdatePathTestTrait.php b/core/tests/Drupal/Tests/UpdatePathTestTrait.php index 421f7097f81b78292ce5a16c3c44e703d6b23c35..a1ed2e8af5da6f65587e54b4e2448089f655fc4b 100644 --- a/core/tests/Drupal/Tests/UpdatePathTestTrait.php +++ b/core/tests/Drupal/Tests/UpdatePathTestTrait.php @@ -66,6 +66,7 @@ protected function runUpdates($update_url = NULL) { case 'update': $all_updates = update_get_update_list(); break; + case 'post_update': $all_updates = \Drupal::service('update.post_update_registry')->getPendingUpdateInformation(); break;