Skip to content
Snippets Groups Projects
Commit 9a030ab9 authored by catch's avatar catch
Browse files

Issue #3497405 by quietone, nod_: Fix DrupalPractice.Objects.GlobalFunction in tests

parent de85d081
Branches
Tags
6 merge requests!11197Issue #3506427 by eduardo morales alberti: Remove responsive_image.ajax from hook,!5423Draft: Resolve #3329907 "Test2",!3478Issue #3337882: Deleted menus are not removed from content type config,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!579Issue #2230909: Simple decimals fail to pass validation
Pipeline #415440 passed with warnings
Pipeline: drupal

#415456

    Pipeline: drupal

    #415448

      Pipeline: drupal

      #415445

        Showing
        with 49 additions and 46 deletions
        ......@@ -19,7 +19,7 @@ class BlockTestHooks {
        #[Hook('block_alter')]
        public function blockAlter(&$block_info): void {
        if (\Drupal::state()->get('block_test_info_alter') && isset($block_info['test_block_instantiation'])) {
        $block_info['test_block_instantiation']['category'] = t('Custom category');
        $block_info['test_block_instantiation']['category'] = 'Custom category';
        }
        }
        ......
        ......@@ -46,7 +46,7 @@ public function commentLinksAlter(array &$links, CommentInterface &$entity, arra
        ],
        '#links' => [
        'comment-report' => [
        'title' => t('Report'),
        'title' => 'Report',
        'url' => Url::fromRoute('comment_test.report', [
        'comment' => $entity->id(),
        ], [
        ......
        ......@@ -81,7 +81,7 @@ public function form(array $form, FormStateInterface $form_state) {
        ];
        $form['size_wrapper']['size_submit'] = [
        '#type' => 'submit',
        '#value' => t('Change size'),
        '#value' => 'Change size',
        '#attributes' => [
        'class' => ['js-hide'],
        ],
        ......@@ -101,7 +101,7 @@ public function form(array $form, FormStateInterface $form_state) {
        $form['langcode'] = [
        '#type' => 'language_select',
        '#title' => t('Language'),
        '#title' => 'Language',
        '#languages' => LanguageInterface::STATE_ALL,
        '#default_value' => $entity->language()->getId(),
        ];
        ......
        ......@@ -18,8 +18,8 @@ class ConfigTestListBuilder extends ConfigEntityListBuilder {
        * {@inheritdoc}
        */
        public function buildHeader() {
        $header['label'] = t('Label');
        $header['id'] = t('Machine name');
        $header['label'] = 'Label';
        $header['id'] = 'Machine name';
        return $header + parent::buildHeader();
        }
        ......
        ......@@ -22,7 +22,7 @@ class ContactStorageTestHooks {
        public function entityBaseFieldInfo(EntityTypeInterface $entity_type): array {
        $fields = [];
        if ($entity_type->id() == 'contact_message') {
        $fields['id'] = BaseFieldDefinition::create('integer')->setLabel(t('Message ID'))->setDescription(t('The message ID.'))->setReadOnly(TRUE)->setSetting('unsigned', TRUE);
        $fields['id'] = BaseFieldDefinition::create('integer')->setLabel('Message ID')->setDescription('The message ID.')->setReadOnly(TRUE)->setSetting('unsigned', TRUE);
        }
        return $fields;
        }
        ......@@ -51,8 +51,8 @@ public function formContactFormFormAlter(&$form, FormStateInterface $form_state)
        $contact_form = $form_state->getFormObject()->getEntity();
        $form['send_a_pony'] = [
        '#type' => 'checkbox',
        '#title' => t('Send submitters a voucher for a free pony.'),
        '#description' => t('Enable to send an additional email with a free pony voucher to anyone who submits the form.'),
        '#title' => 'Send submitters a voucher for a free pony.',
        '#description' => 'Enable to send an additional email with a free pony voucher to anyone who submits the form.',
        '#default_value' => $contact_form->getThirdPartySetting('contact_storage_test', 'send_a_pony', FALSE),
        ];
        $form['#entity_builders'][] = [$this, 'contactFormBuilder'];
        ......
        ......@@ -36,16 +36,16 @@ public function viewsQueryAlter(ViewExecutable $view, QueryPluginBase $query): v
        public function viewsDataAlter(array &$data): void {
        if (isset($data['users_field_data'])) {
        $data['users_field_data']['uid_revision_test'] = [
        'help' => t('Relate the content revision to the user who created it.'),
        'help' => 'Relate the content revision to the user who created it.',
        'real field' => 'uid',
        'relationship' => [
        'title' => t('Content revision authored'),
        'help' => t('Relate the content revision to the user who created it. This relationship will create one record for each content revision item created by the user.'),
        'title' => 'Content revision authored',
        'help' => 'Relate the content revision to the user who created it. This relationship will create one record for each content revision item created by the user.',
        'id' => 'standard',
        'base' => 'node_field_revision',
        'base field' => 'uid',
        'field' => 'uid',
        'label' => t('node revisions'),
        'label' => 'node revisions',
        ],
        ];
        }
        ......
        ......@@ -110,10 +110,7 @@ public function entityBundleFieldInfoAlter(&$fields, EntityTypeInterface $entity
        $fields[$field_name]->setPropertyConstraints('value', [
        'TestField' => [
        'value' => -2,
        'message' => t('%name does not accept the value @value.', [
        '%name' => $field_name,
        '@value' => -2,
        ]),
        'message' => "$field_name does not accept the value -2.",
        ],
        ]);
        // Add a property constraint using
        ......
        ......@@ -22,7 +22,7 @@ class FieldThirdPartyTestHooks {
        public function fieldWidgetThirdPartySettingsForm(WidgetInterface $plugin, FieldDefinitionInterface $field_definition, $form_mode, $form, FormStateInterface $form_state): array {
        $element['field_test_widget_third_party_settings_form'] = [
        '#type' => 'textfield',
        '#title' => t('3rd party widget settings form'),
        '#title' => '3rd party widget settings form',
        '#default_value' => $plugin->getThirdPartySetting('field_third_party_test', 'field_test_widget_third_party_settings_form'),
        ];
        return $element;
        ......@@ -43,7 +43,7 @@ public function fieldWidgetSettingsSummaryAlter(&$summary, $context): void {
        public function fieldFormatterThirdPartySettingsForm(FormatterInterface $plugin, FieldDefinitionInterface $field_definition, $view_mode, $form, FormStateInterface $form_state): array {
        $element['field_test_field_formatter_third_party_settings_form'] = [
        '#type' => 'textfield',
        '#title' => t('3rd party formatter settings form'),
        '#title' => '3rd party formatter settings form',
        '#default_value' => $plugin->getThirdPartySetting('field_third_party_test', 'field_test_field_formatter_third_party_settings_form'),
        ];
        return $element;
        ......
        ......@@ -25,14 +25,14 @@ public static function getType() {
        * {@inheritdoc}
        */
        public function getName() {
        return t('Dummy external stream wrapper (readonly)');
        return 'Dummy external stream wrapper (readonly)';
        }
        /**
        * {@inheritdoc}
        */
        public function getDescription() {
        return t('Dummy external read-only stream wrapper for testing.');
        return 'Dummy external read-only stream wrapper for testing.';
        }
        /**
        ......
        ......@@ -17,14 +17,14 @@ class DummyReadOnlyStreamWrapper extends LocalReadOnlyStream {
        * {@inheritdoc}
        */
        public function getName() {
        return t('Dummy files (readonly)');
        return 'Dummy files (readonly)';
        }
        /**
        * {@inheritdoc}
        */
        public function getDescription() {
        return t('Dummy wrapper for testing (readonly).');
        return 'Dummy wrapper for testing (readonly).';
        }
        public function getDirectoryPath() {
        ......
        ......@@ -22,14 +22,14 @@ public static function getType() {
        * {@inheritdoc}
        */
        public function getName() {
        return t('Dummy remote read-only files');
        return 'Dummy remote read-only files';
        }
        /**
        * {@inheritdoc}
        */
        public function getDescription() {
        return t('Dummy remote read-only stream wrapper for testing.');
        return 'Dummy remote read-only stream wrapper for testing.';
        }
        }
        ......@@ -19,14 +19,14 @@ class DummyRemoteStreamWrapper extends PublicStream {
        * {@inheritdoc}
        */
        public function getName() {
        return t('Dummy files (remote)');
        return 'Dummy files (remote)';
        }
        /**
        * {@inheritdoc}
        */
        public function getDescription() {
        return t('Dummy wrapper for testing (remote).');
        return 'Dummy wrapper for testing (remote).';
        }
        public function realpath() {
        ......
        ......@@ -17,14 +17,14 @@ class DummyStreamWrapper extends LocalStream {
        * {@inheritdoc}
        */
        public function getName() {
        return t('Dummy files');
        return 'Dummy files';
        }
        /**
        * {@inheritdoc}
        */
        public function getDescription() {
        return t('Dummy wrapper for testing.');
        return 'Dummy wrapper for testing.';
        }
        public function getDirectoryPath() {
        ......
        ......@@ -21,10 +21,10 @@ public function help($route_name, RouteMatchInterface $route_match) {
        case 'help.page.help_page_test':
        // Make the help text conform to core standards. See
        // \Drupal\system\Tests\Functional\GenericModuleTestBase::assertHookHelp().
        return t('Read the <a href=":url">online documentation for the Help Page Test module</a>.', [':url' => 'http://www.example.com']);
        return 'Read the <a href="http://www.example.com">online documentation for the Help Page Test module</a>.';
        case 'help_page_test.has_help':
        return t('I have help!');
        return 'I have help!';
        case 'help_page_test.test_array':
        return ['#markup' => 'Help text from help_page_test_help module.'];
        ......
        ......@@ -4,6 +4,7 @@
        namespace Drupal\language_test\Hook;
        use Drupal\Core\StringTranslation\StringTranslationTrait;
        use Drupal\Core\Url;
        use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI;
        use Drupal\Core\Language\LanguageInterface;
        ......@@ -14,6 +15,8 @@
        */
        class LanguageTestHooks {
        use StringTranslationTrait;
        /**
        * Implements hook_page_top().
        */
        ......@@ -21,7 +24,7 @@ class LanguageTestHooks {
        public function pageTop(): void {
        if (\Drupal::moduleHandler()->moduleExists('language')) {
        $this->storeLanguageNegotiation();
        \Drupal::messenger()->addStatus(t('Language negotiation method: @name', [
        \Drupal::messenger()->addStatus($this->t('Language negotiation method: @name', [
        '@name' => \Drupal::languageManager()->getNegotiatedLanguageMethod() ?? 'Not defined',
        ]));
        }
        ......@@ -35,8 +38,8 @@ public function languageTypesInfo(): array {
        if (\Drupal::keyValue('language_test')->get('language_types')) {
        return [
        'test_language_type' => [
        'name' => t('Test'),
        'description' => t('A test language type.'),
        'name' => $this->t('Test'),
        'description' => $this->t('A test language type.'),
        ],
        'fixed_test_language_type' => [
        'fixed' => [
        ......
        ......@@ -17,8 +17,8 @@ class LayoutBuilderExtraFieldTestHooks {
        #[Hook('entity_extra_field_info')]
        public function entityExtraFieldInfo(): array {
        $extra['node']['bundle_with_section_field']['display']['layout_builder_extra_field_test'] = [
        'label' => t('New Extra Field'),
        'description' => t('New Extra Field description'),
        'label' => 'New Extra Field',
        'description' => 'New Extra Field description',
        'weight' => 0,
        ];
        return $extra;
        ......
        ......@@ -47,13 +47,13 @@ public function pluginFilterBlockLayoutBuilderAlter(array &$definitions, array $
        #[Hook('entity_extra_field_info')]
        public function entityExtraFieldInfo(): array {
        $extra['node']['bundle_with_section_field']['display']['layout_builder_test'] = [
        'label' => t('Extra label'),
        'description' => t('Extra description'),
        'label' => 'Extra label',
        'description' => 'Extra description',
        'weight' => 0,
        ];
        $extra['node']['bundle_with_section_field']['display']['layout_builder_test_2'] = [
        'label' => t('Extra Field 2'),
        'description' => t('Extra Field 2 description'),
        'label' => 'Extra Field 2',
        'description' => 'Extra Field 2 description',
        'weight' => 0,
        'visible' => FALSE,
        ];
        ......
        ......@@ -22,7 +22,7 @@ class LinkTestBaseFieldHooks {
        public function entityBaseFieldInfo(EntityTypeInterface $entity_type): array {
        $fields = [];
        if ($entity_type->id() === 'entity_test') {
        $fields['links'] = BaseFieldDefinition::create('link')->setLabel(t('Links'))->setRevisionable(TRUE)->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)->setDescription(t('Add links to the entity.'))->setRequired(FALSE)->setSettings([
        $fields['links'] = BaseFieldDefinition::create('link')->setLabel('Links')->setRevisionable(TRUE)->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)->setDescription('Add links to the entity.')->setRequired(FALSE)->setSettings([
        'link_type' => LinkItemInterface::LINK_GENERIC,
        'title' => DRUPAL_REQUIRED,
        ])->setDisplayOptions('form', ['type' => 'link_default', 'weight' => 49]);
        ......
        ......@@ -5,6 +5,7 @@
        namespace Drupal\locale_test\Hook;
        use Drupal\Core\StreamWrapper\PublicStream;
        use Drupal\Core\StringTranslation\StringTranslationTrait;
        use Drupal\Core\Url;
        use Drupal\Core\Extension\Extension;
        use Drupal\Core\Hook\Attribute\Hook;
        ......@@ -14,6 +15,8 @@
        */
        class LocaleTestHooks {
        use StringTranslationTrait;
        /**
        * Implements hook_system_info_alter().
        *
        ......@@ -176,9 +179,9 @@ public function theme() : array {
        #[Hook('token_info')]
        public function tokenInfo(): array {
        $info = [];
        $info['types']['locale_test'] = ['name' => t('Locale test'), 'description' => t('Locale test')];
        $info['tokens']['locale_test']['security_test1'] = ['type' => 'text', 'name' => t('Security test 1')];
        $info['tokens']['locale_test']['security_test2'] = ['type' => 'text', 'name' => t('Security test 2')];
        $info['types']['locale_test'] = ['name' => $this->t('Locale test'), 'description' => $this->t('Locale test')];
        $info['tokens']['locale_test']['security_test1'] = ['type' => 'text', 'name' => $this->t('Security test 1')];
        $info['tokens']['locale_test']['security_test2'] = ['type' => 'text', 'name' => $this->t('Security test 2')];
        return $info;
        }
        ......
        ......@@ -23,7 +23,7 @@ public function entityOperationAlter(array &$operations, EntityInterface $entity
        return;
        }
        // Alter the title of the edit link appearing in operations menu.
        $operations['edit']['title'] = t('Altered Edit Title');
        $operations['edit']['title'] = 'Altered Edit Title';
        }
        /**
        ......@@ -35,7 +35,7 @@ public function entityOperation(EntityInterface $entity): array {
        return [];
        }
        $operations['custom_operation'] = [
        'title' => t('Custom Home'),
        'title' => 'Custom Home',
        'weight' => 20,
        'url' => Url::fromRoute('<front>'),
        ];
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment