Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html_old/abg/web/modules/contrib/migrate_plus/tests/src/Unit/

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_old/abg/web/modules/contrib/migrate_plus/tests/src/Unit/DataParserPluginBaseTest.php

<?php

namespace Drupal\Tests\migrate_plus\Unit;

use Drupal\migrate_plus\DataParserPluginBase;
use Drupal\Tests\migrate\Unit\MigrateTestCase;

/**
 * @coversDefaultClass \Drupal\migrate_plus\DataParserPluginBase
 *
 * @group migrate_plus
 */
class DataParserPluginBaseTest extends MigrateTestCase {

  /**
   * @covers ::nextSource
   */
  public function testNextSourceWithOneUrl(): void {
    $parser = $this->getMockedDataParser();
    $parser->expects($this->once())
      ->method('openSourceUrl')
      ->willReturn(TRUE);
    $this->assertTrue($parser->nextSource());
  }

  /**
   * @covers ::nextSource
   */
  public function testNextSourceWithoutUrls(): void {
    $config = [
      'urls' => [],
    ];

    $parser = $this->getMockedDataParser($config);
    $parser->expects($this->never())
      ->method('openSourceUrl');
    $this->assertFalse($parser->nextSource());
  }

  /**
   * @covers ::count
   */
  public function testCountWithoutUrls(): void {
    $config = [
      'urls' => [],
    ];

    $parser = $this->getMockedDataParser($config);
    $parser->expects($this->never())
      ->method('openSourceUrl');
    $this->assertEquals(0, $parser->count());
  }

  /**
   * Returns a mocked data parser.
   *
   * @param array $configuration
   *   The configuration to pass to the data parser.
   *
   * @return \PHPUnit\Framework\MockObject\MockObject|\Drupal\Tests\migrate_plus\Unit\DataParserPluginBaseMock
   *   An mock instance of DataParserPluginBase.
   */
  protected function getMockedDataParser(array $configuration = []) {
    // Set constructor arguments.
    $configuration += [
      'urls' => ['http://example.org/data_parser_test'],
      'item_selector' => 0,
    ];
    $plugin_id = 'foo';
    $plugin_definition = [
      'id' => 'foo',
      'title' => 'Foo',
    ];

    return $this->getMockBuilder(DataParserPluginBaseMock::class)
      ->setConstructorArgs([$configuration, $plugin_id, $plugin_definition])
      ->setMethods(['openSourceUrl'])
      ->getMockForAbstractClass();
  }

}

/**
 * Mock for abstract class DataParserPluginBase.
 *
 * This mock is used to make certain methods publicly accessible.
 */
abstract class DataParserPluginBaseMock extends DataParserPluginBase {

  /**
   * {@inheritdoc}
   *
   * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod.Found
   */
  public function nextSource() {
    return parent::nextSource();
  }

}

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