public function EckEntityTypeTest::providerSource in Entity Construction Kit (ECK) 8
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
- tests/
src/ Kernel/ Plugin/ migrate/ source/ d7/ EckEntityTypeTest.php, line 24
Class
- EckEntityTypeTest
- Tests D7 ECK entity type source plugin.
Namespace
Drupal\Tests\eck\Kernel\Plugin\migrate\source\d7Code
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['database']['eck_entity_type'] = [
[
'id' => '2',
'name' => 'simple',
'label' => 'Simple',
'properties' => json_encode((object) [
'title' => (object) [
'label' => 'Title',
'type' => 'text',
'behavior' => 'title',
],
'uid' => (object) [
'label' => 'Author',
'type' => 'integer',
'behavior' => 'author',
],
'created' => (object) [
'label' => 'Created',
'type' => 'integer',
'behavior' => 'created',
],
'changed' => (object) [
'label' => 'Changed',
'type' => 'integer',
'behavior' => 'changed',
],
]),
],
[
'id' => '2',
'name' => 'complex',
'label' => 'Complex',
'properties' => json_encode((object) [
'title' => (object) [
'label' => 'Title',
'type' => 'text',
'behavior' => 'title',
],
'uid' => (object) [
'label' => 'Author',
'type' => 'integer',
'behavior' => 'author',
],
'created' => (object) [
'label' => 'Created',
'type' => 'integer',
'behavior' => 'created',
],
'changed' => (object) [
'label' => 'Changed',
'type' => 'integer',
'behavior' => 'changed',
],
'language' => (object) [
'label' => 'Entity language',
'type' => 'language',
'behavior' => 'language',
],
'description' => (object) [
'label' => 'Description',
'type' => 'text',
'behavior' => '',
],
]),
],
];
$tests[0]['expected_results'] = $tests[0]['database']['eck_entity_type'];
return $tests;
}