You are here

public function SearchPageTest::providerSource in Drupal 8

Same name in this branch
  1. 8 core/modules/search/tests/src/Kernel/Migrate/d6/SearchPageTest.php \Drupal\Tests\search\Kernel\Migrate\d6\SearchPageTest::providerSource()
  2. 8 core/modules/search/tests/src/Kernel/Migrate/d7/SearchPageTest.php \Drupal\Tests\search\Kernel\Migrate\d7\SearchPageTest::providerSource()
Same name and namespace in other branches
  1. 9 core/modules/search/tests/src/Kernel/Migrate/d7/SearchPageTest.php \Drupal\Tests\search\Kernel\Migrate\d7\SearchPageTest::providerSource()

The data provider.

Return value

array Array of data sets to test, each of which is a numerically indexed array with the following elements:

  • An array of source data, which can be optionally processed and set up by subclasses.
  • An array of expected result rows.
  • (optional) The number of result rows the plugin under test is expected to return. If this is not a numeric value, the plugin will not be counted.
  • (optional) Array of configuration options for the plugin under test.

Overrides MigrateSourceTestBase::providerSource

See also

\Drupal\Tests\migrate\Kernel\MigrateSourceTestBase::testSource

File

core/modules/search/tests/src/Kernel/Migrate/d7/SearchPageTest.php, line 23

Class

SearchPageTest
Tests D7 search page source plugin.

Namespace

Drupal\Tests\search\Kernel\Migrate\d7

Code

public function providerSource() {
  $tests[0]['source_data'] = [
    'variable' => [
      [
        'name' => 'search_active_modules',
        'value' => 'a:2:{s:4:"node";s:4:"node";s:4:"user";i:0;}',
      ],
      [
        'name' => 'node_rank_comments',
        'value' => 's:1:"5";',
      ],
      [
        'name' => 'node_rank_promote',
        'value' => 's:1:"1";',
      ],
    ],
    'system' => [
      [
        'name' => 'node',
        'type' => 'module',
        'status' => '0',
      ],
      [
        'name' => 'user',
        'type' => 'module',
        'status' => '1',
      ],
    ],
  ];
  $tests[0]['expected_data'] = [
    [
      'module' => 'node',
      'status' => 'node',
      'module_exists' => FALSE,
      'node_rank_comments' => '5',
      'node_rank_promote' => '1',
    ],
    [
      'module' => 'user',
      'status' => 0,
      'module_exists' => TRUE,
    ],
  ];
  $tests[0]['expected_count'] = NULL;
  $tests[0]['configuration'] = [
    'variables' => [
      'node_rank_comments',
      'node_rank_promote',
    ],
  ];
  return $tests;
}