Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/store1/web/core/modules/language/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/html/store1/web/core/modules/language/tests/src/Unit/process/LanguageNegotiationTest.php

<?php

namespace Drupal\Tests\language\Unit\process;

use Drupal\language\Plugin\migrate\process\LanguageNegotiation;
use Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase;
use Drupal\migrate\MigrateException;

/**
 * @coversDefaultClass \Drupal\language\Plugin\migrate\process\LanguageNegotiation
 * @group language
 */
class LanguageNegotiationTest extends MigrateProcessTestCase {

  /**
   * {@inheritdoc}
   */
  protected function setUp(): void {
    $this->plugin = new LanguageNegotiation([], 'map', []);
    parent::setUp();
  }

  /**
   * Tests successful transformation without weights.
   */
  public function testTransformWithWeights() {
    $source = [
      [
        'locale-url' => [],
        'language-default' => [],
      ],
      [
        'locale-url' => -10,
        'locale-session' => -9,
        'locale-user' => -8,
        'locale-browser' => -7,
        'language-default' => -6,
      ],
    ];
    $expected = [
      'enabled' => [
        'language-url' => -10,
        'language-selected' => -6,
      ],
      'method_weights' => [
        'language-url' => -10,
        'language-session' => -9,
        'language-user' => -8,
        'language-browser' => -7,
        'language-selected' => -6,
      ],
    ];
    $value = $this->plugin->transform($source, $this->migrateExecutable, $this->row, 'destination_property');
    $this->assertSame($value, $expected);
  }

  /**
   * Tests successful transformation without weights.
   */
  public function testTransformWithoutWeights() {
    $source = [
      [
        'locale-url' => [],
        'locale-url-fallback' => [],
      ],
    ];
    $expected = [
      'enabled' => [
        'language-url' => 0,
        'language-url-fallback' => 1,
      ],
    ];
    $value = $this->plugin->transform($source, $this->migrateExecutable, $this->row, 'destination_property');
    $this->assertSame($value, $expected);
  }

  /**
   * Tests string input.
   */
  public function testStringInput() {
    $this->plugin = new LanguageNegotiation([], 'map', []);
    $this->expectException(MigrateException::class);
    $this->expectExceptionMessage('The input should be an array');
    $this->plugin->transform('foo', $this->migrateExecutable, $this->row, 'destination_property');
  }

}

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