Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html1/bbp/web/modules/contrib/migrate_plus/tests/src/Unit/process/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : /var/www/html1/bbp/web/modules/contrib/migrate_plus/tests/src/Unit/process/DomTest.php

<?php

namespace Drupal\Tests\migrate_plus\Unit\process;

use Drupal\Component\Utility\Html;
use Drupal\migrate\MigrateException;
use Drupal\migrate_plus\Plugin\migrate\process\Dom;
use Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase;

/**
 * Tests the dom process plugin.
 *
 * @group migrate
 * @coversDefaultClass \Drupal\migrate_plus\Plugin\migrate\process\Dom
 */
class DomTest extends MigrateProcessTestCase {

  /**
   * @covers ::__construct
   */
  public function testConfigMethodEmpty(): void {
    $configuration = [];
    $value = '<p>A simple paragraph.</p>';
    $this->expectException(\InvalidArgumentException::class);
    $this->expectExceptionMessage('The "method" must be set.');
    (new Dom($configuration, 'dom', []))
      ->transform($value, $this->migrateExecutable, $this->row, 'destinationproperty');
  }

  /**
   * @covers ::__construct
   */
  public function testConfigMethodInvalid(): void {
    $configuration['method'] = 'invalid';
    $value = '<p>A simple paragraph.</p>';
    $this->expectException(\InvalidArgumentException::class);
    $this->expectExceptionMessage('The "method" must be "import" or "export".');
    (new Dom($configuration, 'dom', []))
      ->transform($value, $this->migrateExecutable, $this->row, 'destinationproperty');
  }

  /**
   * @covers ::import
   */
  public function testImportNonRoot(): void {
    $configuration['method'] = 'import';
    $value = '<p>A simple paragraph.</p>';
    $document = (new Dom($configuration, 'dom', []))
      ->transform($value, $this->migrateExecutable, $this->row, 'destinationproperty');
    $this->assertTrue($document instanceof \DOMDocument);
  }

  /**
   * @covers ::import
   */
  public function testImportNonRootInvalidInput(): void {
    $configuration['method'] = 'import';
    $value = [1, 1];
    $this->expectException(MigrateException::class);
    $this->expectExceptionMessage('Cannot import a non-string value.');
    (new Dom($configuration, 'dom', []))
      ->transform($value, $this->migrateExecutable, $this->row, 'destinationproperty');
  }

  /**
   * @covers ::export
   */
  public function testExportNonRoot(): void {
    $configuration['method'] = 'export';
    $partial = '<p>A simple paragraph.</p>';
    $document = Html::load($partial);
    $value = (new Dom($configuration, 'dom', []))
      ->transform($document, $this->migrateExecutable, $this->row, 'destinationproperty');
    $this->assertEquals($value, $partial);
  }

  /**
   * @covers ::export
   */
  public function testExportNonRootInvalidInput(): void {
    $configuration['method'] = 'export';
    $this->expectException(MigrateException::class);
    $this->expectExceptionMessage('Cannot export a "string".');
    (new Dom($configuration, 'dom', []))
      ->transform('string is not DOMDocument', $this->migrateExecutable, $this->row, 'destinationproperty');
  }

}

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net