startCollectingMessages example


  public function testNoCommentTypeMigration(array $disabled_source_modules, array $expected_messages) {
    if (!empty($disabled_source_modules)) {
      $this->sourceDatabase->update('system')
        ->condition('name', $disabled_source_modules, 'IN')
        ->fields(['status' => 0])
        ->execute();
    }

    $this->startCollectingMessages();
    $this->migrateCommentTypes();

    $expected_messages += [
      'status' => [],
      'warning' => [],
      'error' => [],
    ];
    $actual_messages = $this->migrateMessages + [
      'status' => [],
      'warning' => [],
      'error' => [],
    ];

  public function testNoCommentTypeMigration(array $disabled_source_modules, array $expected_messages) {
    if (!empty($disabled_source_modules)) {
      $this->sourceDatabase->update('system')
        ->condition('name', $disabled_source_modules, 'IN')
        ->fields(['status' => 0])
        ->execute();
    }

    $this->startCollectingMessages();
    $this->executeMigration('d6_comment_type');

    $expected_messages += [
      'status' => [],
      'warning' => [],
      'error' => [],
    ];
    $actual_messages = $this->migrateMessages + [
      'status' => [],
      'warning' => [],
      'error' => [],
    ];
/** * {@inheritdoc} */
  protected static $modules = ['language'];

  /** * Tests language_default migration with a non-existing language. */
  public function testMigrationWithExistingLanguage() {
    $this->setDefaultLanguage('is');
    $this->startCollectingMessages();
    $this->executeMigrations(['language', 'default_language']);

    // Tests the language is loaded and is the default language.     $default_language = ConfigurableLanguage::load('is');
    $this->assertNotNull($default_language);
    $this->assertSame('is', $this->config('system.site')->get('default_langcode'));
  }

  /** * Tests language_default migration with a non-existing language. */
  

class MigrateUserRoleTest extends MigrateDrupal6TestBase {

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->startCollectingMessages();
  }

  /** * Assert the logged migrate messages. * * @param string[][] $role_data * An array of role data keyed by the destination role id. The role data * contains the source role id, an array of valid permissions and an array * of invalid permissions. * @param \Drupal\migrate\Plugin\MigrateIdMapInterface $id_map * The migration ID map plugin. */
'content_translation',
    'language',
    'node',
    'text',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->startCollectingMessages();
    $this->migrateCommentTypes();
    $this->executeMigrations([
      'language',
      'd7_language_content_comment_settings',
    ]);
  }

  /** * {@inheritdoc} */
  public static function migrateDumpAlter(KernelTestBase $test) {
    
/** * {@inheritdoc} */
  protected static $modules = ['language'];

  /** * Tests language_default migration with an existing language. */
  public function testMigrationWithExistingLanguage() {
    $this->setDefaultLanguage('fr');
    $this->startCollectingMessages();
    $this->executeMigrations(['language', 'default_language']);

    // Tests the language is loaded and is the default language.     $default_language = ConfigurableLanguage::load('fr');
    $this->assertNotNull($default_language);
    $this->assertSame('fr', $this->config('system.site')->get('default_langcode'));
  }

  /** * Tests language_default migration with a non-existing language. */
  
'action',
        'data',
      ])
      ->values([
        'presetid' => '1',
        'weight' => '0',
        'module' => 'imagecache',
        'action' => 'imagecache_deprecated_scale',
        'data' => 'a:3:{s:3:"fit";s:7:"outside";s:5:"width";s:3:"200";s:6:"height";s:3:"200";}',
      ])->execute();

    $this->startCollectingMessages();
    $this->executeMigration('d6_imagecache_presets');
    $messages = iterator_to_array($this->migration->getIdMap()->getMessages());
    $this->assertCount(1, $messages);
    $this->assertStringContainsString('The "image_deprecated_scale" plugin does not exist.', $messages[0]->message);
    $this->assertEquals(MigrationInterface::MESSAGE_ERROR, $messages[0]->level);
  }

  /** * Tests that missing action's causes failures. */
  public function testInvalidCropValues() {
    
'content_translation',
    'language',
    'node',
    'text',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->startCollectingMessages();
    $this->migrateCommentTypes();
    $this->executeMigrations([
      'language',
      'd7_language_content_comment_settings',
    ]);
  }

  /** * Tests migration of content language settings. */
  public function testLanguageCommentSettings() {
    

  protected function setUp(): void {
    parent::setUp();
    $this->installSchema('ban', ['ban_ip']);
  }

  /** * Tests migration of blocked IPs. */
  public function testBlockedIps() {
    $this->startCollectingMessages();
    $this->executeMigration('d7_blocked_ips');
    $this->assertEmpty($this->migrateMessages);
    $this->assertTrue(\Drupal::service('ban.ip_manager')->isBanned('111.111.111.111'));
  }

}
Home | Imprint | This part of the site doesn't use cookies.