Commit 1144f479 authored by webchick's avatar webchick
Browse files

Issue #2504109 by EvanSchisler, cilefen: A bunch of old update test dump...

Issue #2504109 by EvanSchisler, cilefen: A bunch of old update test dump scripts are still hanging out
parent 0b4add27
<?php
/**
* @file
* Database additions for Drupal\rdf\Tests\RdfMappingUpgradePathTest.
*
* This dump only contains data for the RDF module. The
* drupal-7.bare.standard_all.database.php file is imported before this dump,
* so the combination of the two forms the database structure expected in tests.
*/
// Create a new mapping to test reverse relations.
$rev_mapping = array(
'field_rev' => array(
'predicates' => array('foo:rev'),
'type' => 'rev',
),
'field_notrev' => array(
'predicates' => array('foo:rel'),
'type' => 'rel',
),
);
db_insert('rdf_mapping')
->fields(array(
'type',
'bundle',
'mapping',
))
->values(array(
'type' => 'node',
'bundle'=> 'rev_test',
'mapping' => serialize($rev_mapping),
))
->execute();
// Alter the stored mapping for articles.
$altered_mapping = array(
'rdftype' => array('foo:Type'),
'field_image' => array(
'predicates' => array('foo:image'),
),
);
db_update('rdf_mapping')
->fields(array(
'type' => 'node',
'bundle'=> 'article',
'mapping' => serialize($altered_mapping),
))
->condition('type', 'node')
->condition('bundle', 'article')
->execute();
<?php
/**
* @file
* Database additions for \Drupal\search\Tests\SearchUpgradePathTest.
*
* This dump only contains data and schema components relevant for search
* functionality. The bare.standard_all.database.php file is imported before
* this dump, so the two form the database structure expected in tests.
*/
// Set user as the only active and default search.
db_insert('variable')
->fields(array(
'name',
'value',
))
->values(array(
'name' => 'search_active_modules',
'value'=> 'a:1:{s:4:"user";s:4:"user";}',
))
->values(array(
'name' => 'search_default_module',
'value'=> 's:4:"user";',
))
->execute();
<?php
/**
* @file
* Database additions for upgrade path tests when all non-required modules are
* disabled.
*
* The drupal-7.filled.standard_all.database.php file is imported before
* this dump, so the two form the database structure expected in tests
* altogether.
*/
db_update('system')
->fields(array(
'status' => 0,
))
->condition('type', 'module')
->condition('name', array('filter', 'field', 'field_sql_storage', 'entity',
'system', 'text', 'user'), 'NOT IN')
->execute();
db_update('system')
->fields(array(
'schema_version' => 0,
))
->condition('type', 'module')
->condition('name', 'update_test_1')
->execute();
<?php
/**
* @file
* Database additions for comment tests. Used in CommentUpgradePathTest.
*
* This dump only contains some non-standard configuration for comment
* functionality. The drupal-7.filled.database.php and
* drupal-7.comment.database.php files are imported before this dump, so the
* three together form the database structure expected in tests.
*/
// Set up variables needed for comment support.
$variables = array(
'comment_default_mode_blog' => 0,
'comment_default_per_page_blog' => 25,
'comment_form_location_blog' => 0,
'comment_anonymous_blog' => 1,
'comment_subject_field_blog' => 0,
'comment_preview_blog' => 0,
);
db_delete('variable')
->condition('name', array_keys($variables), 'IN')
->execute();
$query = db_insert('variable')->fields(array(
'name',
'value',
));
foreach ($variables as $key => $value) {
$query->values(array(
'name' => $key,
'value' => serialize($value),
));
}
$query->execute();
<?php
/**
* @file
* Database additions for Drupal\system\Tests\Upgrade\DateUpgradePathTest.
*
* This dump only contains data and schema components relevant for date
* functionality. The bare.standard_all.database.php file is imported before
* this dump, so the two form the database structure expected in tests
* altogether.
*/
// Add default format for standard date formats.
db_insert('variable')
->fields(array(
'name',
'value',
))
->values(array(
'name' => 'date_format_short',
'value'=> 's:11:"Y/m/d - H:i";',
))
->values(array(
'name' => 'date_format_medium',
'value'=> 's:14:"D, d/m/Y - H:i";',
))
->values(array(
'name' => 'date_format_long',
'value'=> 's:16:"l, Y, F j - H:i";',
))
->values(array(
'name' => 'date_format_test_custom',
'value'=> 's:5:"d m Y";',
))
->execute();
// Add custom date types.
db_insert('date_format_type')
->fields(array(
'type',
'title',
'locked'
))
// Custom date format.
->values(array(
'type' => 'test_custom',
'title' => 'Test Custom',
'locked' => '0',
))
->execute();
// Add date formats for custom types.
db_insert('date_formats')
->fields(array(
'dfid',
'format',
'type',
'locked',
))
->values(array(
'dfid' => '36',
'format' => 'd m Y',
'type' => 'test_custom',
'locked' => '0',
))
->execute();
// Add localized date formats.
db_insert('date_format_locale')
->fields(array(
'format',
'type',
'language',
))
->values(array(
'format' => 'l, j F, Y - H:i',
'type' => 'long',
'language' => 'en',
))
->values(array(
'format' => 'D, m/d/Y - H:i',
'type' => 'medium',
'language' => 'en',
))
->values(array(
'format' => 'm/d/Y - H:i',
'type' => 'short',
'language' => 'en',
))
->values(array(
'format' => 'l, j. F, Y - H:i',
'type' => 'long',
'language' => 'de',
))
->values(array(
'format' => 'D, d/m/Y - H:i',
'type' => 'medium',
'language' => 'de',
))
->values(array(
'format' => 'd/m/Y - H:i',
'type' => 'short',
'language' => 'de',
))
->execute();
<?php
/**
* @file
* Database additions for field variables. Used in FieldUpgradePathTest.
*
* The drupal-7.bare.database.php file is imported before this dump, so the
* two form the database structure expected in tests altogether.
*/
// Add a 'bundle settings' variable for article nodes.
$value = array(
'view_modes' => array(
'teaser' => array(
'custom_settings' => 1,
),
'full' => array(
'custom_settings' => 0,
),
'rss' => array(
'custom_settings' => 0,
),
'search_index' => array(
'custom_settings' => 0,
),
'search_result' => array(
'custom_settings' => 0,
),
),
'extra_fields' => array(
'form' => array(
'title' => array(
'weight' => -5,
'visible' => 1,
),
),
'display' => array(
'language' => array(
'default' => array(
'weight' => -1,
'visible' => 1,
),
'teaser' => array(
'weight' => 0,
'visible' => 0,
),
),
),
),
);
db_insert('variable')
->fields(array(
'name' => 'field_bundle_settings_node__article',
'value' => serialize($value),
))
->execute();
// Add a field shared across different entity types (instance on article nodes
// and users).
$field_id = db_insert('field_storage_config')
->fields(array(
'field_name' => 'test_shared_field',
'type' => 'text',
'module' => 'text',
'active' => 1,
'storage_type' => 'field_sql_storage',
'storage_module' => 'field_sql_storage',
'storage_active' => 1,
'locked' => 0,
'data' => serialize(array(
'entity_types' => array(),
'settings' => array(
'max_length' => 255,
),
'storage' => array(
'type' => 'field_sql_storage',
'settings' => array(),
'module' => 'field_sql_storage',
'active' => 1,
),
'indexes' => array(
'format' => array(0 => 'format')
),
)),
'cardinality' => 1,
'translatable' => 0,
'deleted' => 0,
))
->execute();
db_insert('field_config_instance')
->fields(array(
'field_id' => $field_id,
'field_name' => 'test_shared_field',
'entity_type' => 'node',
'bundle' => 'article',
'data' => serialize(array(
'label' => 'Long text',
'description' => '',
'required' => FALSE,
'widget' => array(
'type' => 'text_textfield',
'weight' => 4,
'module' => 'text',
'active' => 1,
'settings' => array(
'size' => 60,
),
),
'settings' => array(
'text_processing' => 0,
'user_register_form' => FALSE,
),
'display' => array(
'default' => array(
'label' => 'above',
'type' => 'text_default',
'settings' => array(),
'module' => 'text',
'weight' => 10,
),
),
)),
'deleted' => 0
))
->execute();
db_insert('field_config_instance')
->fields(array(
'field_id' => $field_id,
'field_name' => 'test_shared_field',
'entity_type' => 'user',
'bundle' => 'user',
'data' => serialize(array(
'label' => 'Shared field',
'description' => '',
'required' => FALSE,
'widget' => array(
'type' => 'text_textfield',
'weight' => 4,
'module' => 'text',
'active' => 1,
'settings' => array(
'size' => 60,
),
),
'settings' => array(
'text_processing' => 0,
'user_register_form' => FALSE,
),
'display' => array(
'default' => array(
'label' => 'above',
'type' => 'text_default',
'settings' => array(),
'module' => 'text',
'weight' => 10,
),
),
)),
'deleted' => 0
))
->execute();
// Create the corresponding storage tables.
$schema = array(
'fields' => array(
'entity_type' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'bundle' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'deleted' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'entity_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'revision_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
'language' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'delta' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'test_shared_field_value' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
'test_shared_field_format' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
),
'primary key' => array(
'entity_type',
'entity_id',
'deleted',
'delta',
'language',
),
'indexes' => array(
'entity_type' => array(
'entity_type',
),
'bundle' => array(
'bundle',
),
'deleted' => array(
'deleted',
),
'entity_id' => array(
'entity_id',
),
'revision_id' => array(
'revision_id',
),
'language' => array(
'language',
),
'test_shared_field_format' => array(
'test_shared_field_format',
),
),
'module' => 'field_sql_storage',
'name' => 'field_data_test_shared_field',
);
db_create_table('field_data_test_shared_field', $schema);
$schema['primary key'] = array(
'entity_type',
'entity_id',
'revision_id',
'deleted',
'delta',
'language',
);
$schema['name'] = 'field_revision_test_shared_field';
db_create_table('field_revision_test_shared_field', $schema);
// Add a value for the 'test_shared_field' field on user 1.
$field_data_row = array(
'entity_type' => 'user',
'bundle' => 'user',
'deleted' => '0',
'entity_id' => '1',
'revision_id' => '1',
'language' => 'und',
'delta' => '0',
'test_shared_field_value' => 'Shared field: value for user 1',
'test_shared_field_format' => 'filtered_html',
);
db_insert('field_data_test_shared_field')
->fields($field_data_row)
->execute();
db_insert('field_revision_test_shared_field')
->fields($field_data_row)
->execute();
// Add one node.
db_insert('node')
->fields(array(
'nid' => '1',
'vid' => '1',
'type' => 'article',
'language' => 'und',
'title' => 'node title 1 rev 1',
'uid' => '1',
'status' => '1',
'created' => '1262754000',
'changed' => '1338795201',
'comment' => '0',
'promote' => '1',
'sticky' => '0',
'tnid' => '0',
'translate' => '0',
))
->execute();
db_insert('node_revision')
->fields(array(
'nid' => '1',
'vid' => '1',
'uid' => '1',
'title' => 'node title 1 rev 1',
'log' => 'added 0 node',
'timestamp' => '1338795201',
'status' => '1',
'comment' => '0',
'promote' => '1',
'sticky' => '0',
))
->execute();
// Add a value for the 'body' field.
$field_data_row = array(
'entity_type' => 'node',
'bundle' => 'article',
'deleted' => '0',
'entity_id' => '1',
'revision_id' => '1',
'language' => 'und',
'delta' => '0',
'body_value' => 'Some value',
'body_summary' => 'Some summary',
'body_format' => 'filtered_html',
);
db_insert('field_data_body')
->fields($field_data_row)
->execute();
db_insert('field_revision_body')
->fields($field_data_row)
->execute();
// Add a value for the 'test_shared_field' field.
$field_data_row = array(
'entity_type' => 'node',
'bundle' => 'article',
'deleted' => '0',
'entity_id' => '1',
'revision_id' => '1',
'language' => 'und',
'delta' => '0',
'test_shared_field_value' => 'Shared field: value for node 1',