Last active
October 7, 2016 16:20
-
-
Save maijs/39c5fe9bdd37ab666c3220a2d4d7b1cd to your computer and use it in GitHub Desktop.
Drupal\Tests\user\Kernel\Plugin\migrate\source\ProfileFieldtest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\Tests\user\Kernel\Plugin\migrate\source; | |
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase; | |
/** | |
* Tests the profile_field source plugin. | |
* | |
* @covers \Drupal\user\Plugin\migrate\source\ProfileField | |
* @group user | |
*/ | |
class ProfileFieldTest extends MigrateSqlSourceTestBase { | |
/** | |
* {@inheritdoc} | |
*/ | |
public static $modules = ['user', 'migrate_drupal']; | |
/** | |
* {@inheritdoc} | |
*/ | |
public function providerSource() { | |
$tests = []; | |
$profiles = [ | |
[ | |
'fid' => 1, | |
'title' => 'First name', | |
'name' => 'profile_first_name', | |
'explanation' => 'First name user', | |
'category' => 'profile', | |
'page' => '', | |
'type' => 'textfield', | |
'weight' => 0, | |
'required' => 1, | |
'register' => 0, | |
'visibility' => 2, | |
'autocomplete' => 0, | |
'options' => '', | |
], | |
[ | |
'fid' => 2, | |
'title' => 'Last name', | |
'name' => 'profile_last_name', | |
'explanation' => 'Last name user', | |
'category' => 'profile', | |
'page' => '', | |
'type' => 'textfield', | |
'weight' => 0, | |
'required' => 0, | |
'register' => 0, | |
'visibility' => 2, | |
'autocomplete' => 0, | |
'options' => '', | |
], | |
[ | |
'fid' => 3, | |
'title' => 'Policy', | |
'name' => 'profile_policy', | |
'explanation' => 'A checkbox that say if you accept policy of website', | |
'category' => 'profile', | |
'page' => '', | |
'type' => 'checkbox', | |
'weight' => 0, | |
'required' => 1, | |
'register' => 1, | |
'visibility' => 2, | |
'autocomplete' => 0, | |
'options' => [NULL, NULL], | |
], | |
]; | |
$tests[0][0]['profile_fields'] = $profiles; | |
foreach ($tests[0][0]['profile_fields'] as &$row) { | |
if (is_array($row['options'])) { | |
$row['options'] = serialize([]); | |
} | |
} | |
$tests[0][1] = $profiles; | |
return $tests; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment