getMessages example

// User reference to entity reference migration.     $field_storage = FieldStorageConfig::load('node.field_user_reference');
    $this->assertSame('entity_reference', $field_storage->getType());
    $this->assertSame('user', $field_storage->getSetting('target_type'));

    // Validate that the source count and processed count match up.     /** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
    $migration = $this->getMigration('d6_field');
    $this->assertSame($migration->getSourcePlugin()->count()$migration->getIdMap()->processedCount());

    // Check that we've reported on a conflict in widget_types.     $messages = iterator_to_array($migration->getIdMap()->getMessages());
    $this->assertCount(1, $messages);
    $this->assertSame($messages[0]->message, 'Widget types optionwidgets_onoff, text_textfield are used in Drupal 6 field instances: widget type optionwidgets_onoff applied to the Drupal 8 base field');
  }

}

    public function __construct($host = '127.0.0.1', $port = null)
    {
        $this->_validHost = new Zend_Validate();
        $this->_validHost->addValidator(new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_ALL));

        if (!$this->_validHost->isValid($host)) {
            /** * @see Zend_Mail_Protocol_Exception */
            throw new Zend_Mail_Protocol_Exception(join(', ', $this->_validHost->getMessages()));
        }

        $this->_host = $host;
        $this->_port = $port;
    }


    /** * Class destructor to cleanup open resources * * @return void */
$i = 1;
    foreach ($data as $datum) {
      $this->executable->sourceIdValues = ['id' => $i++];

      // Test the input value is not altered.       $new_value = $this->logPlugin->transform($datum['value']$this->executable, new Row(), 'foo');
      $this->assertSame($datum['value']$new_value);

      // Test the stored message.       $message = $this->executable->getIdMap()
        ->getMessages($this->executable->sourceIdValues)
        ->fetchAllAssoc('message');
      $actual_message = key($message);
      $this->assertSame($datum['expected_message']$actual_message);
    }
  }

}

/** * MigrateExecutable test class. */
/** * {@inheritdoc} */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $view = $form_state->get('view');

    $form['#title'] = $this->t('View analysis');
    $form['#section'] = 'analyze';

    $analyzer = Views::analyzer();
    $messages = $analyzer->getMessages($view->getExecutable());

    $form['analysis'] = [
      '#prefix' => '<div class="js-form-item form-item">',
      '#suffix' => '</div>',
      '#markup' => $analyzer->formatMessages($messages),
    ];

    // Inform the standard button function that we want an OK button.     $form_state->set('ok_button', TRUE);
    $view->getStandardButtons($form$form_state, 'views_ui_analyze_view_form');
    return $form;
  }
$this->assertNull(FieldConfig::load('node.article.field_text_plain_filtered'));
    $this->assertNull(FieldConfig::load('node.page.field_text_long_plain_filtered'));
    $this->assertNull(FieldConfig::load('node.article.field_text_long_plain_filtered'));
    $this->assertNull(FieldConfig::load('node.page.field_text_sum_plain_filtered'));
    $this->assertNull(FieldConfig::load('node.article.field_text_sum_plain_filtered'));

    // For each text field instances that were skipped, there should be a log     // message with the required steps to fix this.     $migration = $this->getMigration('d7_field_instance');
    $errors = array_map(function D$message) {
      return $message->message;
    }iterator_to_array($migration->getIdMap()->getMessages()));
    $this->assertCount(8, $errors);
    sort($errors);
    $message = 'd7_field_instance:type: Can\'t migrate source field field_text_long_plain_filtered configured with both plain text and filtered text processing. See https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#plain-text';
    $this->assertEquals($errors[0]$message);
    $this->assertEquals($errors[1]$message);
    $message = 'd7_field_instance:type: Can\'t migrate source field field_text_plain_filtered configured with both plain text and filtered text processing. See https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#plain-text';
    $this->assertEquals($errors[2]$message);
    $this->assertEquals($errors[3]$message);
    $message = 'd7_field_instance:type: Can\'t migrate source field field_text_sum_plain of type text_with_summary configured with plain text processing. See https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#plain-text';
    $this->assertEquals($errors[4]$message);
    $this->assertEquals($errors[5]$message);
    
public function isValid($value)
    {
        $this->_messages = array();
        $this->_errors   = array();
        $result = true;
        foreach ($this->_validators as $element) {
            $validator = $element['instance'];
            if ($validator->isValid($value)) {
                continue;
            }
            $result = false;
            $messages = $validator->getMessages();
            $this->_messages = array_merge($this->_messages, $messages);
            $this->_errors   = array_merge($this->_errors,   array_keys($messages));
            if ($element['breakChainOnFailure']) {
                break;
            }
        }
        return $result;
    }

    /** * Defined by Zend_Validate_Interface * * Returns array of validation failure messages * * @return array */
/** * @return void */
    protected function extractTemplate(string $template, MessageCatalogue $catalogue)
    {
        $visitor = $this->twig->getExtension(TranslationExtension::class)->getTranslationNodeVisitor();
        $visitor->enable();

        $this->twig->parse($this->twig->tokenize(new Source($template, '')));

        foreach ($visitor->getMessages() as $message) {
            $catalogue->set(trim($message[0])$this->prefix.trim($message[0])$message[1] ?: $this->defaultDomain);
        }

        $visitor->disable();
    }

    protected function canBeExtracted(string $file): bool
    {
        return $this->isFile($file) && 'twig' === pathinfo($file, \PATHINFO_EXTENSION);
    }

    
$yield = false;
            } elseif ($time == $lastTime && $index <= $lastIndex) {
                $yield = false;
            }

            if ($nextTime = $trigger->getNextRunDate($time)) {
                $heap->insert([$nextTime$index$recurringMessage]);
            }

            if ($yield) {
                $context = new MessageContext($this->name, $id$trigger$time$nextTime);
                foreach ($recurringMessage->getMessages($context) as $message) {
                    yield $context => $message;
                }

                $checkpoint->save($time$index);
            }
        }

        $this->waitUntil = $heap->isEmpty() ? null : $heap->top()[0];

        $checkpoint->release($now$this->waitUntil);
    }

    
$options['locale'] = array_shift($args);
            }

            if (!empty($args)) {
                $options += array_shift($args);
            }
        }

        if (($options['content'] instanceof Zend_Translate) || ($options['content'] instanceof Zend_Translate_Adapter)) {
            $options['usetranslateadapter'] = true;
            if (!empty($options['locale']) && ($options['locale'] !== 'auto')) {
                $options['content'] = $options['content']->getMessages($options['locale']);
            } else {
                $content = $options['content'];
                $locales = $content->getList();
                foreach ($locales as $locale) {
                    $options['locale']  = $locale;
                    $options['content'] = $content->getMessages($locale);
                    $this->_addTranslationData($options);
                }

                return $this;
            }
        }
$this->getContainer()->get(ThumbnailService::class),
            $this->mediaRepository,
            $this->mediaFolderRepository,
            $messageBusMock,
        );

        $this->runCommand($commandnew StringInput('--strict --async')$output);
        $this->runCommand($commandnew StringInput('--async')$output);
        $this->runCommand($commandnew StringInput('--async')$output);
        $this->runCommand($commandnew StringInput('--strict --async')$output);

        $envelopes = $messageBusMock->getMessages();
        static::assertCount(4, $envelopes);

        static::assertEquals($expectedMessageStrict$envelopes[0]->getMessage());
        static::assertEquals($expectedMessageNonStrict$envelopes[1]->getMessage());
        static::assertEquals($expectedMessageNonStrict$envelopes[2]->getMessage());
        static::assertEquals($expectedMessageStrict$envelopes[3]->getMessage());
    }

    protected function assertThumbnailExists(MediaEntity $media, MediaThumbnailEntity $thumbnail): void
    {
        $thumbnailPath = $this->urlGenerator->getRelativeThumbnailUrl(
            
    // changed to filter_null.     $this->assertEntity('php_code', 'PHP code', ['filter_null' => 0], 11, FALSE);

    // Test a non-existent format.     $this->assertEntity('image_resize_filter', 'Image resize', [], 0, TRUE);

    // For each filter that does not exist on the destination, there should be     // a log message.     $migration = $this->getMigration('d7_filter_format');
    $errors = array_map(function D$message) {
      return $message->message;
    }iterator_to_array($migration->getIdMap()->getMessages()));
    $this->assertCount(2, $errors);
    sort($errors);
    $message = 'Filter image_resize_filter could not be mapped to an existing filter plugin; omitted since it is a transformation-only filter. Install and configure a successor after the migration.';
    $this->assertEquals($errors[0]$message);
    $message = ('Filter php_code could not be mapped to an existing filter plugin; defaulting to filter_null and dropping all settings. Either redo the migration with the module installed that provides an equivalent filter, or modify the text format after the migration to remove this filter if it is no longer necessary.');
    $this->assertEquals($errors[1]$message);
  }

}
new MessageCatalogue('en', ['b' => [], 'c' => []])
            )->getDomains()
        );
    }

    public function testGetMessagesFromUnknownDomain()
    {
        $this->expectException(\InvalidArgumentException::class);
        $this->createOperation(
            new MessageCatalogue('en'),
            new MessageCatalogue('en')
        )->getMessages('domain');
    }

    public function testGetEmptyMessages()
    {
        $this->assertEquals(
            [],
            $this->createOperation(
                new MessageCatalogue('en', ['a' => []]),
                new MessageCatalogue('en')
            )->getMessages('a')
        );
    }
$resultMessage = 'Translation files were successfully updated';

        $operation->moveMessagesToIntlDomainsIfPossible('new');

        // show compiled list of messages         if (true === $input->getOption('dump-messages')) {
            $extractedMessagesCount = 0;
            $io->newLine();
            foreach ($operation->getDomains() as $domain) {
                $newKeys = array_keys($operation->getNewMessages($domain));
                $allKeys = array_keys($operation->getMessages($domain));

                $list = array_merge(
                    array_diff($allKeys$newKeys),
                    array_map(fn ($id) => sprintf('<fg=green>%s</>', $id)$newKeys),
                    array_map(fn ($id) => sprintf('<fg=red>%s</>', $id)array_keys($operation->getObsoleteMessages($domain)))
                );

                $domainMessagesCount = \count($list);

                if ($sort = $input->getOption('sort')) {
                    $sort = strtolower($sort);
                    
/** * @see Zend_Mail_Protocol_Exception */
            throw new Zend_Mail_Protocol_Exception('Cannot issue HELO to existing session');
        }

        // Validate client hostname         if (!$this->_validHost->isValid($host)) {
            /** * @see Zend_Mail_Protocol_Exception */
            throw new Zend_Mail_Protocol_Exception(join(', ', $this->_validHost->getMessages()));
        }

        // Initiate helo sequence         $this->_expect(220, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2         $this->_ehlo($host);

        // If a TLS session is required, commence negotiation         if ($this->_secure == 'tls') {
            $this->_send('STARTTLS');
            $this->_expect(220, 180);
            if (!stream_socket_enable_crypto($this->_socket, true, $this->getCryptoMethod())) {
                
foreach ($this->catalogues as $locale => $catalogue) {
            if (null === $intersectCatalogue = $intersectBag->getCatalogue($locale)) {
                continue;
            }

            $operation = new TargetOperation($catalogue$intersectCatalogue);
            $operation->moveMessagesToIntlDomainsIfPossible(AbstractOperation::OBSOLETE_BATCH);
            $obsoleteCatalogue = new MessageCatalogue($locale);

            foreach ($operation->getDomains() as $domain) {
                $obsoleteCatalogue->add(
                    array_diff($operation->getMessages($domain)$operation->getNewMessages($domain)),
                    $domain
                );
            }

            $diff->addCatalogue($obsoleteCatalogue);
        }

        return $diff;
    }
}
Home | Imprint | This part of the site doesn't use cookies.