public function ProfileFieldValuesTest::providerSource in Drupal 10
Same name and namespace in other branches
- 8 core/modules/user/tests/src/Kernel/Plugin/migrate/source/d6/ProfileFieldValuesTest.php \Drupal\Tests\user\Kernel\Plugin\migrate\source\d6\ProfileFieldValuesTest::providerSource()
- 9 core/modules/user/tests/src/Kernel/Plugin/migrate/source/d6/ProfileFieldValuesTest.php \Drupal\Tests\user\Kernel\Plugin\migrate\source\d6\ProfileFieldValuesTest::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/ user/ tests/ src/ Kernel/ Plugin/ migrate/ source/ d6/ ProfileFieldValuesTest.php, line 23
Class
- ProfileFieldValuesTest
- Tests the d6_profile_field_values source plugin.
Namespace
Drupal\Tests\user\Kernel\Plugin\migrate\source\d6Code
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['profile_values'] = [
[
'fid' => '8',
'uid' => '2',
'value' => 'red',
],
[
'fid' => '9',
'uid' => '2',
'value' => 'Lorem ipsum dolor sit amet...',
],
];
$tests[0]['source_data']['profile_fields'] = [
[
'fid' => '8',
'title' => 'Favorite color',
'name' => 'profile_color',
'explanation' => 'List your favorite color',
'category' => 'Personal information',
'page' => 'People whose favorite color is %value',
'type' => 'textfield',
'weight' => '-10',
'required' => '0',
'register' => '1',
'visibility' => '2',
'autocomplete' => '1',
'options' => '',
],
[
'fid' => '9',
'title' => 'Biography',
'name' => 'profile_biography',
'explanation' => 'Tell people a little bit about yourself',
'category' => 'Personal information',
'page' => '',
'type' => 'textarea',
'weight' => '-8',
'required' => '0',
'register' => '0',
'visibility' => '2',
'autocomplete' => '0',
'options' => '',
],
];
// The expected results.
$tests[0]['expected_data'] = [
[
'profile_color' => [
'red',
],
'profile_biography' => [
'Lorem ipsum dolor sit amet...',
],
'uid' => '2',
],
];
return $tests;
}