You are here

protected function DataParserPluginBaseTest::getMockedDataParser in Migrate Plus 8.4

Same name and namespace in other branches
  1. 8.5 tests/src/Unit/DataParserPluginBaseTest.php \Drupal\Tests\migrate_plus\Unit\DataParserPluginBaseTest::getMockedDataParser()

Returns a mocked data parser.

Parameters

array $configuration: The configuration to pass to the data parser.

Return value

\PHPUnit\Framework\MockObject\MockObject|\Drupal\Tests\migrate_plus\Unit\DataParserPluginBaseMock An mock instance of DataParserPluginBase.

3 calls to DataParserPluginBaseTest::getMockedDataParser()
DataParserPluginBaseTest::testCountWithoutUrls in tests/src/Unit/DataParserPluginBaseTest.php
@covers ::count
DataParserPluginBaseTest::testNextSourceWithOneUrl in tests/src/Unit/DataParserPluginBaseTest.php
@covers ::nextSource
DataParserPluginBaseTest::testNextSourceWithoutUrls in tests/src/Unit/DataParserPluginBaseTest.php
@covers ::nextSource

File

tests/src/Unit/DataParserPluginBaseTest.php, line 63

Class

DataParserPluginBaseTest
@coversDefaultClass \Drupal\migrate_plus\DataParserPluginBase

Namespace

Drupal\Tests\migrate_plus\Unit

Code

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();
}