本文整理汇总了PHP中Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase类的典型用法代码示例。如果您正苦于以下问题:PHP MigrateSqlSourceTestCase类的具体用法?PHP MigrateSqlSourceTestCase怎么用?PHP MigrateSqlSourceTestCase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MigrateSqlSourceTestCase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
$this->databaseContents['term_node'] = array(array('nid' => '1', 'vid' => '1', 'tid' => '1'), array('nid' => '1', 'vid' => '1', 'tid' => '4'), array('nid' => '1', 'vid' => '1', 'tid' => '5'));
$this->databaseContents['node'] = array(array('nid' => '1', 'vid' => '1', 'type' => 'story', 'language' => '', 'title' => 'Test title', 'uid' => '1', 'status' => '1', 'created' => '1388271197', 'changed' => '1420861423', 'comment' => '0', 'promote' => '0', 'moderate' => '0', 'sticky' => '0', 'tnid' => '0', 'translate' => '0'));
$this->databaseContents['term_data'] = array(array('tid' => '1', 'vid' => '3', 'name' => 'term 1 of vocabulary 3', 'description' => 'description of term 1 of vocabulary 3', 'weight' => '0'), array('tid' => '4', 'vid' => '3', 'name' => 'term 4 of vocabulary 3', 'description' => 'description of term 4 of vocabulary 3', 'weight' => '6'), array('tid' => '5', 'vid' => '3', 'name' => 'term 5 of vocabulary 3', 'description' => 'description of term 5 of vocabulary 3', 'weight' => '7'));
parent::setUp();
}
示例2: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
$database_contents = $this->expectedResults;
array_walk($this->expectedResults, function (&$row) {
$row['node_uid'] = $row['uid'];
$row['revision_uid'] = $row['uid'] + 1;
unset($row['uid']);
});
$database_contents[] = array('nid' => 5, 'vid' => 5, 'type' => 'article', 'language' => 'en', 'title' => 'node title 5', 'uid' => 1, 'status' => 1, 'timestamp' => 1279290908, 'created' => 1279290908, 'changed' => 1279308993, 'comment' => 0, 'promote' => 1, 'moderate' => 0, 'sticky' => 0, 'tnid' => 0, 'translate' => 0, 'body' => 'body for node 5', 'teaser' => 'body for node 5', 'format' => 1, 'log' => 'log message 3');
// Add another row with an article node and make sure it is not migrated.
foreach ($database_contents as $k => $row) {
foreach (array('nid', 'vid', 'title', 'uid', 'body', 'teaser', 'format', 'timestamp', 'log') as $field) {
$this->databaseContents['node_revisions'][$k][$field] = $row[$field];
switch ($field) {
case 'nid':
case 'vid':
break;
case 'uid':
$this->databaseContents['node_revisions'][$k]['uid']++;
break;
default:
unset($row[$field]);
break;
}
}
$this->databaseContents['node'][$k] = $row;
}
parent::setUp();
}
示例3: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
foreach ($this->expectedResults as $k => $row) {
foreach (array('nid', 'vid', 'title', 'uid', 'body', 'teaser', 'format', 'timestamp', 'log') as $field) {
$this->databaseContents['node_revisions'][$k][$field] = $row[$field];
switch ($field) {
case 'nid':
case 'vid':
break;
case 'uid':
$this->databaseContents['node_revisions'][$k]['uid']++;
break;
default:
unset($row[$field]);
break;
}
}
$this->databaseContents['node'][$k] = $row;
}
array_walk($this->expectedResults, function (&$row) {
$row['node_uid'] = $row['uid'];
$row['revision_uid'] = $row['uid'] + 1;
unset($row['uid']);
});
parent::setUp();
}
示例4: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
foreach ($this->expectedResults as $k => $row) {
foreach (array('nid', 'vid', 'title', 'uid', 'timestamp', 'log') as $field) {
$this->databaseContents['node_revision'][$k][$field] = $row[$field];
switch ($field) {
case 'nid':
case 'vid':
break;
case 'uid':
$this->databaseContents['node_revision'][$k]['uid']++;
break;
default:
unset($row[$field]);
break;
}
}
$this->databaseContents['node'][$k] = $row;
}
array_walk($this->expectedResults, function (&$row) {
$row['node_uid'] = $row['uid'];
$row['revision_uid'] = $row['uid'] + 1;
unset($row['uid']);
});
$this->databaseContents['field_config_instance'] = array(array('id' => '2', 'field_id' => '2', 'field_name' => 'body', 'entity_type' => 'node', 'bundle' => 'page', 'data' => 'a:0:{}', 'deleted' => '0'), array('id' => '2', 'field_id' => '2', 'field_name' => 'body', 'entity_type' => 'node', 'bundle' => 'article', 'data' => 'a:0:{}', 'deleted' => '0'));
$this->databaseContents['field_revision_body'] = array(array('entity_type' => 'node', 'bundle' => 'page', 'deleted' => '0', 'entity_id' => '1', 'revision_id' => '1', 'language' => 'en', 'delta' => '0', 'body_value' => 'Foobaz', 'body_summary' => '', 'body_format' => 'filtered_html'));
parent::setUp();
}
示例5: setUp
/**
* Prepopulate database contents.
*/
protected function setUp()
{
$this->databaseContents['blocks'] = $this->expectedResults;
$this->databaseContents['blocks_roles'] = $this->expectedBlocksRoles;
$this->databaseContents['system'] = array(array('filename' => 'modules/system/system.module', 'name' => 'system', 'type' => 'module', 'owner' => '', 'status' => '1', 'throttle' => '0', 'bootstrap' => '0', 'schema_version' => '6055', 'weight' => '0', 'info' => 'a:0:{}'));
parent::setUp();
}
示例6: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
$this->databaseContents['node_type'] = array(array('type' => 'article', 'name' => 'Article', 'base' => 'node_content', 'module' => 'node', 'description' => 'Use <em>articles</em> for time-sensitive content like news, press releases or blog posts.', 'help' => 'Help text for articles', 'has_title' => '1', 'title_label' => 'Title', 'custom' => '1', 'modified' => '1', 'locked' => '0', 'disabled' => '0', 'orig_type' => 'article'));
$this->databaseContents['field_config_instance'] = array(array('id' => '14', 'field_id' => '1', 'field_name' => 'comment_body', 'entity_type' => 'comment', 'bundle' => 'comment_node_article', 'data' => 'a:0:{}', 'deleted' => '0'));
$this->databaseContents['variable'] = array(array('name' => 'comment_default_mode_article', 'value' => serialize(1)), array('name' => 'comment_per_page_article', 'value' => serialize(50)), array('name' => 'comment_anonymous_article', 'value' => serialize(0)), array('name' => 'comment_form_location_article', 'value' => serialize(1)), array('name' => 'comment_preview_article', 'value' => serialize(0)), array('name' => 'comment_subject_article', 'value' => serialize(1)));
parent::setUp();
}
示例7: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
$empty_array = serialize([]);
$this->databaseContents['content_node_field'] = array(array('field_name' => 'field_test_filefield', 'type' => 'filefield', 'global_settings' => $empty_array, 'required' => '0', 'multiple' => '0', 'db_storage' => '1', 'module' => 'filefield', 'db_columns' => $empty_array, 'active' => '1', 'locked' => '0'));
$this->databaseContents['content_node_field_instance'] = array(array('field_name' => 'field_test_filefield', 'type_name' => 'story', 'weight' => '8', 'label' => 'File Field', 'widget_type' => 'filefield_widget', 'widget_settings' => $empty_array, 'display_settings' => $empty_array, 'description' => 'An example image field.', 'widget_module' => 'filefield', 'widget_active' => '1'));
parent::setUp();
}
示例8: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
$this->databaseContents['content_node_field'] = array(array('field_name' => 'field_test_four', 'type' => 'number_float', 'global_settings' => 'a:0:{}', 'required' => '0', 'multiple' => '0', 'db_storage' => '1', 'module' => 'number', 'db_columns' => 'a:1:{s:5:"value";a:3:{s:4:"type";s:5:"float";s:8:"not null";b:0;s:8:"sortable";b:1;}}', 'active' => '1', 'locked' => '0'));
$this->databaseContents['content_node_field_instance'] = array(array('field_name' => 'field_test_four', 'type_name' => 'story', 'weight' => '3', 'label' => 'Float Field', 'widget_type' => 'number', 'widget_settings' => 'a:0:{}', 'display_settings' => 'a:0:{}', 'description' => 'An example float field.', 'widget_module' => 'number', 'widget_active' => '1'));
$this->databaseContents['content_type_story'] = array(array('nid' => 5, 'vid' => 5, 'uid' => 5, 'field_test_four_value' => '3.14159'));
$this->databaseContents['system'] = array(array('type' => 'module', 'name' => 'content', 'schema_version' => 6001, 'status' => TRUE));
$this->databaseContents['node'] = [['nid' => 1, 'vid' => 1, 'type' => 'page', 'language' => 'en', 'title' => 'node title 1', 'uid' => 1, 'status' => 1, 'created' => 1279051598, 'changed' => 1279051598, 'comment' => 2, 'promote' => 1, 'moderate' => 0, 'sticky' => 0, 'translate' => 0, 'tnid' => 0], ['nid' => 2, 'vid' => 2, 'type' => 'page', 'language' => 'en', 'title' => 'node title 2', 'uid' => 1, 'status' => 1, 'created' => 1279290908, 'changed' => 1279308993, 'comment' => 0, 'promote' => 1, 'moderate' => 0, 'sticky' => 0, 'translate' => 0, 'tnid' => 0], ['nid' => 5, 'vid' => 5, 'type' => 'story', 'language' => 'en', 'title' => 'node title 5', 'uid' => 1, 'status' => 1, 'created' => 1279290908, 'changed' => 1279308993, 'comment' => 0, 'promote' => 1, 'moderate' => 0, 'sticky' => 0, 'translate' => 0, 'tnid' => 0], ['nid' => 6, 'vid' => 6, 'type' => 'story', 'language' => 'en', 'title' => 'node title 6', 'uid' => 1, 'status' => 1, 'created' => 1279290909, 'changed' => 1279308994, 'comment' => 0, 'promote' => 1, 'moderate' => 0, 'sticky' => 0, 'translate' => 0, 'tnid' => 6], ['nid' => 7, 'vid' => 7, 'type' => 'story', 'language' => 'fr', 'title' => 'node title 7', 'uid' => 1, 'status' => 1, 'created' => 1279290910, 'changed' => 1279308995, 'comment' => 0, 'promote' => 1, 'moderate' => 0, 'sticky' => 0, 'translate' => 0, 'tnid' => 6]];
foreach ($this->databaseContents['node'] as $k => $row) {
// Find the equivalent row from expected results.
$result_row = NULL;
foreach ($this->expectedResults as $result) {
if (in_array($result['nid'], [$row['nid'], $row['tnid']]) && $result['language'] == $row['language']) {
$result_row = $result;
break;
}
}
// Populate node_revisions.
foreach (array('nid', 'vid', 'title', 'uid', 'body', 'teaser', 'format', 'timestamp', 'log') as $field) {
$value = isset($row[$field]) ? $row[$field] : $result_row[$field];
$this->databaseContents['node_revisions'][$k][$field] = $value;
if ($field == 'uid') {
$this->databaseContents['node_revisions'][$k]['uid']++;
}
}
}
array_walk($this->expectedResults, function (&$row) {
$row['node_uid'] = $row['uid'];
$row['revision_uid'] = $row['uid'] + 1;
unset($row['uid']);
});
parent::setUp();
}
示例9: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
foreach ($this->expectedResults as $row) {
$this->databaseContents['url_alias'][] = $row;
}
parent::setUp();
}
示例10: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
$this->databaseContents['content_node_field'] = array(array('field_name' => 'field_test_four', 'type' => 'number_float', 'global_settings' => 'a:0:{}', 'required' => '0', 'multiple' => '0', 'db_storage' => '1', 'module' => 'number', 'db_columns' => 'a:1:{s:5:"value";a:3:{s:4:"type";s:5:"float";s:8:"not null";b:0;s:8:"sortable";b:1;}}', 'active' => '1', 'locked' => '0'));
$this->databaseContents['content_node_field_instance'] = array(array('field_name' => 'field_test_four', 'type_name' => 'story', 'weight' => '3', 'label' => 'Float Field', 'widget_type' => 'number', 'widget_settings' => 'a:0:{}', 'display_settings' => 'a:0:{}', 'description' => 'An example float field.', 'widget_module' => 'number', 'widget_active' => '1'));
$this->databaseContents['content_type_story'] = array(array('nid' => 5, 'vid' => 5, 'uid' => 5, 'field_test_four_value' => '3.14159'));
$this->databaseContents['system'] = array(array('type' => 'module', 'name' => 'content', 'schema_version' => 6001, 'status' => TRUE));
foreach ($this->expectedResults as $k => $row) {
foreach (array('nid', 'vid', 'title', 'uid', 'body', 'teaser', 'format', 'timestamp', 'log') as $field) {
$this->databaseContents['node_revisions'][$k][$field] = $row[$field];
switch ($field) {
case 'nid':
case 'vid':
break;
case 'uid':
$this->databaseContents['node_revisions'][$k]['uid']++;
break;
default:
unset($row[$field]);
break;
}
}
$this->databaseContents['node'][$k] = $row;
}
array_walk($this->expectedResults, function (&$row) {
$row['node_uid'] = $row['uid'];
$row['revision_uid'] = $row['uid'] + 1;
unset($row['uid']);
});
parent::setUp();
}
示例11: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
foreach ($this->expectedResults as $k => $row) {
$this->databaseContents['aggregator_feed'][$k] = $row;
}
parent::setUp();
}
示例12: setUp
/**
* Prepopulate contents with results.
*/
protected function setUp()
{
$this->databaseContents['node_type'] = $this->expectedResults;
$this->databaseContents['variable'] = array(array('name' => 'node_options_page', 'value' => 'a:1:{i:0;s:6:"status";}'), array('name' => 'node_options_story', 'value' => 'a:1:{i:0;s:6:"status";}'));
$this->databaseContents['field_config_instance'] = array(array('entity_type' => 'node', 'bundle' => 'page', 'field_name' => 'body', 'data' => 'a:1:{s:5:"label";s:4:"Body";}'), array('entity_type' => 'node', 'bundle' => 'story', 'field_name' => 'body', 'data' => 'a:1:{s:5:"label";s:4:"Body";}'));
parent::setUp();
}
示例13: setUp
/**
* Prepopulate contents with results.
*/
protected function setUp()
{
$this->databaseContents['profile_fields'] = $this->expectedResults;
foreach ($this->databaseContents['profile_fields'] as &$row) {
$row['options'] = serialize([]);
}
parent::setUp();
}
示例14: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
foreach ($this->expectedResults as $k => $row) {
$this->databaseContents['contact'][$k] = $row;
$this->databaseContents['contact'][$k]['recipients'] = implode(',', $row['recipients']);
}
parent::setUp();
}
示例15: setUp
/**
* {@inheritdoc}
*/
public function setUp()
{
foreach ($this->expectedResults as $k => $row) {
$row['options'] = serialize($row['options']);
$this->databaseContents['menu_links'][$k] = $row;
}
parent::setUp();
}