First commit

This commit is contained in:
Theodotos Andreou 2018-01-14 13:10:16 +00:00
commit c6e2478c40
13918 changed files with 2303184 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,40 @@
<?php
db_update('node')->fields(array(
'comment' => 2
))
->condition('nid', 1)
->execute();
db_insert('comments')->fields(array(
'cid',
'pid',
'nid',
'uid',
'subject',
'comment',
'hostname',
'timestamp',
'status',
'format',
'thread',
'name',
'mail',
'homepage',
))
->values(array(
'cid' => 1,
'pid' => 0,
'nid' => 1,
'uid' => 3,
'subject' => 'Comment title 1',
'comment' => 'Comment body 1 - Comment body 1 - Comment body 1 - Comment body 1 - Comment body 1 - Comment body 1 - Comment body 1 - Comment body 1',
'hostname' => '127.0.0.1',
'timestamp' => 1008617630,
'status' => 0,
'format' => 1,
'thread' => '01/',
'name' => NULL,
'mail' => NULL,
'homepage' => '',
))
->execute();

View file

@ -0,0 +1,8 @@
<?php
// Simulate duplicated permission condition.
db_update('permission')->fields(array(
'perm' => 'access content, access content',
))
->condition('pid', 1)
->execute();

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,274 @@
<?php
/**
* Database additions for forum tests.
*/
db_create_table('forum', array(
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'tid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'indexes' => array(
'nid' => array(
'nid',
),
'tid' => array(
'tid',
),
),
'primary key' => array(
'vid',
),
'module' => 'forum',
'name' => 'forum',
));
db_insert('forum')->fields(array(
'nid',
'vid',
'tid',
))
->values(array(
'nid' => '51',
'vid' => '61',
'tid' => '81',
))
->execute();
db_insert('node')->fields(array(
'nid',
'vid',
'type',
'language',
'title',
'uid',
'status',
'created',
'changed',
'comment',
'promote',
'moderate',
'sticky',
'tnid',
'translate',
))
->values(array(
'nid' => '51',
'vid' => '61',
'type' => 'forum',
'language' => '',
'title' => 'Apples',
'uid' => '1',
'status' => '1',
'created' => '1298363952',
'changed' => '1298363952',
'comment' => '2',
'promote' => '0',
'moderate' => '0',
'sticky' => '0',
'tnid' => '0',
'translate' => '0',
))
->execute();
db_insert('node_revisions')->fields(array(
'nid',
'vid',
'uid',
'title',
'body',
'teaser',
'log',
'timestamp',
'format',
))
->values(array(
'nid' => '51',
'vid' => '61',
'uid' => '1',
'title' => 'Apples',
'body' => 'A fruit.',
'teaser' => 'A fruit.',
'log' => '',
'timestamp' => '1298363952',
'format' => '1',
))
->execute();
db_insert('node_comment_statistics')->fields(array(
'nid',
'last_comment_timestamp',
'last_comment_name',
'last_comment_uid',
'comment_count',
))
->values(array(
'nid' => '51',
'last_comment_timestamp' => '1298363952',
'last_comment_name' => NULL,
'last_comment_uid' => '1',
'comment_count' => '0',
))
->execute();
db_insert('node_type')->fields(array(
'type',
'name',
'module',
'description',
'help',
'has_title',
'title_label',
'has_body',
'body_label',
'min_word_count',
'custom',
'modified',
'locked',
'orig_type',
))
->values(array(
'type' => 'forum',
'name' => 'Forum topic',
'module' => 'forum',
'description' => 'A <em>forum topic</em> is the initial post to a new discussion thread within a forum.',
'help' => '',
'has_title' => '1',
'title_label' => 'Subject',
'has_body' => '1',
'body_label' => 'Body',
'min_word_count' => '0',
'custom' => '0',
'modified' => '0',
'locked' => '1',
'orig_type' => 'forum',
))
->execute();
db_update('system')->fields(array(
'schema_version' => '6000',
'status' => '1',
))
->condition('filename', 'modules/forum/forum.module')
->execute();
db_insert('term_data')->fields(array(
'tid',
'vid',
'name',
'description',
'weight',
))
->values(array(
'tid' => '81',
'vid' => '101',
'name' => 'Fruits',
'description' => 'Fruits.',
'weight' => '0',
))
->execute();
db_insert('term_hierarchy')->fields(array(
'tid',
'parent',
))
->values(array(
'tid' => '81',
'parent' => '0',
))
->execute();
db_insert('term_node')->fields(array(
'nid',
'vid',
'tid',
))
->values(array(
'nid' => '51',
'vid' => '61',
'tid' => '81',
))
->execute();
db_insert('variable')->fields(array(
'name',
'value',
))
->values(array(
'name' => 'forum_nav_vocabulary',
'value' => 's:3:"101";',
))
->values(array(
'name' => 'forum_containers',
'value' => 'a:1:{i:0;s:3:"101";}',
))
->execute();
db_insert('vocabulary')->fields(array(
'vid',
'name',
'description',
'help',
'relations',
'hierarchy',
'multiple',
'required',
'tags',
'module',
'weight',
))
->values(array(
'vid' => '101',
'name' => 'Upgrade test for forums',
'description' => 'Vocabulary used for Forums. The name is changed from the default "Forums" so that the upgrade path may be tested.',
'help' => '',
'relations' => '1',
'hierarchy' => '1',
'multiple' => '0',
'required' => '0',
'tags' => '0',
'module' => 'forum',
'weight' => '-10',
))
->execute();
db_insert('vocabulary_node_types')->fields(array(
'vid',
'type',
))
->values(array(
'vid' => '101',
'type' => 'forum',
))
->execute();
// Provide all users with the ability to create forum topics.
$results = db_select('permission', 'p')
->fields('p')
->execute();
foreach ($results as $result) {
$permissions = $result->perm . ', create forum topics';
db_update('permission')
->fields(array(
'perm' => $permissions,
))
->condition('rid', $result->rid)
->execute();
}

View file

@ -0,0 +1,276 @@
<?php
/**
* Database additions for locale tests.
*/
db_create_table('languages', array(
'fields' => array(
'language' => array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
),
'name' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'native' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'direction' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'enabled' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'plurals' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'formula' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'domain' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'prefix' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'javascript' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
),
'primary key' => array(
'language',
),
'indexes' => array(
'list' => array(
'weight',
'name',
),
),
'module' => 'locale',
'name' => 'languages',
));
db_insert('languages')->fields(array(
'language',
'name',
'native',
'direction',
'enabled',
'plurals',
'formula',
'domain',
'prefix',
'weight',
'javascript',
))
->values(array(
'language' => 'en',
'name' => 'English',
'native' => 'English',
'direction' => '0',
'enabled' => '1',
'plurals' => '0',
'formula' => '',
'domain' => 'http://en.example.com',
'prefix' => 'en',
'weight' => '0',
'javascript' => '',
))
->values(array(
'language' => 'fr',
'name' => 'French',
'native' => 'Français',
'direction' => '0',
'enabled' => '1',
'plurals' => '2',
'formula' => '($n>1)',
'domain' => '',
'prefix' => 'fr',
'weight' => '-3',
'javascript' => '51e92dcfe1491f4595b9df7f3b287753',
))
->execute();
db_create_table('locales_source', array(
'fields' => array(
'lid' => array(
'type' => 'serial',
'not null' => TRUE,
),
'location' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'textgroup' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => 'default',
),
'source' => array(
'type' => 'text',
'mysql_type' => 'blob',
'not null' => TRUE,
),
'version' => array(
'type' => 'varchar',
'length' => 20,
'not null' => TRUE,
'default' => 'none',
),
),
'primary key' => array(
'lid',
),
'indexes' => array(
'source' => array(
array(
'source',
30,
),
),
),
'module' => 'locale',
'name' => 'locales_source',
));
db_create_table('locales_target', array(
'fields' => array(
'lid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'translation' => array(
'type' => 'text',
'mysql_type' => 'blob',
'not null' => TRUE,
),
'language' => array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
),
'plid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'plural' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'language',
'lid',
'plural',
),
'indexes' => array(
'lid' => array(
'lid',
),
'plid' => array(
'plid',
),
'plural' => array(
'plural',
),
),
'module' => 'locale',
'name' => 'locales_target',
));
// Enable the locale module.
db_update('system')->fields(array(
'status' => 1,
'schema_version' => '6006',
))
->condition('type', 'module')
->condition('name', 'locale')
->execute();
// Set the default language.
db_insert('variable')->fields(array(
'name',
'value',
))
->values(array(
'name' => 'language_default',
'value' => 'O:8:"stdClass":11:{s:8:"language";s:2:"fr";s:4:"name";s:6:"French";s:6:"native";s:9:"Français";s:9:"direction";s:1:"0";s:7:"enabled";i:1;s:7:"plurals";s:1:"2";s:7:"formula";s:6:"($n>1)";s:6:"domain";s:0:"";s:6:"prefix";s:0:"";s:6:"weight";s:2:"-3";s:10:"javascript";s:32:"51e92dcfe1491f4595b9df7f3b287753";}',
))
->values(array(
'name' => 'language_count',
'value' => 'i:2;',
))
->values(array(
'name' => 'language_negotiation',
'value' => 'i:0;',
))
->execute();
// Add the language switcher block in the left region.
db_insert('blocks')->fields(array(
'module',
'delta',
'theme',
'status',
'weight',
'region',
'custom',
'throttle',
'visibility',
'pages',
'title',
'cache',
))
->values(array(
'module' => 'locale',
'delta' => '0',
'theme' => 'garland',
'status' => '1',
'weight' => '0',
'region' => 'left',
'custom' => '0',
'throttle' => '0',
'visibility' => '0',
'pages' => '',
'title' => '',
'cache' => '-1',
))
->execute();

View file

@ -0,0 +1,202 @@
<?php
db_insert('variable')->fields(array(
'name',
'value',
))
->values(array(
'name' => 'menu_default_node_menu',
'value' => 's:15:"secondary-links";',
))
->values(array(
'name' => 'menu_primary_links_source',
'value' => 's:15:"secondary-links";',
))
->values(array(
'name' => 'menu_secondary_links_source',
'value' => 's:13:"primary-links";',
))
->execute();
// Add some links to the menus.
db_insert('menu_links')->fields(array(
'menu_name',
'mlid',
'plid',
'link_path',
'router_path',
'link_title',
'options',
'module',
'hidden',
'external',
'has_children',
'expanded',
'weight',
'depth',
'customized',
'p1',
'p2',
'p3',
'p4',
'p5',
'p6',
'p7',
'p8',
'p9',
'updated',
))
->values(array(
'menu_name' => 'navigation',
'mlid' => '201',
'plid' => '0',
'link_path' => 'node/add',
'router_path' => 'node/add',
'link_title' => 'nodeadd-navigation',
'options' => 'a:0:{}',
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '1',
'expanded' => '0',
'weight' => '1',
'depth' => '1',
'customized' => '0',
'p1' => '201',
'p2' => '0',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
'updated' => '0',
))
->values(array(
'menu_name' => 'primary-links',
'mlid' => '204',
'plid' => '0',
'link_path' => 'node/add',
'router_path' => 'node/add',
'link_title' => 'nodeadd-primary',
'options' => 'a:0:{}',
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '1',
'expanded' => '0',
'weight' => '1',
'depth' => '1',
'customized' => '0',
'p1' => '204',
'p2' => '0',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
'updated' => '0',
))
->values(array(
'menu_name' => 'secondary-links',
'mlid' => '205',
'plid' => '0',
'link_path' => 'node/add',
'router_path' => 'node/add',
'link_title' => 'nodeadd-secondary',
'options' => 'a:0:{}',
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '1',
'expanded' => '0',
'weight' => '1',
'depth' => '1',
'customized' => '0',
'p1' => '205',
'p2' => '0',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
'updated' => '0',
))
->values(array(
'menu_name' => 'secondary-links',
'mlid' => '206',
'plid' => '0',
'link_path' => 'node',
'router_path' => 'node',
'link_title' => 'node-page-with-query',
'options' => 'a:2:{s:5:"query";s:14:"page=1&node=10";s:10:"attributes";a:1:{s:5:"title";s:0:"";}}',
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'expanded' => '0',
'weight' => '2',
'depth' => '1',
'customized' => '1',
'p1' => '206',
'p2' => '0',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
'updated' => '0',
))
->execute();
db_insert('blocks')->fields(array(
'bid',
'module',
'delta',
'theme',
'status',
'weight',
'region',
'custom',
'throttle',
'visibility',
'pages',
'title',
'cache',
))
->values(array(
'bid' => '4',
'module' => 'menu',
'delta' => 'primary-links',
'theme' => 'garland',
'status' => '1',
'weight' => '0',
'region' => 'left',
'custom' => '0',
'throttle' => '0',
'visibility' => '0',
'pages' => '',
'title' => 'My Primary Links',
'cache' => '-1',
))
->values(array(
'bid' => '5',
'module' => 'menu',
'delta' => 'secondary-links',
'theme' => 'garland',
'status' => '1',
'weight' => '0',
'region' => 'left',
'custom' => '0',
'throttle' => '0',
'visibility' => '0',
'pages' => '',
'title' => 'My Secondary Links',
'cache' => '-1',
))
->execute();

View file

@ -0,0 +1,34 @@
<?php
db_insert('comments')->fields(array(
'cid',
'pid',
'nid',
'uid',
'subject',
'comment',
'hostname',
'timestamp',
'status',
'format',
'thread',
'name',
'mail',
'homepage',
))
->values(array(
'cid' => 1,
'pid' => 0,
'nid' => 37,
'uid' => 3,
'subject' => 'Comment title 1',
'comment' => 'Comment body 1 - Comment body 1 - Comment body 1 - Comment body 1 - Comment body 1 - Comment body 1 - Comment body 1 - Comment body 1',
'hostname' => '127.0.0.1',
'timestamp' => 1008617630,
'status' => 0,
'format' => 1,
'thread' => '01/',
'name' => NULL,
'mail' => NULL,
'homepage' => '',
))
->execute();

View file

@ -0,0 +1,125 @@
<?php
/**
* Database additions for translatable tests.
*/
db_insert('node')->fields(array(
'nid',
'vid',
'type',
'language',
'title',
'uid',
'status',
'created',
'changed',
'comment',
'promote',
'moderate',
'sticky',
'tnid',
'translate',
))
->values(array(
'nid' => '53',
'vid' => '63',
'type' => 'translatable_page',
'language' => 'fr',
'title' => 'First translatable page',
'uid' => '1',
'status' => '1',
'created' => '1298363952',
'changed' => '1298363952',
'comment' => '2',
'promote' => '0',
'moderate' => '0',
'sticky' => '0',
'tnid' => '0',
'translate' => '0',
))
->execute();
db_insert('node_revisions')->fields(array(
'nid',
'vid',
'uid',
'title',
'body',
'teaser',
'log',
'timestamp',
'format',
))
->values(array(
'nid' => '53',
'vid' => '63',
'uid' => '1',
'title' => 'First translatable page',
'body' => 'Body of the first translatable page.',
'teaser' => 'Teaser of the first translatable page.',
'log' => '',
'timestamp' => '1298363952',
'format' => '1',
))
->execute();
db_insert('node_comment_statistics')->fields(array(
'nid',
'last_comment_timestamp',
'last_comment_name',
'last_comment_uid',
'comment_count',
))
->values(array(
'nid' => '53',
'last_comment_timestamp' => '1298363952',
'last_comment_name' => NULL,
'last_comment_uid' => '1',
'comment_count' => '0',
))
->execute();
db_insert('node_type')->fields(array(
'type',
'name',
'module',
'description',
'help',
'has_title',
'title_label',
'has_body',
'body_label',
'min_word_count',
'custom',
'modified',
'locked',
'orig_type',
))
->values(array(
'type' => 'translatable_page',
'name' => 'Translatable page',
'module' => 'node',
'description' => 'A <em>translatable page</em> is like a normal page, but with multilanguage support.',
'help' => '',
'has_title' => '1',
'title_label' => 'Title',
'has_body' => '1',
'body_label' => 'Body',
'min_word_count' => '0',
'custom' => '0',
'modified' => '0',
'locked' => '1',
'orig_type' => '',
))
->execute();
db_insert('variable')->fields(array(
'name',
'value',
))
->values(array(
'name' => 'language_content_type_translatable_page',
'value' => 's:1:"1";',
))
->execute();

View file

@ -0,0 +1,82 @@
<?php
/**
* @file
* Test content for the trigger upgrade path.
*/
db_create_table('trigger_assignments', array(
'fields' => array(
'hook' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'op' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'aid' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('hook', 'op', 'aid'),
'module' => 'trigger',
'name' => 'trigger_assignments',
));
// Add several trigger configurations.
db_insert('trigger_assignments')->fields(array(
'hook',
'op',
'aid',
'weight',
))
->values(array(
'hook' => 'node',
'op' => 'presave',
'aid' => 'node_publish_action',
'weight' => '1',
))
->values(array(
'hook' => 'comment',
'op' => 'presave',
'aid' => 'comment_publish_action',
'weight' => '1',
))
->values(array(
'hook' => 'comment_delete',
'op' => 'presave',
'aid' => 'node_save_action',
'weight' => '1',
))
->values(array(
'hook' => 'nodeapi',
'op' => 'presave',
'aid' => 'node_make_sticky_action',
'weight' => '1',
))
->values(array(
'hook' => 'nodeapi',
'op' => 'somehow_nodeapi_got_a_very_long',
'aid' => 'node_save_action',
'weight' => '1',
))
->execute();
db_update('system')->fields(array(
'schema_version' => '6000',
'status' => '1',
))
->condition('filename', 'modules/trigger/trigger.module')
->execute();

View file

@ -0,0 +1,544 @@
<?php
db_insert('files')->fields(array(
'fid',
'uid',
'filename',
'filepath',
'filemime',
'filesize',
'status',
'timestamp',
))
/*
* This entry is deliberately omitted to test the upgrade routine when facing
* possible data corruption.
*
->values(array(
'fid' => '1',
'uid' => '1',
'filename' => 'powered-blue-80x15.png',
'filepath' => 'sites/default/files/powered-blue-80x15.png',
'filemime' => 'image/png',
'filesize' => '1011',
'status' => '1',
'timestamp' => '1285700240',
)) */
->values(array(
'fid' => '2',
'uid' => '1',
'filename' => 'powered-blue-80x15.png',
'filepath' => 'sites/default/files/powered-blue-80x15_0.png',
'filemime' => 'image/png',
'filesize' => '1011',
'status' => '1',
'timestamp' => '1285700317',
))
->values(array(
'fid' => '3',
'uid' => '1',
'filename' => 'powered-blue-88x31.png',
'filepath' => 'sites/default/files/powered-blue-88x31.png',
'filemime' => 'image/png',
'filesize' => '2113',
'status' => '1',
'timestamp' => '1285700343',
))
->values(array(
'fid' => '4',
'uid' => '1',
'filename' => 'powered-blue-135x42.png',
'filepath' => 'sites/default/files/powered-blue-135x42.png',
'filemime' => 'image/png',
'filesize' => '3027',
'status' => '1',
'timestamp' => '1285700366',
))
->values(array(
'fid' => '5',
'uid' => '1',
'filename' => 'powered-black-80x15.png',
'filepath' => 'sites/default/files/powered-black-80x15.png',
'filemime' => 'image/png',
'filesize' => '1467',
'status' => '1',
'timestamp' => '1285700529',
))
->values(array(
'fid' => '6',
'uid' => '1',
'filename' => 'powered-black-135x42.png',
'filepath' => 'sites/default/files/powered-black-135x42.png',
'filemime' => 'image/png',
'filesize' => '2817',
'status' => '1',
'timestamp' => '1285700552',
))
->values(array(
'fid' => '7',
'uid' => '1',
'filename' => 'forum-hot-new.png',
'filepath' => 'sites/default/files/forum-hot-new.png',
'filemime' => 'image/png',
'filesize' => '237',
'status' => '1',
'timestamp' => '1285708937',
))
->values(array(
'fid' => '8',
'uid' => '1',
'filename' => 'forum-hot.png',
'filepath' => 'sites/default/files/forum-hot.png',
'filemime' => 'image/png',
'filesize' => '229',
'status' => '1',
'timestamp' => '1285708944',
))
->values(array(
'fid' => '9',
'uid' => '1',
'filename' => 'forum-new.png',
'filepath' => 'sites/default/files/forum-new.png',
'filemime' => 'image/png',
'filesize' => '175',
'status' => '1',
'timestamp' => '1285708950',
))
->values(array(
'fid' => '10',
'uid' => '1',
'filename' => 'forum-sticky.png',
'filepath' => 'sites/default/files/forum-sticky.png',
'filemime' => 'image/png',
'filesize' => '329',
'status' => '1',
'timestamp' => '1285708957',
))
/*
* This is a case where the path is repeated twice.
*/
->values(array(
'fid' => '11',
'uid' => '1',
'filename' => 'crazy-basename.png',
'filepath' => '/drupal-6/file/directory/path/drupal-6/file/directory/path/crazy-basename.png',
'filemime' => 'image/png',
'filesize' => '329',
'status' => '1',
'timestamp' => '1285708958',
))
// On some Drupal 6 sites, more than one file can have the same filepath. See
// https://www.drupal.org/node/1260938.
->values(array(
'fid' => '12',
'uid' => '1',
'filename' => 'duplicate-name.png',
'filepath' => 'sites/default/files/duplicate-name.png',
'filemime' => 'image/png',
'filesize' => '314',
'status' => '1',
'timestamp' => '1285708958',
))
->values(array(
'fid' => '13',
'uid' => '1',
'filename' => 'duplicate-name.png',
'filepath' => 'sites/default/files/duplicate-name.png',
'filemime' => 'image/png',
'filesize' => '315',
'status' => '1',
'timestamp' => '1285708958',
))
->values(array(
'fid' => '14',
'uid' => '1',
'filename' => 'duplicate-name.png',
'filepath' => 'sites/default/files/duplicate-name.png',
'filemime' => 'image/png',
'filesize' => '316',
'status' => '1',
'timestamp' => '1285708958',
))
->execute();
db_insert('node')->fields(array(
'nid',
'vid',
'type',
'language',
'title',
'uid',
'status',
'created',
'changed',
'comment',
'promote',
'moderate',
'sticky',
'tnid',
'translate',
))
->values(array(
'nid' => '38',
'vid' => '50',
'type' => 'page',
'language' => '',
'title' => 'node title 38 revision 50',
'uid' => '1',
'status' => '1',
'created' => '1285603317',
'changed' => '1285603317',
'comment' => '0',
'promote' => '0',
'moderate' => '0',
'sticky' => '0',
'tnid' => '0',
'translate' => '0',
))
->values(array(
'nid' => '39',
'vid' => '52',
'type' => 'page',
'language' => '',
'title' => 'node title 39 revision 52',
'uid' => '1',
'status' => '1',
'created' => '1285700317',
'changed' => '1285700600',
'comment' => '0',
'promote' => '0',
'moderate' => '0',
'sticky' => '0',
'tnid' => '0',
'translate' => '0',
))
->values(array(
'nid' => '40',
'vid' => '53',
'type' => 'page',
'language' => '',
'title' => 'node title 40 revision 53',
'uid' => '1',
'status' => '1',
'created' => '1285709012',
'changed' => '1285709012',
'comment' => '0',
'promote' => '0',
'moderate' => '0',
'sticky' => '0',
'tnid' => '0',
'translate' => '0',
))
->values(array(
'nid' => '41',
'vid' => '55',
'type' => 'page',
'language' => '',
'title' => 'node title 41 revision 55',
'uid' => '1',
'status' => '1',
'created' => '1285709012',
'changed' => '1285709012',
'comment' => '0',
'promote' => '0',
'moderate' => '0',
'sticky' => '0',
'tnid' => '0',
'translate' => '0',
))
->execute();
db_insert('node_revisions')->fields(array(
'nid',
'vid',
'uid',
'title',
'body',
'teaser',
'log',
'timestamp',
'format',
))
->values(array(
'nid' => '38',
'vid' => '50',
'uid' => '1',
'title' => 'node title 38 revision 50',
'body' => "Attachments:\r\npowered-blue-80x15.png",
'teaser' => "Attachments:\r\npowered-blue-80x15.png",
'log' => '',
'timestamp' => '1285603317',
'format' => '1',
))
->values(array(
'nid' => '39',
'vid' => '51',
'uid' => '1',
'title' => 'node title 39 revision 51',
'body' => "Attachments:\r\npowered-blue-80x15.png\r\npowered-blue-88x31.png\r\npowered-blue-135x42.png",
'teaser' => "Attachments:\r\npowered-blue-80x15.png\r\npowered-blue-88x31.png\r\npowered-blue-135x42.png",
'log' => '',
'timestamp' => '1285700487',
'format' => '1',
))
->values(array(
'nid' => '39',
'vid' => '52',
'uid' => '1',
'title' => 'node title 39 revision 52',
'body' => "Attachments:\r\npowered-blue-88x31.png\r\npowered-black-80x15.png\r\npowered-black-135x42.png",
'teaser' => "Attachments:\r\npowered-blue-88x31.png\r\npowered-black-80x15.png\r\npowered-black-135x42.png",
'log' => '',
'timestamp' => '1285700600',
'format' => '1',
))
->values(array(
'nid' => '40',
'vid' => '53',
'uid' => '1',
'title' => 'node title 40 revision 53',
'body' => "Attachments:\r\nforum-hot-new.png\r\nforum-hot.png\r\nforum-sticky.png\r\nforum-new.png\r\ncrazy-basename.png",
'teaser' => "Attachments:\r\nforum-hot-new.png\r\nforum-hot.png\r\nforum-sticky.png\r\nforum-new.png\r\ncrazy-basename.png",
'log' => '',
'timestamp' => '1285709012',
'format' => '1',
))
->values(array(
'nid' => '41',
'vid' => '54',
'uid' => '1',
'title' => 'node title 41 revision 54',
'body' => "Attachments:\r\nduplicate-name.png",
'teaser' => "Attachments:\r\nduplicate-name.png",
'log' => '',
'timestamp' => '1285709012',
'format' => '1',
))
->values(array(
'nid' => '41',
'vid' => '55',
'uid' => '1',
'title' => 'node title 41 revision 55',
'body' => "Attachments:\r\nduplicate-name.png\r\nduplicate-name.png",
'teaser' => "Attachments:\r\nduplicate-name.png\r\nduplicate-name.png",
'log' => '',
'timestamp' => '1285709012',
'format' => '1',
))
->execute();
db_create_table('upload', array(
'fields' => array(
'fid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'description' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'list' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
),
),
'primary key' => array(
'vid',
'fid',
),
'indexes' => array(
'fid' => array(
'fid',
),
'nid' => array(
'nid',
),
),
'module' => 'upload',
'name' => 'upload',
));
db_insert('upload')->fields(array(
'fid',
'nid',
'vid',
'description',
'list',
'weight',
))
->values(array(
'fid' => '1',
'nid' => '38',
'vid' => '50',
'description' => 'powered-blue-80x15.png',
'list' => '1',
'weight' => '0',
))
->values(array(
'fid' => '2',
'nid' => '39',
'vid' => '51',
'description' => 'powered-blue-80x15.png',
'list' => '1',
'weight' => '0',
))
->values(array(
'fid' => '3',
'nid' => '39',
'vid' => '51',
'description' => 'powered-blue-88x31.png',
'list' => '1',
'weight' => '0',
))
->values(array(
'fid' => '4',
'nid' => '39',
'vid' => '51',
'description' => 'powered-blue-135x42.png',
'list' => '1',
'weight' => '0',
))
->values(array(
'fid' => '3',
'nid' => '39',
'vid' => '52',
'description' => 'powered-blue-88x31.png',
'list' => '1',
'weight' => '0',
))
->values(array(
'fid' => '5',
'nid' => '39',
'vid' => '52',
'description' => 'powered-black-80x15.png',
'list' => '1',
'weight' => '0',
))
->values(array(
'fid' => '6',
'nid' => '39',
'vid' => '52',
'description' => 'powered-black-135x42.png',
'list' => '1',
'weight' => '0',
))
->values(array(
'fid' => '7',
'nid' => '40',
'vid' => '53',
'description' => 'forum-hot-new.png',
'list' => '1',
'weight' => '-4',
))
->values(array(
'fid' => '8',
'nid' => '40',
'vid' => '53',
'description' => 'forum-hot.png',
'list' => '1',
'weight' => '-3',
))
->values(array(
'fid' => '10',
'nid' => '40',
'vid' => '53',
'description' => 'forum-sticky.png',
'list' => '1',
'weight' => '-2',
))
->values(array(
'fid' => '9',
'nid' => '40',
'vid' => '53',
'description' => 'forum-new.png',
'list' => '1',
'weight' => '-1',
))
->values(array(
'fid' => '11',
'nid' => '40',
'vid' => '53',
'description' => 'crazy-basename.png',
'list' => '1',
'weight' => '0',
))
->values(array(
'fid' => '12',
'nid' => '41',
'vid' => '54',
'description' => 'duplicate-name.png',
'list' => '1',
'weight' => '0',
))
->values(array(
'fid' => '13',
'nid' => '41',
'vid' => '55',
'description' => 'first description',
'list' => '0',
'weight' => '0',
))
->values(array(
'fid' => '14',
'nid' => '41',
'vid' => '55',
'description' => 'second description',
'list' => '1',
'weight' => '0',
))
->execute();
// Add series of entries for invalid node vids to the {upload} table.
for ($i = 30; $i < 250; $i += 2) {
db_insert('upload')->fields(array(
'fid',
'nid',
'vid',
'description',
'list',
'weight',
))
// Invalid fid, invalid vid.
->values(array(
'fid' => $i,
'nid' => '40',
'vid' => 26 + $i,
'description' => 'crazy-basename.png',
'list' => '1',
'weight' => '0',
))
// Valid fid, invalid vid.
->values(array(
'fid' => 2,
'nid' => '40',
'vid' => 26 + $i + 1,
'description' => 'crazy-basename.png',
'list' => '1',
'weight' => '0',
))
->execute();
}

View file

@ -0,0 +1,10 @@
<?php
db_insert('variable')->fields(array(
'name',
'value',
))
->values(array(
'name' => 'user_mail_register_no_approval_required_body',
'value' => 's:86:"!username, !site, !uri, !uri_brief, !mailto, !date, !login_uri, !edit_uri, !login_url.";',
))
->execute();

View file

@ -0,0 +1,55 @@
<?php
db_insert('variable')->fields(array(
'name',
'value',
))
->values(array(
'name' => 'user_mail_register_no_approval_required_body',
'value' => 's:97:"!password, !username, !site, !uri, !uri_brief, !mailto, !date, !login_uri, !edit_uri, !login_url.";',
))
->execute();
db_insert('users')->fields(array(
'uid',
'name',
'pass',
'mail',
'mode',
'sort',
'threshold',
'theme',
'signature',
'signature_format',
'created',
'access',
'login',
'status',
'timezone',
'language',
'picture',
'init',
'data',
))
->values(array(
'uid' => 3,
'name' => 'hashtester',
// This is not a valid D7 hash, but a truncated one.
'pass' => '$S$DAK00p3Dkojkf4O/UizYxenguXnjv',
'mail' => 'hashtester@example.com',
'mode' => '0',
'sort' => '0',
'threshold' => '0',
'theme' => '',
'signature' => '',
'signature_format' => '0',
'created' => '1277671599',
'access' => '1277671612',
'login' => '1277671612',
'status' => '1',
'timezone' => '-21600',
'language' => '',
'picture' => '',
'init' => 'hashtester@example.com',
'data' => 'a:0:{}',
))
->execute();

View file

@ -0,0 +1,149 @@
<?php
/**
* @file
* Test content for the aggregator update path.
*/
db_insert('aggregator_feed')->fields(array(
'fid',
'title',
'url',
'refresh',
'checked',
'queued',
'link',
'description',
'image',
'hash',
'etag',
'modified',
'block',
))
->values(array(
'fid' => '1',
'title' => 'Drupal commit log',
'url' => 'http://drupal.org/commitlog/feed',
'refresh' => '3600',
'checked' => '1347209523',
'queued' => '0',
'link' => 'http://drupal.org/versioncontrol/garbage/path',
'description' => '',
'image' => '',
'hash' => '84f57ae5bffa7fd56942a6293be91244d8551cd18204a7c7de6a17065ea4d54d',
'etag' => '"1347206975"',
'modified' => '1347206975',
'block' => '5',
))
->execute();
db_insert('aggregator_item')->fields(array(
'iid',
'fid',
'title',
'link',
'author',
'description',
'timestamp',
'guid',
))
->values(array(
'iid' => '1',
'fid' => '1',
'title' => 'Domain Access: Commit b904022 on 7.x-2.x authored by bforchhammer, committed by agentrickard',
'link' => 'http://drupal.org/commitlog/commit/2%2C410/b90402243b4a9dee0d2e2c4a729dcb2f58dc53c0',
'author' => 'bforchhammer',
'description' => "<div class=\"view view-commitlog-commit-items view-id-commitlog_commit_items view-display-id-block_1 view-dom-id-10\">\n \n \n \n <div class=\"view-content\">\n <div class=\"views-row views-row-1 views-row-odd views-row-first\">\n \n <div class=\"views-field-path\">\n <span class=\"field-content\"><a href=\"http://drupalcode.org/project/domain.git/blob/b90402243b4a9dee0d2e2c4a729dcb2f58dc53c0:/domain_source/domain_source.info\">/domain_source/domain_source.info</a></span>\n </div>\n \n <div class=\"views-field-changed-lines\">\n <span class=\"field-content\">1 addition & 1 deletion</span>\n </div>\n \n <div class=\"views-field-visual-diffstat\">\n <span class=\"field-content\"><span class=\"versioncontrol-diffstat clear-block\"><span class=\"plus\">+</span><span class=\"minus\">-</span><span class=\"no-op\"> </span><span class=\"no-op\"> </span><span class=\"no-op\"> </span><span class=\"no-op\"> </span><span class=\"no-op\"> </span></span></span>\n </div>\n </div>\n <div class=\"views-row views-row-2 views-row-even views-row-last\">\n \n <div class=\"views-field-path\">\n <span class=\"field-content\"><a href=\"http://drupalcode.org/project/domain.git/blob/b90402243b4a9dee0d2e2c4a729dcb2f58dc53c0:/domain_source/domain_source.views.inc\">/domain_source/domain_source.views.inc</a></span>\n </div>\n \n <div class=\"views-field-changed-lines\">\n <span class=\"field-content\">13 additions & 1 deletion</span>\n </div>\n \n <div class=\"views-field-visual-diffstat\">\n <span class=\"field-content\"><span class=\"versioncontrol-diffstat clear-block\"><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"minus\">-</span></span></span>\n </div>\n </div>\n </div>\n \n \n \n \n \n \n</div>\n<pre>Patch #1685658 by bforchhammer. Better handling of current domain for Domain Source.\n</pre>",
'timestamp' => '1347206044',
'guid' => 'VCS Operation 3936918 at http://drupal.org',
))
->values(array(
'iid' => '2',
'fid' => '1',
'title' => 'Video: Commit b0b7ff0 on 7.x-2.x by Jorrit',
'link' => 'http://drupal.org/commitlog/commit/846/b0b7ff08fed89c76454aa54627cc219361365d7b',
'author' => 'Jorrit',
'description' => "<div class=\"view view-commitlog-commit-items view-id-commitlog_commit_items view-display-id-block_1 view-dom-id-9\">\n \n \n \n <div class=\"view-content\">\n <div class=\"views-row views-row-1 views-row-odd views-row-first\">\n \n <div class=\"views-field-path\">\n <span class=\"field-content\"><a href=\"http://drupalcode.org/project/video.git/blob/b0b7ff08fed89c76454aa54627cc219361365d7b:/libraries/phpvideotoolkit/phpvideotoolkit.php5.php\">/libraries/phpvideotoolkit/phpvideotoolkit.php5.php</a></span>\n </div>\n \n <div class=\"views-field-changed-lines\">\n <span class=\"field-content\">5 additions & 5 deletions</span>\n </div>\n \n <div class=\"views-field-visual-diffstat\">\n <span class=\"field-content\"><span class=\"versioncontrol-diffstat clear-block\"><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"minus\">-</span><span class=\"minus\">-</span><span class=\"minus\">-</span><span class=\"no-op\"> </span></span></span>\n </div>\n </div>\n <div class=\"views-row views-row-2 views-row-even\">\n \n <div class=\"views-field-path\">\n <span class=\"field-content\"><a href=\"http://drupalcode.org/project/video.git/blob/b0b7ff08fed89c76454aa54627cc219361365d7b:/tests/TranscoderAbstractionFactoryFfmpeg.test\">/tests/TranscoderAbstractionFactoryFfmpeg.test</a></span>\n </div>\n \n <div class=\"views-field-changed-lines\">\n <span class=\"field-content\">21 additions & 7 deletions</span>\n </div>\n \n <div class=\"views-field-visual-diffstat\">\n <span class=\"field-content\"><span class=\"versioncontrol-diffstat clear-block\"><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"minus\">-</span><span class=\"minus\">-</span></span></span>\n </div>\n </div>\n <div class=\"views-row views-row-3 views-row-odd views-row-last\">\n \n <div class=\"views-field-path\">\n <span class=\"field-content\"><a href=\"http://drupalcode.org/project/video.git/blob/b0b7ff08fed89c76454aa54627cc219361365d7b:/transcoders/TranscoderAbstractionFactoryFfmpeg.inc\">/transcoders/TranscoderAbstractionFactoryFfmpeg.inc</a></span>\n </div>\n \n <div class=\"views-field-changed-lines\">\n <span class=\"field-content\">31 additions & 22 deletions</span>\n </div>\n \n <div class=\"views-field-visual-diffstat\">\n <span class=\"field-content\"><span class=\"versioncontrol-diffstat clear-block\"><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"minus\">-</span><span class=\"minus\">-</span><span class=\"minus\">-</span></span></span>\n </div>\n </div>\n </div>\n \n \n \n \n \n \n</div>\n<pre>Issue #1492296 by Jorrit: Added support for avconv binaries instead of FFmpeg.\n</pre>",
'timestamp' => '1347206397',
'guid' => 'VCS Operation 3936924 at http://drupal.org',
))
->values(array(
'iid' => '3',
'fid' => '1',
'title' => 'Remove Login Tabs: Commit 6e1eb5a on 7.x-1.x by highrockmedia',
'link' => 'http://drupal.org/commitlog/commit/41%2C610/6e1eb5a4a952db3264e7696e840ac3d797f4b477',
'author' => 'highrockmedia',
'description' => "<div class=\"view view-commitlog-commit-items view-id-commitlog_commit_items view-display-id-block_1 view-dom-id-8\">\n \n \n \n <div class=\"view-content\">\n <div class=\"views-row views-row-1 views-row-odd views-row-first views-row-last\">\n \n <div class=\"views-field-path\">\n <span class=\"field-content\"><a href=\"http://drupalcode.org/sandbox/highrockmedia/1702096.git/blob/6e1eb5a4a952db3264e7696e840ac3d797f4b477:/readme.txt\">/readme.txt</a></span>\n </div>\n \n <div class=\"views-field-changed-lines\">\n <span class=\"field-content\">10 additions & 2 deletions</span>\n </div>\n \n <div class=\"views-field-visual-diffstat\">\n <span class=\"field-content\"><span class=\"versioncontrol-diffstat clear-block\"><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"minus\">-</span></span></span>\n </div>\n </div>\n </div>\n \n \n \n \n \n \n</div>\n<pre>Updating readme\n</pre>",
'timestamp' => '1347206401',
'guid' => 'VCS Operation 3936920 at http://drupal.org',
))
->values(array(
'iid' => '4',
'fid' => '1',
'title' => 'TimeGroup: Commit 6ed4c08 on 7.x-1.x by Sweetchuck',
'link' => 'http://drupal.org/commitlog/commit/40%2C448/6ed4c085e5d9a8d33e091e1b8a65c73eab2dc99e',
'author' => 'Sweetchuck',
'description' => "<div class=\"view view-commitlog-commit-items view-id-commitlog_commit_items view-display-id-block_1 view-dom-id-7\">\n \n \n \n <div class=\"view-content\">\n <div class=\"views-row views-row-1 views-row-odd views-row-first views-row-last\">\n \n <div class=\"views-field-path\">\n <span class=\"field-content\"><a href=\"http://drupalcode.org/sandbox/Sweetchuck/1666642.git/blob/6ed4c085e5d9a8d33e091e1b8a65c73eab2dc99e:/includes/ctools/export_ui/timegroup.inc\">/includes/ctools/export_ui/timegroup.inc</a></span>\n </div>\n \n <div class=\"views-field-changed-lines\">\n <span class=\"field-content\">1 addition & 1 deletion</span>\n </div>\n \n <div class=\"views-field-visual-diffstat\">\n <span class=\"field-content\"><span class=\"versioncontrol-diffstat clear-block\"><span class=\"plus\">+</span><span class=\"minus\">-</span><span class=\"no-op\"> </span><span class=\"no-op\"> </span><span class=\"no-op\"> </span><span class=\"no-op\"> </span><span class=\"no-op\"> </span></span></span>\n </div>\n </div>\n </div>\n \n \n \n \n \n \n</div>\n<pre>CTools UI - Wrong default value for timeoffset fix.\n</pre>",
'timestamp' => '1347206533',
'guid' => 'VCS Operation 3936942 at http://drupal.org',
))
->values(array(
'iid' => '5',
'fid' => '1',
'title' => 'Domain Access: Commit 1140172 on 6.x-2.x authored by bforchhammer, committed by agentrickard',
'link' => 'http://drupal.org/commitlog/commit/2%2C410/11401723f5c5d11032dd141ba4939ed889a7a915',
'author' => 'bforchhammer',
'description' => "<div class=\"view view-commitlog-commit-items view-id-commitlog_commit_items view-display-id-block_1 view-dom-id-6\">\n \n \n \n <div class=\"view-content\">\n <div class=\"views-row views-row-1 views-row-odd views-row-first\">\n \n <div class=\"views-field-path\">\n <span class=\"field-content\"><a href=\"http://drupalcode.org/project/domain.git/blob/11401723f5c5d11032dd141ba4939ed889a7a915:/domain_source/domain_source.views.inc\">/domain_source/domain_source.views.inc</a></span>\n </div>\n \n <div class=\"views-field-changed-lines\">\n <span class=\"field-content\">33 additions & 1 deletion</span>\n </div>\n \n <div class=\"views-field-visual-diffstat\">\n <span class=\"field-content\"><span class=\"versioncontrol-diffstat clear-block\"><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"no-op\"> </span></span></span>\n </div>\n </div>\n <div class=\"views-row views-row-2 views-row-even views-row-last\">\n \n <div class=\"views-field-path\">\n <span class=\"field-content\"><a href=\"http://drupalcode.org/project/domain.git/blob/11401723f5c5d11032dd141ba4939ed889a7a915:/domain_source/includes/domain_source_handler_filter_domain_id.inc\">/domain_source/includes/domain_source_handler_filter_domain_id.inc</a></span>\n </div>\n \n <div class=\"views-field-changed-lines\">\n <span class=\"field-content\">28 additions & 0 deletions</span>\n </div>\n \n <div class=\"views-field-visual-diffstat\">\n <span class=\"field-content\"><span class=\"versioncontrol-diffstat clear-block\"><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span></span></span>\n </div>\n </div>\n </div>\n \n \n \n \n \n \n</div>\n<pre>Patch #1685658 by bforchhammer. Better handling of current domain for Domain Source.\n</pre>",
'timestamp' => '1347206541',
'guid' => 'VCS Operation 3936926 at http://drupal.org',
))
->values(array(
'iid' => '6',
'fid' => '1',
'title' => 'Domain Access: Commit 19b1c36 on 7.x-2.x by agentrickard',
'link' => 'http://drupal.org/commitlog/commit/2%2C410/19b1c366d86cecd8a9f6e1a6e835c0566f5c02db',
'author' => 'agentrickard',
'description' => "<div class=\"view view-commitlog-commit-items view-id-commitlog_commit_items view-display-id-block_1 view-dom-id-5\">\n \n \n \n <div class=\"view-content\">\n <div class=\"views-row views-row-1 views-row-odd views-row-first views-row-last\">\n \n <div class=\"views-field-path\">\n <span class=\"field-content\"><a href=\"http://drupalcode.org/project/domain.git/blob/19b1c366d86cecd8a9f6e1a6e835c0566f5c02db:/domain_source/includes/domain_source_handler_filter_domain_id.inc\">/domain_source/includes/domain_source_handler_filter_domain_id.inc</a></span>\n </div>\n \n <div class=\"views-field-changed-lines\">\n <span class=\"field-content\">28 additions & 0 deletions</span>\n </div>\n \n <div class=\"views-field-visual-diffstat\">\n <span class=\"field-content\"><span class=\"versioncontrol-diffstat clear-block\"><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span></span></span>\n </div>\n </div>\n </div>\n \n \n \n \n \n \n</div>\n<pre>Adds new Views file to Domain Source.\n</pre>",
'timestamp' => '1347206601',
'guid' => 'VCS Operation 3936928 at http://drupal.org',
))
->values(array(
'iid' => '7',
'fid' => '1',
'title' => 'Domain Access: Commit d2d5456 on 7.x-3.x by agentrickard',
'link' => 'http://drupal.org/commitlog/commit/2%2C410/d2d5456cad6ca57bb72e743da6a7112a74d7a331',
'author' => 'agentrickard',
'description' => "<div class=\"view view-commitlog-commit-items view-id-commitlog_commit_items view-display-id-block_1 view-dom-id-4\">\n \n \n \n <div class=\"view-content\">\n <div class=\"views-row views-row-1 views-row-odd views-row-first views-row-last\">\n \n <div class=\"views-field-path\">\n <span class=\"field-content\"><a href=\"http://drupalcode.org/project/domain.git/blob/d2d5456cad6ca57bb72e743da6a7112a74d7a331:/domain_source/includes/domain_source_handler_filter_domain_id.inc\">/domain_source/includes/domain_source_handler_filter_domain_id.inc</a></span>\n </div>\n \n <div class=\"views-field-changed-lines\">\n <span class=\"field-content\">29 additions & 0 deletions</span>\n </div>\n \n <div class=\"views-field-visual-diffstat\">\n <span class=\"field-content\"><span class=\"versioncontrol-diffstat clear-block\"><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span></span></span>\n </div>\n </div>\n </div>\n \n \n \n \n \n \n</div>\n<pre>Adds new Views file to Domain Source.\n</pre>",
'timestamp' => '1347206620',
'guid' => 'VCS Operation 3936930 at http://drupal.org',
))
->values(array(
'iid' => '8',
'fid' => '1',
'title' => 'Skarabee: Commit 400b519 on 7.x-1.x by sboersma',
'link' => 'http://drupal.org/commitlog/commit/23%2C278/400b5190f59b1cb58d6b27fa10ac668e9580aa73',
'author' => 'sboersma',
'description' => "<div class=\"view view-commitlog-commit-items view-id-commitlog_commit_items view-display-id-block_1 view-dom-id-3\">\n \n \n \n <div class=\"view-content\">\n <div class=\"views-row views-row-1 views-row-odd views-row-first views-row-last\">\n \n <div class=\"views-field-path\">\n <span class=\"field-content\"><a href=\"http://drupalcode.org/sandbox/sboersma/1176520.git/blob/400b5190f59b1cb58d6b27fa10ac668e9580aa73:/skarabee.install\">/skarabee.install</a></span>\n </div>\n \n <div class=\"views-field-changed-lines\">\n <span class=\"field-content\">3 additions & 3 deletions</span>\n </div>\n \n <div class=\"views-field-visual-diffstat\">\n <span class=\"field-content\"><span class=\"versioncontrol-diffstat clear-block\"><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"minus\">-</span><span class=\"minus\">-</span><span class=\"minus\">-</span><span class=\"no-op\"> </span></span></span>\n </div>\n </div>\n </div>\n \n \n \n \n \n \n</div>\n<pre>sboersma: Changed variable deletion method.\n</pre>",
'timestamp' => '1347206709',
'guid' => 'VCS Operation 3936932 at http://drupal.org',
))
->values(array(
'iid' => '9',
'fid' => '1',
'title' => 'Config entity listing plugin API: Commit dd3fa73 on 8.x-list by damiankloip',
'link' => 'http://drupal.org/commitlog/commit/43%2C586/dd3fa73b0bcdca833bbde1d1ddb3cefe42003693',
'author' => 'damiankloip',
'description' => "<div class=\"view view-commitlog-commit-items view-id-commitlog_commit_items view-display-id-block_1 view-dom-id-2\">\n \n \n \n <div class=\"view-content\">\n <div class=\"views-row views-row-1 views-row-odd views-row-first views-row-last\">\n \n <div class=\"views-field-path\">\n <span class=\"field-content\"><a href=\"http://drupalcode.org/sandbox/damiankloip/1778654.git/blob/dd3fa73b0bcdca833bbde1d1ddb3cefe42003693:/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListingTest.php\">/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListingTest.php</a></span>\n </div>\n \n <div class=\"views-field-changed-lines\">\n <span class=\"field-content\">10 additions & 2 deletions</span>\n </div>\n \n <div class=\"views-field-visual-diffstat\">\n <span class=\"field-content\"><span class=\"versioncontrol-diffstat clear-block\"><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"minus\">-</span></span></span>\n </div>\n </div>\n </div>\n \n \n \n \n \n \n</div>\n<pre>Added tests for getList() method\n</pre>",
'timestamp' => '1347206738',
'guid' => 'VCS Operation 3936936 at http://drupal.org',
))
->values(array(
'iid' => '10',
'fid' => '1',
'title' => 'AutoSlave: Commit 76891da on 7.x-1.x by gielfeldt',
'link' => 'http://drupal.org/commitlog/commit/42%2C968/76891daf3cea9c294daf56a26760cb1bf33ea58a',
'author' => 'gielfeldt',
'description' => "<div class=\"view view-commitlog-commit-items view-id-commitlog_commit_items view-display-id-block_1 view-dom-id-1\">\n \n \n \n <div class=\"view-content\">\n <div class=\"views-row views-row-1 views-row-odd views-row-first\">\n \n <div class=\"views-field-path\">\n <span class=\"field-content\"><a href=\"http://drupalcode.org/project/autoslave.git/blob/76891daf3cea9c294daf56a26760cb1bf33ea58a:/autoslave.module\">/autoslave.module</a></span>\n </div>\n \n <div class=\"views-field-changed-lines\">\n <span class=\"field-content\">10 additions & 7 deletions</span>\n </div>\n \n <div class=\"views-field-visual-diffstat\">\n <span class=\"field-content\"><span class=\"versioncontrol-diffstat clear-block\"><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"minus\">-</span><span class=\"minus\">-</span><span class=\"minus\">-</span></span></span>\n </div>\n </div>\n <div class=\"views-row views-row-2 views-row-even views-row-last\">\n \n <div class=\"views-field-path\">\n <span class=\"field-content\"><a href=\"http://drupalcode.org/project/autoslave.git/blob/76891daf3cea9c294daf56a26760cb1bf33ea58a:/autoslave/database.inc\">/autoslave/database.inc</a></span>\n </div>\n \n <div class=\"views-field-changed-lines\">\n <span class=\"field-content\">10 additions & 2 deletions</span>\n </div>\n \n <div class=\"views-field-visual-diffstat\">\n <span class=\"field-content\"><span class=\"versioncontrol-diffstat clear-block\"><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"plus\">+</span><span class=\"minus\">-</span></span></span>\n </div>\n </div>\n </div>\n \n \n \n \n \n \n</div>\n<pre>Keep track of affected tables per commit.\n</pre>",
'timestamp' => '1347206751',
'guid' => 'VCS Operation 3936934 at http://drupal.org',
))
->execute();

View file

@ -0,0 +1,16 @@
<?php
/**
* @file
* Test content for the field update path.
*/
db_insert('variable')->fields(array(
'name',
'value',
))
->values(array(
'name' => 'field_bundle_settings',
'value' => 'a:1:{s:4:"node";a:1:{s:4:"poll";a:1:{s:12:"extra_fields";a:1:{s:7:"display";a:2:{s:16:"poll_view_voting";a:1:{s:7:"default";a:2:{s:6:"weight";s:1:"0";s:7:"visible";b:1;}}s:17:"poll_view_results";a:1:{s:7:"default";a:2:{s:6:"weight";s:1:"0";s:7:"visible";b:0;}}}}}}}',
))
->execute();

View file

@ -0,0 +1,28 @@
<?php
/**
* @file
* Test content for the trigger upgrade path.
*/
// Add several trigger configurations.
db_insert('trigger_assignments')->fields(array(
'hook',
'aid',
'weight',
))
->values(array(
'hook' => 'node_presave',
'aid' => 'node_publish_action',
'weight' => '1',
))
->values(array(
'hook' => 'comment_presave',
'aid' => 'comment_publish_action',
'weight' => '1',
))
->values(array(
'hook' => 'comment_delete',
'aid' => 'node_save_action',
'weight' => '1',
))
->execute();

View file

@ -0,0 +1,47 @@
<?php
/**
* @file
* Tests schema changes in aggregator.module.
*/
class AggregatorUpdatePathTestCase extends UpdatePathTestCase {
public static function getInfo() {
return array(
'name' => 'Aggregator update path',
'description' => 'Aggregator update path tests.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Use the normal installation and add our feed data.
$path = drupal_get_path('module', 'simpletest') . '/tests/upgrade';
$this->databaseDumpFiles = array(
$path . '/drupal-7.bare.standard_all.database.php.gz',
$path . '/drupal-7.aggregator.database.php',
);
parent::setUp();
// Our test data only relies on aggregator.module.
$this->uninstallModulesExcept(array('aggregator'));
}
/**
* Tests that the aggregator.module update is successful.
*/
public function testAggregatorUpdate() {
// Get a selection of the fields affected by the schema update.
$query = db_select('aggregator_feed', 'af');
$query->join('aggregator_item', 'ai', 'af.fid = ai.fid');
$query
->fields('af', array('url', 'link'))
->fields('ai', array('link', 'guid'));
$pre_update_data = $query->execute()->fetchAll();
$this->assertTrue($this->performUpgrade(), 'The update was completed successfully.');
$post_update_data = $query->execute()->fetchAll();
$this->assertTrue($pre_update_data == $post_update_data, 'Feed data was preserved during the update.');
}
}

View file

@ -0,0 +1,61 @@
<?php
/**
* @file
* Provides update path tests for the Field module.
*/
/**
* Tests the Field 7.0 -> 7.x update path.
*/
class FieldUpdatePathTestCase extends UpdatePathTestCase {
public static function getInfo() {
return array(
'name' => 'Field update path',
'description' => 'Field update path tests.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Use the filled update path and our field data.
$path = drupal_get_path('module', 'simpletest') . '/tests/upgrade';
$this->databaseDumpFiles = array(
$path . '/drupal-7.filled.standard_all.database.php.gz',
$path . '/drupal-7.field.database.php',
);
parent::setUp();
// Our test data includes poll extra field settings.
$this->uninstallModulesExcept(array('field', 'poll'));
}
/**
* Tests that the update is successful.
*/
public function testFilledUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The update was completed successfully.');
$expected_settings = array(
'extra_fields' => array(
'display' => array(
'poll_view_voting' => array(
'default' => array(
'weight' => '0',
'visible' => TRUE,
),
),
'poll_view_results' => array(
'default' => array(
'weight' => '0',
'visible' => FALSE,
),
),
),
'form' => array(),
),
'view_modes' => array(),
);
$actual_settings = field_bundle_settings('node', 'poll');
$this->assertEqual($expected_settings, $actual_settings, 'Settings stored in field_bundle_settings were updated to per-bundle settings.');
}
}

View file

@ -0,0 +1,37 @@
<?php
/**
* @file
* Provides upgrade path tests for the Trigger module.
*/
/**
* Tests the Trigger 7.0 -> 7.x upgrade path.
*/
class TriggerUpdatePathTestCase extends UpdatePathTestCase {
public static function getInfo() {
return array(
'name' => 'Trigger update path',
'description' => 'Trigger update path tests.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Use the filled upgrade path and our trigger data.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.filled.standard_all.database.php.gz',
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.trigger.database.php',
);
parent::setUp();
// Our test data includes node and comment trigger assignments.
$this->uninstallModulesExcept(array('comment', 'trigger'));
}
/**
* Tests that the upgrade is successful.
*/
public function testFilledUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
}
}

View file

@ -0,0 +1,35 @@
<?php
/**
* @file
* Provides update path tests for the User module.
*/
/**
* Tests the User 7.0 -> 7.x update path.
*/
class UserUpdatePathTestCase extends UpdatePathTestCase {
public static function getInfo() {
return array(
'name' => 'User update path',
'description' => 'User update path tests.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Use the filled update path and our field data.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.filled.standard_all.database.php.gz',
);
parent::setUp();
}
/**
* Tests that the update is successful.
*/
public function testFilledUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The update was completed successfully.');
$this->assertTrue(db_index_exists('users', 'picture'), 'The {users}.picture column has an index.');
}
}

View file

@ -0,0 +1,32 @@
<?php
/**
* Upgrade test for comment.module.
*/
class CommentUpgradePathTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'Comment upgrade path',
'description' => 'Comment upgrade path tests.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump files.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.comments.database.php',
);
parent::setUp();
$this->uninstallModulesExcept(array('comment'));
}
/**
* Test a successful upgrade.
*/
public function testCommentUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
}
}

View file

@ -0,0 +1,55 @@
<?php
/**
* Upgrade test for filter format identifiers.
*
* Filter format identifiers changed from sequential ids to machine names.
* Verify that filter formats and references to filter formats in core are
* converted properly.
*/
class FilterFormatUpgradePathTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'Filter format upgrade path',
'description' => 'Verifies that filter formats and references to filter formats are converted properly.',
'group' => 'Upgrade path',
);
}
function setUp() {
// Path to the database dump.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
);
parent::setUp();
}
/**
* Test a successful upgrade.
*/
function testFilterFormatUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
$format = filter_format_load('1');
$this->assertTrue($format->format == '1', 'Filter format found.');
$format->format = 'test_filter';
$format->name = 'Test filter';
filter_format_save($format);
$format = filter_format_load('test_filter');
$this->assertTrue($format->format == 'test_filter', 'Saved a filter format with machine name.');
$account = user_load(4);
user_save($account, array('signature_format' => 'test_filter'));
$account = user_load(4);
$this->assertTrue($account->signature_format == 'test_filter', 'Signature format changed successfully to a filter format with machine name.');
$delta = db_insert('block_custom')
->fields(array(
'body' => 'Test block',
'info' => 'Test block',
'format' => 'test_filter',
))
->execute();
$this->assertTrue($delta > 0, 'Created a custom block using a filter format with machine name.');
}
}

View file

@ -0,0 +1,64 @@
<?php
/**
* Upgrade test for forum.module.
*/
class ForumUpgradePathTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'Forum upgrade path',
'description' => 'Upgrade path tests for the Forum module.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump files.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.forum.database.php',
);
parent::setUp();
$this->uninstallModulesExcept(array('comment', 'forum', 'taxonomy'));
}
/**
* Test a successful upgrade (no negotiation).
*/
public function testForumUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// Work around http://drupal.org/node/931512
$this->drupalPost('admin/structure/types/manage/forum/fields', array(), t('Save'));
// The D6 database forum vocabulary contains the term "Fruits" with id 81.
$tid = 81;
$this->drupalGet("forum/$tid");
// There is one forum topic in Fruits, with the title "Apples".
$this->clickLink('Apples');
$this->clickLink('Edit');
// Add a forum topic "Bananas" to the "Fruits" forum.
$edit = array(
'title' => $title = 'Bananas',
'body[' . LANGUAGE_NONE . '][0][value]' => $body = 'It is another fruit.',
);
$this->drupalPost("node/add/forum/$tid", $edit, t('Save'));
$type = t('Forum topic');
$this->assertRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), 'Forum topic was created');
// Retrieve node object, ensure that the topic was created and in the proper forum.
$node = $this->drupalGetNodeByTitle($title);
$this->assertTrue($node != NULL, format_string('Node @title was loaded', array('@title' => $title)));
$this->assertEqual($node->taxonomy_forums[LANGUAGE_NONE][0]['tid'], $tid, 'Saved forum topic was in the expected forum');
$this->drupalGet("forum/$tid");
$this->assertText('Bananas');
$this->drupalLogout();
$this->drupalGet("node/add/forum/$tid");
$this->assertResponse(200, 'User can access forum creation page.');
}
}

View file

@ -0,0 +1,143 @@
<?php
/**
* Upgrade test for locale.module.
*/
class LocaleUpgradePathTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'Locale upgrade path',
'description' => 'Upgrade path tests for the Locale module.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump files.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.locale.database.php',
);
parent::setUp();
$this->uninstallModulesExcept(array('locale', 'comment'));
}
/**
* Test a successful upgrade (no negotiation).
*/
public function testLocaleUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// The home page should be in French.
$this->assertPageInLanguage('', 'fr');
// No prefixed page should exist.
$this->drupalGet('en');
$this->assertResponse(404);
$this->drupalGet('fr');
$this->assertResponse(404);
}
/**
* Test an upgrade with path-based negotiation.
*/
public function testLocaleUpgradePathDefault() {
// LANGUAGE_NEGOTIATION_PATH_DEFAULT.
$this->variable_set('language_negotiation', 1);
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// The home page should be in French.
$this->assertPageInLanguage('', 'fr');
// The language switcher block should be displayed.
$this->assertRaw('block-locale-language', 'The language switcher block is displayed.');
// The French prefix should not be active because French is the default language.
$this->drupalGet('fr');
$this->assertResponse(404);
// The English prefix should be active.
$this->assertPageInLanguage('en', 'en');
}
/**
* Test an upgrade with path-based (with fallback) negotiation.
*/
public function testLocaleUpgradePathFallback() {
// LANGUAGE_NEGOTIATION_PATH.
$this->variable_set('language_negotiation', 2);
// Set the language of the admin user to English.
db_update('users')
->fields(array('language' => 'en'))
->condition('uid', 1)
->execute();
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// Both prefixes should be active.
$this->assertPageInLanguage('fr', 'fr');
$this->assertPageInLanguage('en', 'en');
// The home page should be in the admin user language.
$this->assertPageInLanguage('', 'en');
// The language switcher block should be displayed.
$this->assertRaw('block-locale-language', 'The language switcher block is displayed.');
}
/**
* Test an upgrade with domain-based negotiation.
*/
public function testLocaleUpgradeDomain() {
// LANGUAGE_NEGOTIATION_DOMAIN.
$this->variable_set('language_negotiation', 3);
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// The home page should be in French.
$this->assertPageInLanguage('', 'fr');
// The language switcher block should be displayed.
$this->assertRaw('block-locale-language', 'The language switcher block is displayed.');
// The language switcher block should point to http://en.example.com.
$language_links = $this->xpath('//ul[contains(@class, :class)]/li/a', array(':class' => 'language-switcher-locale-url'));
$found_english_link = FALSE;
foreach ($language_links as $link) {
if ((string) $link['href'] == 'http://en.example.com/') {
$found_english_link = TRUE;
}
}
$this->assertTrue($found_english_link, 'The English link points to the correct domain.');
// Both prefixes should be inactive.
$this->drupalGet('en');
$this->assertResponse(404);
$this->drupalGet('fr');
$this->assertResponse(404);
}
/**
* Asserts that a page exists and is in the specified language.
*/
public function assertPageInLanguage($path = NULL, $langcode) {
if (isset($path)) {
$this->drupalGet($path);
}
if (!$this->assertResponse(200)) {
return FALSE;
}
if ($this->parse()) {
return $this->assertIdentical($langcode, (string) $this->elements['xml:lang']);
}
else {
return FALSE;
}
}
}

View file

@ -0,0 +1,83 @@
<?php
/**
* Upgrade test for menu.module.
*/
class MenuUpgradePathTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'Menu upgrade path',
'description' => 'Menu upgrade path tests.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump files.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.menu.database.php',
);
parent::setUp();
$this->uninstallModulesExcept(array('menu'));
}
/**
* Test a successful upgrade.
*/
public function testMenuUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// Test the migration of "Default menu for content" setting to individual
// node types.
$this->drupalGet('admin/structure/types/manage/page/edit');
$this->assertNoFieldChecked('edit-menu-options-management', 'Management menu is not selected as available menu');
$this->assertNoFieldChecked('edit-menu-options-navigation', 'Navigation menu is not selected as available menu');
$this->assertNoFieldChecked('edit-menu-options-main-menu', 'Main menu is not selected as available menu');
$this->assertFieldChecked('edit-menu-options-secondary-menu', 'Secondary menu is selected as available menu');
$this->assertNoFieldChecked('edit-menu-options-user-menu', 'User menu is not selected as available menu');
$this->assertOptionSelected('edit-menu-parent', 'secondary-menu:0', 'Secondary menu is selected as default parent item');
$this->assertEqual(variable_get('menu_default_node_menu'), NULL, 'Redundant variable menu_default_node_menu has been removed');
// Verify Primary/Secondary Links have been renamed.
$this->drupalGet('admin/structure/menu');
$this->assertNoLinkByHref('admin/structure/menu/manage/primary-links');
$this->assertLinkByHref('admin/structure/menu/manage/main-menu');
$this->assertNoLinkByHref('admin/structure/menu/manage/secondary-links');
$this->assertLinkByHref('admin/structure/menu/manage/secondary-menu');
// Verify the existence of all system-defined (default) menus.
foreach (menu_list_system_menus() as $menu_name => $title) {
$this->assertLinkByHref('admin/structure/menu/manage/' . $menu_name, 0, 'Found default menu: ' . $title);
}
// Verify a few known links are still present, plus the ones created here.
$test_menus = array(
'navigation' => array('Add content', 'nodeadd-navigation'),
'management' => array('Administration', 'Account settings'),
'user-menu' => array('My account', 'Log out'),
'main-menu' => array('nodeadd-primary'),
'secondary-menu' => array('nodeadd-secondary'),
);
foreach ($test_menus as $menu_name => $links) {
$this->drupalGet('admin/structure/menu/manage/' . $menu_name);
$this->assertResponse(200, 'Access menu management for ' . $menu_name);
foreach ($links as $link_text) {
$this->assertLink(t($link_text));
}
}
// Check the "source for primary/secondary links" setting.
$this->drupalGet('admin/structure/menu/settings');
$this->assertOptionSelected('edit-menu-main-links-source', 'secondary-menu');
$this->assertOptionSelected('edit-menu-secondary-links-source', 'main-menu');
// Check that both primary/secondary links blocks are visible.
$this->drupalGet('node');
$this->assertText('My Primary Links', '(Formerly) Primary Links block is still visible');
$this->assertText('My Secondary Links', '(Formerly) Secondary Links block is still visible');
}
}

View file

@ -0,0 +1,148 @@
<?php
/**
* Upgrade test for node bodies.
*
* Load a filled installation of Drupal 6 and run the upgrade process on it.
*/
class NodeBodyUpgradePathTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'Node body upgrade path',
'description' => 'Node body upgrade path tests.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
);
parent::setUp();
}
/**
* Test a successful upgrade.
*/
public function testNodeBodyUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
$instance = field_info_instance('node', 'body', 'story');
$this->assertIdentical($instance['required'], 0, 'The required setting was preserved during the upgrade path.');
$this->assertTrue($instance['description'], 'The description was preserved during the upgrade path');
$this->drupalGet("content/1263769200");
$this->assertText('node body (broken) - 37');
// Find a published node revision and make sure it still has a body.
$revision = db_query_range("SELECT r.nid, r.vid FROM {node_revision} r JOIN {node} n ON n.nid = r.nid WHERE n.status = 1 AND n.type <> 'poll' AND n.vid <> r.vid", 0, 1)->fetch();
$revision = node_load($revision->nid, $revision->vid);
$this->assertTrue(!empty($revision->body), 'Non-current node revisions still have a node body.');
// Find an unpublished node revision and make sure it still has a body.
$revision = db_query_range("SELECT r.nid, r.vid FROM {node_revision} r JOIN {node} n ON n.nid = r.nid WHERE n.status = 0 AND n.type <> 'poll' AND n.vid <> r.vid", 0, 1)->fetch();
$revision = node_load($revision->nid, $revision->vid);
$this->assertTrue(!empty($revision->body), 'Unpublished non-current node revisions still have a node body.');
// Check that fields created during the upgrade can be edited and resaved
// in the UI.
$this->drupalPost('admin/structure/types/manage/story/fields/body', array(), t('Save settings'));
}
}
/**
* Tests the upgrade path for node disabled node types.
*
* Load a filled installation of Drupal 6 and run the upgrade process on it.
*/
class DisabledNodeTypeTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'Disabled node type upgrade path',
'description' => 'Disabled node type upgrade path tests.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.node_type_broken.database.php',
);
parent::setUp();
}
/**
* Tests a successful upgrade.
*/
public function testDisabledNodeTypeUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
$this->assertTrue(field_info_instance('comment', 'comment_body', 'comment_node_broken'), 'Comment body field instance was created for comments attached to the disabled broken node type');
}
}
/**
* Upgrade test for node type poll.
*
* Load a bare installation of Drupal 6 and run the upgrade process on it.
*
* The install only contains dblog (although it's optional, it's only so that
* another hook_watchdog module can take its place, the site is not functional
* without watchdog) and update.
*/
class PollUpgradePathTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'Poll upgrade path',
'description' => 'Poll upgrade path tests.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
);
parent::setUp();
$this->uninstallModulesExcept(array('poll'));
}
/**
* Test a successful upgrade.
*/
public function testPollUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// Check modules page for poll
$this->drupalGet('admin/modules');
// Verify that the poll data is still correctly available
for ($i = 0; $i < 12; $i++) {
$this->drupalGet("content/poll/$i");
$nbchoices = ($i % 4) + 2;
for ($c = 0; $c < $nbchoices; $c++) {
$this->assertText("Choice $c for poll $i", 'Choice text is displayed correctly on poll view');
}
// Now check that the votes are correct
$this->clickLink(t('Results'));
for ($c = 0; $c < $nbchoices; $c++) {
$this->assertText("Choice $c for poll $i", 'Choice text is displayed correctly on result view');
}
$nbvotes = floor (($i % 4) + 5);
$elements = $this->xpath("//div[@class='percent']");
for ($c = 0; $c < $nbchoices; $c++) {
$votes = floor($nbvotes / $nbchoices);
if (($nbvotes % $nbchoices) > $c) $votes++;
$this->assertTrue(preg_match("/$votes vote/", $elements[$c]), 'The number of votes is displayed correctly: expected ' . $votes . ', got ' . $elements[$c]);
}
}
}
}

View file

@ -0,0 +1,66 @@
<?php
/**
* Upgrade test for poll.module.
*
* Load a bare installation of Drupal 6 and run the upgrade process on it.
*
* The install only contains dblog (although it's optional, it's only so that
* another hook_watchdog module can take its place, the site is not functional
* without watchdog) and update.
*/
class PollUpgradePathTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'Poll upgrade path',
'description' => 'Poll upgrade path tests.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump files.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
);
parent::setUp();
$this->uninstallModulesExcept(array('poll'));
}
/**
* Test a successful upgrade.
*/
public function testPollUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// Check modules page for poll
$this->drupalGet('admin/modules');
// Verify that the poll data is still correctly available
for ($i = 0; $i < 12; $i++) {
$this->drupalGet("content/poll/$i");
$nbchoices = ($i % 4) + 2;
for ($c = 0; $c < $nbchoices; $c++) {
$this->assertText("Choice $c for poll $i", 'Choice text is displayed correctly on poll view');
}
// Now check that the votes are correct
$this->clickLink(t('Results'));
for ($c = 0; $c < $nbchoices; $c++) {
$this->assertText("Choice $c for poll $i", 'Choice text is displayed correctly on result view');
}
$nbvotes = floor (($i % 4) + 5);
$elements = $this->xpath("//div[@class='percent']");
for ($c = 0; $c < $nbchoices; $c++) {
$votes = floor($nbvotes / $nbchoices);
if (($nbvotes % $nbchoices) > $c) $votes++;
$this->assertTrue(preg_match("/$votes vote/", $elements[$c]), 'The number of votes is displayed correctly: expected ' . $votes . ', got ' . $elements[$c]);
}
}
}
}

View file

@ -0,0 +1,202 @@
<?php
/**
* Test taxonomy upgrades.
*/
class UpgradePathTaxonomyTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'Taxonomy upgrade path',
'description' => 'Taxonomy upgrade path tests.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
);
parent::setUp();
}
/**
* Retrieve an array mapping allowed vocabulary id to field name for
* all taxonomy_term_reference fields for which an instance exists
* for the specified entity type and bundle.
*/
function instanceVocabularies($entity_type, $bundle) {
$instances = array();
foreach (field_info_instances($entity_type, $bundle) as $instance) {
$field = field_info_field($instance['field_name']);
if ($field['type'] == 'taxonomy_term_reference') {
foreach ($field['settings']['allowed_values'] as $tree) {
// Prefer valid taxonomy term reference fields for a given vocabulary
// when they exist.
if (empty($instances[$tree['vocabulary']]) || $instances[$tree['vocabulary']] == 'taxonomyextra') {
$instances[$tree['vocabulary']] = $field['field_name'];
}
}
}
}
return $instances;
}
/**
* Basic tests for the taxonomy upgrade.
*/
public function testTaxonomyUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// Visit the front page to assert for PHP warning and errors.
$this->drupalGet('');
// Check that taxonomy_vocabulary_node_type and taxonomy_term_node have been
// removed.
$this->assertFalse(db_table_exists('taxonomy_vocabulary_node_type'), 'taxonomy_vocabulary_node_type has been removed.');
$this->assertFalse(db_table_exists('taxonomy_term_node'), 'taxonomy_term_node has been removed.');
// Check that taxonomy_index has not stored nids of unpublished nodes.
$nids = db_query('SELECT nid from {node} WHERE status = :status', array(':status' => NODE_NOT_PUBLISHED))->fetchCol();
$indexed_nids = db_query('SELECT DISTINCT nid from {taxonomy_index}')->fetchCol();
$this->assertFalse(array_intersect($nids, $indexed_nids), 'No unpublished nid present in taxonomy_index');
// Check that the node type 'page' has been associated to a taxonomy
// reference field for each vocabulary.
$voc_keys = array();
foreach (taxonomy_get_vocabularies() as $vocab) {
$voc_keys[] = $vocab->machine_name;
}
$instances = $this->instanceVocabularies('node', 'page');
$inst_keys = array_keys($instances);
sort($voc_keys);
sort($inst_keys);
$this->assertEqual($voc_keys, $inst_keys, 'Node type page has instances for every vocabulary.');
// Ensure instance variables are getting through.
foreach (array_unique($instances) as $instance) {
$field_instance = field_info_instance('node', $instance, 'page');
$this->assertTrue(isset($field_instance['required']), 'The required setting was preserved during the upgrade path.');
$this->assertTrue($field_instance['description'], 'The description was preserved during the upgrade path');
}
// Node type 'story' was not explicitly in $vocabulary->nodes but
// each node of type 'story' was associated to one or more terms.
// Check that the node type 'story' has been associated only to
// the taxonomyextra field.
$instances = $this->instanceVocabularies('node', 'story');
$field_names = array_flip($instances);
$this->assertEqual(count($field_names), 1, 'Only one taxonomy term field instance exists for story nodes');
$this->assertEqual(key($field_names), 'taxonomyextra', 'Only the excess taxonomy term field is used on story nodes');
// Check that the node type 'poll' has been associated to no taxonomy
// reference field.
$instances = $this->instanceVocabularies('node', 'poll');
$this->assertTrue(empty($instances), 'Node type poll has no taxonomy term reference field instances.');
// Check that each node of type 'page' and 'story' is associated to all the
// terms except terms whose ID is equal to the node ID or is equal to the
// node ID subtracted from 49.
$nodes = node_load_multiple(array(), array('type' => 'page'));
$nodes += node_load_multiple(array(), array('type' => 'story'));
$terms = db_select('taxonomy_term_data', 'td')
->fields('td')
->orderBy('vid')
->orderBy('tid')
->execute()
->fetchAllAssoc('tid');
field_attach_prepare_view('node', $nodes, 'full');
foreach ($nodes as $nid => $node) {
$node->content = field_attach_view('node', $node, 'full');
$render = drupal_render($node->content);
$this->drupalSetContent($render);
$this->verbose($render);
$vocabulary_seen = array();
foreach ($terms as $tid => $term) {
// In our test database, each node is arbitrary associated with all
// terms except two: one whose tid is ($nid) and one whose tid is
// (49 - $nid).
$should_be_displayed = ($tid != $nid) && ($tid + $nid != 49);
// Only vocabularies 13 to 24 are properly associated with the node
// type 'page'. All other node types are not associated with any
// vocabulary, but still are associated with terms. Those terms
// will be moved to the taxonomy extra field.
if ($node->type == 'page' && $term->vid >= 13 && $term->vid <= 24) {
$vocabulary = taxonomy_vocabulary_load($term->vid);
$field_class = 'field-name-' . strtr('taxonomy_' . $vocabulary->machine_name, '_', '-');;
}
else {
$field_class = 'field-name-taxonomyextra';
}
// Odd vocabularies are single, so any additional term will be moved
// to the taxonomy extra field.
if ($should_be_displayed) {
if ($term->vid % 2 == 1 && !empty($vocabulary_seen[$term->vid])) {
$field_class = 'field-name-taxonomyextra';
}
$vocabulary_seen[$term->vid] = TRUE;
}
$args = array(
'%name' => $term->name,
'@field' => $field_class,
'%nid' => $nid,
);
// Use link rather than term name because migrated term names can be
// substrings of other term names. e.g. "term 1 of vocabulary 2" is
// found when "term 1 of vocabulary 20" is output.
$term_path = url('taxonomy/term/' . $term->tid);
if (!$should_be_displayed) {
// Look for any link with the term path.
$links = $this->xpath('//a[@href=:term_path]', array(':term_path' => $term_path));
$this->assertFalse($links, format_string('Term %name (@field) is not displayed on node %nid', $args));
}
else {
// Look for a link with the term path inside the correct field.
// We search for "SPACE + class + SPACE" to avoid matching a substring
// of the class.
$links = $this->xpath('//div[contains(concat(" ", normalize-space(@class), " "), :field_class)]//a[@href=:term_path]', array(':field_class' => ' ' . $field_class . ' ', ':term_path' => $term_path));
$this->assertTrue($links, format_string('Term %name (@field) is displayed on node %nid', $args));
}
}
// nid 1, revision 1 had a bogus record in {term_node} pointing to term
// ID 0. Make sure we ignored this instead of generating a bogus term.
if ($node->nid == 1) {
$link = l($term->name, 'taxonomy/term/0');
$this->assertNoRaw($link, format_string('Bogus term (tid 0) is not displayed on node 1 vid %old_vid.', $args));
}
// The first 12 nodes have two revisions. For nodes with
// revisions, check that the oldest revision is associated only
// to terms whose ID is equal to the node ID or 49 less the node ID.
$revisions = node_revision_list($node);
if ($node->nid < 13) {
$this->assertEqual(count($revisions), 2, format_string('Node %nid has two revisions.', $args));
$last_rev = end($revisions);
$args['%old_vid'] = $last_rev->vid;
$node_old = node_load($node->nid, $last_rev->vid);
field_attach_prepare_view('node', array($node_old->nid => $node_old), 'full');
$node_old->content = field_attach_view('node', $node_old, 'full');
$render = drupal_render($node_old->content);
$this->drupalSetContent($render);
$this->verbose($render);
$term = $terms[$node->nid];
$link = l($term->name, 'taxonomy/term/' . $term->tid);
$this->assertRaw($link, format_string('Term %name (@field) is displayed on node %nid vid %old_vid.', $args));
$term = $terms[49-$node->nid];
$link = l($term->name, 'taxonomy/term/' . $term->tid);
$this->assertRaw($link, format_string('Term %name (@field) is displayed on node %nid %old_vid.', $args));
}
else {
$this->assertEqual(count($revisions), 1, format_string('Node %nid has one revision.', $args));
}
}
}
}

View file

@ -0,0 +1,737 @@
<?php
/**
* Perform end-to-end tests of the upgrade path.
*/
abstract class UpgradePathTestCase extends DrupalWebTestCase {
/**
* The file path(s) to the dumped database(s) to load into the child site.
*
* @var array
*/
var $databaseDumpFiles = array();
/**
* Flag that indicates whether the child site has been upgraded.
*/
var $upgradedSite = FALSE;
/**
* Array of errors triggered during the upgrade process.
*/
var $upgradeErrors = array();
/**
* Array of modules loaded when the test starts.
*/
var $loadedModules = array();
/**
* Flag to indicate whether zlib is installed or not.
*/
var $zlibInstalled = TRUE;
/**
* Flag to indicate whether there are pending updates or not.
*/
var $pendingUpdates = TRUE;
/**
* Constructs an UpgradePathTestCase object.
*
* @param $test_id
* (optional) The ID of the test. Tests with the same id are reported
* together.
*/
function __construct($test_id = NULL) {
parent::__construct($test_id);
$this->zlibInstalled = function_exists('gzopen');
}
/**
* Prepares the appropriate session for the release of Drupal being upgraded.
*/
protected function prepareD7Session() {
// Generate and set a D6-compatible session cookie.
$this->curlInitialize();
$sid = drupal_hash_base64(uniqid(mt_rand(), TRUE) . drupal_random_bytes(55));
$session_name = update_get_d6_session_name();
curl_setopt($this->curlHandle, CURLOPT_COOKIE, rawurlencode($session_name) . '=' . rawurlencode($sid));
// Force our way into the session of the child site.
drupal_save_session(TRUE);
// A session cannot be written without the ssid column which is missing on
// Drupal 6 sites.
db_add_field('sessions', 'ssid', array('description' => "Secure session ID. The value is generated by Drupal's session handlers.", 'type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''));
_drupal_session_write($sid, '');
// Remove the temporarily added ssid column.
db_drop_field('sessions', 'ssid');
drupal_save_session(FALSE);
}
/**
* Overrides DrupalWebTestCase::setUp() for upgrade testing.
*
* @see DrupalWebTestCase::prepareDatabasePrefix()
* @see DrupalWebTestCase::changeDatabasePrefix()
* @see DrupalWebTestCase::prepareEnvironment()
*/
protected function setUp() {
// We are going to set a missing zlib requirement property for usage
// during the performUpgrade() and tearDown() methods. Also set that the
// tests failed.
if (!$this->zlibInstalled) {
parent::setUp();
return;
}
global $user, $language, $conf;
// Load the Update API.
require_once DRUPAL_ROOT . '/includes/update.inc';
// Reset flags.
$this->upgradedSite = FALSE;
$this->upgradeErrors = array();
$this->loadedModules = module_list();
// Create the database prefix for this test.
$this->prepareDatabasePrefix();
// Prepare the environment for running tests.
$this->prepareEnvironment();
if (!$this->setupEnvironment) {
return FALSE;
}
// Reset all statics and variables to perform tests in a clean environment.
$conf = array();
drupal_static_reset();
// Change the database prefix.
// All static variables need to be reset before the database prefix is
// changed, since DrupalCacheArray implementations attempt to
// write back to persistent caches when they are destructed.
$this->changeDatabasePrefix();
if (!$this->setupDatabasePrefix) {
return FALSE;
}
// Unregister the registry.
// This is required to make sure that the database layer works properly.
spl_autoload_unregister('drupal_autoload_class');
spl_autoload_unregister('drupal_autoload_interface');
// Load the database from the portable PHP dump.
// The files may be gzipped.
foreach ($this->databaseDumpFiles as $file) {
if (substr($file, -3) == '.gz') {
$file = "compress.zlib://$file";
}
require $file;
}
// Set path variables.
$this->variable_set('file_public_path', $this->public_files_directory);
$this->variable_set('file_private_path', $this->private_files_directory);
$this->variable_set('file_temporary_path', $this->temp_files_directory);
$this->pass('Finished loading the dump.');
// Ensure that the session is not written to the new environment and replace
// the global $user session with uid 1 from the new test site.
drupal_save_session(FALSE);
// Login as uid 1.
$user = db_query('SELECT * FROM {users} WHERE uid = :uid', array(':uid' => 1))->fetchObject();
// Generate and set a D6-compatible session cookie.
$this->prepareD7Session();
// Restore necessary variables.
$this->variable_set('clean_url', $this->originalCleanUrl);
$this->variable_set('site_mail', 'simpletest@example.com');
drupal_set_time_limit($this->timeLimit);
$this->setup = TRUE;
}
/**
* Specialized variable_set() that works even if the child site is not upgraded.
*
* @param $name
* The name of the variable to set.
* @param $value
* The value to set. This can be any PHP data type; these functions take care
* of serialization as necessary.
*/
protected function variable_set($name, $value) {
db_delete('variable')
->condition('name', $name)
->execute();
db_insert('variable')
->fields(array(
'name' => $name,
'value' => serialize($value),
))
->execute();
try {
cache_clear_all('variables', 'cache');
cache_clear_all('variables', 'cache_bootstrap');
}
// Since cache_bootstrap won't exist in a Drupal 6 site, ignore the
// exception if the above fails.
catch (Exception $e) {}
}
/**
* Specialized refreshVariables().
*/
protected function refreshVariables() {
// No operation if the child has not been upgraded yet.
if (!$this->upgradedSite) {
return parent::refreshVariables();
}
}
/**
* Perform the upgrade.
*
* @param $register_errors
* Register the errors during the upgrade process as failures.
* @return
* TRUE if the upgrade succeeded, FALSE otherwise.
*/
protected function performUpgrade($register_errors = TRUE) {
if (!$this->zlibInstalled) {
$this->fail(t('Missing zlib requirement for upgrade tests.'));
return FALSE;
}
$update_url = $GLOBALS['base_url'] . '/update.php';
// Load the first update screen.
$this->drupalGet($update_url, array('external' => TRUE));
if (!$this->assertResponse(200)) {
return FALSE;
}
// Continue.
$this->drupalPost(NULL, array(), t('Continue'));
if (!$this->assertResponse(200)) {
return FALSE;
}
// The test should pass if there are no pending updates.
$content = $this->drupalGetContent();
if (strpos($content, t('No pending updates.')) !== FALSE) {
$this->pass(t('No pending updates and therefore no upgrade process to test.'));
$this->pendingUpdates = FALSE;
return TRUE;
}
// Go!
$this->drupalPost(NULL, array(), t('Apply pending updates'));
if (!$this->assertResponse(200)) {
return FALSE;
}
// Check for errors during the update process.
foreach ($this->xpath('//li[@class=:class]', array(':class' => 'failure')) as $element) {
$message = strip_tags($element->asXML());
$this->upgradeErrors[] = $message;
if ($register_errors) {
$this->fail($message);
}
}
if (!empty($this->upgradeErrors)) {
// Upgrade failed, the installation might be in an inconsistent state,
// don't process.
return FALSE;
}
// Check if there still are pending updates.
$this->drupalGet($update_url, array('external' => TRUE));
$this->drupalPost(NULL, array(), t('Continue'));
if (!$this->assertText(t('No pending updates.'), 'No pending updates at the end of the update process.')) {
return FALSE;
}
// Upgrade succeed, rebuild the environment so that we can call the API
// of the child site directly from this request.
$this->upgradedSite = TRUE;
// Reload module list. For modules that are enabled in the test database,
// but not on the test client, we need to load the code here.
$new_modules = array_diff(module_list(TRUE), $this->loadedModules);
foreach ($new_modules as $module) {
drupal_load('module', $module);
}
// Reload hook implementations
module_implements('', FALSE, TRUE);
// Rebuild caches.
drupal_static_reset();
drupal_flush_all_caches();
// Reload global $conf array and permissions.
$this->refreshVariables();
$this->checkPermissions(array(), TRUE);
return TRUE;
}
/**
* Force uninstall all modules from a test database, except those listed.
*
* @param $modules
* The list of modules to keep installed. Required core modules will
* always be kept.
*/
protected function uninstallModulesExcept(array $modules) {
$required_modules = array('block', 'dblog', 'filter', 'node', 'system', 'update', 'user');
$modules = array_merge($required_modules, $modules);
db_delete('system')
->condition('type', 'module')
->condition('name', $modules, 'NOT IN')
->execute();
}
}
/**
* Performs end-to-end point test of the release update path.
*/
abstract class UpdatePathTestCase extends UpgradePathTestCase {
/**
* Overrides UpgradePathTestCase::prepareD7Session().
*/
protected function prepareD7Session() {
// Generate and set a D7-compatible session cookie.
$this->curlInitialize();
$sid = drupal_hash_base64(uniqid(mt_rand(), TRUE) . drupal_random_bytes(55));
curl_setopt($this->curlHandle, CURLOPT_COOKIE, rawurlencode(session_name()) . '=' . rawurlencode($sid));
// Force our way into the session of the child site.
drupal_save_session(TRUE);
_drupal_session_write($sid, '');
drupal_save_session(FALSE);
}
}
/**
* Perform basic upgrade tests.
*
* Load a bare installation of Drupal 6 and run the upgrade process on it.
*
* The install only contains dblog (although it's optional, it's only so that
* another hook_watchdog module can take its place, the site is not functional
* without watchdog) and update.
*/
class BasicUpgradePath extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'Basic upgrade path',
'description' => 'Basic upgrade path tests.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump files.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.bare.database.php',
);
parent::setUp();
}
/**
* Test a failed upgrade, and verify that the failure is reported.
*/
public function testFailedUpgrade() {
// Destroy a table that the upgrade process needs.
db_drop_table('access');
// Assert that the upgrade fails.
$this->assertFalse($this->performUpgrade(FALSE) && $this->pendingUpdates, 'A failed upgrade should return messages.');
}
/**
* Test a successful upgrade.
*/
public function testBasicUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// Hit the frontpage.
$this->drupalGet('');
$this->assertResponse(200);
// Verify that we are still logged in.
$this->drupalGet('user');
$this->clickLink(t('Edit'));
$this->assertEqual($this->getUrl(), url('user/1/edit', array('absolute' => TRUE)), 'We are still logged in as admin at the end of the upgrade.');
// Logout and verify that we can login back in with our initial password.
$this->drupalLogout();
$this->drupalLogin((object) array(
'uid' => 1,
'name' => 'admin',
'pass_raw' => 'admin',
));
// The previous login should've triggered a password rehash, so login one
// more time to make sure the new hash is readable.
$this->drupalLogout();
$this->drupalLogin((object) array(
'uid' => 1,
'name' => 'admin',
'pass_raw' => 'admin',
));
// Test that the site name is correctly displayed.
$this->assertText('Drupal 6', 'The site name is correctly displayed.');
// Verify that the main admin sections are available.
$this->drupalGet('admin');
$this->assertText(t('Content'));
$this->assertText(t('Appearance'));
$this->assertText(t('People'));
$this->assertText(t('Configuration'));
$this->assertText(t('Reports'));
$this->assertText(t('Structure'));
$this->assertText(t('Modules'));
// Confirm that no {menu_links} entry exists for user/autocomplete.
$result = db_query('SELECT COUNT(*) FROM {menu_links} WHERE link_path = :user_autocomplete', array(':user_autocomplete' => 'user/autocomplete'))->fetchField();
$this->assertFalse($result, 'No {menu_links} entry exists for user/autocomplete');
// Test that the environment after the upgrade is in a consistent status.
$update_d6 = variable_get('update_d6', FALSE);
$this->assertFalse($update_d6, 'The D6 upgrade flag variable has been correctly disabled.');
}
}
/**
* Performs point release update tests on a bare database.
*
* Loads an installation of Drupal 7.0 and runs the update process on it.
*
* The install contains the standard profile (plus all optional) modules
* without any content so that an update from any of the modules under this
* profile installation can be wholly tested.
*/
class BasicStandardUpdatePath extends UpdatePathTestCase {
public static function getInfo() {
return array(
'name' => 'Basic standard + all profile update path',
'description' => 'Basic update path tests for a standard profile install with all enabled modules.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump files.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.bare.standard_all.database.php.gz',
);
parent::setUp();
}
/**
* Tests a successful point release update.
*/
public function testBasicStandardUpdate() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// Hit the frontpage.
$this->drupalGet('');
$this->assertResponse(200);
// Verify that we are still logged in.
$this->drupalGet('user');
$this->clickLink(t('Edit'));
$this->assertEqual($this->getUrl(), url('user/1/edit', array('absolute' => TRUE)), 'We are still logged in as admin at the end of the upgrade.');
// Logout and verify that we can login back in with our initial password.
$this->drupalLogout();
$this->drupalLogin((object) array(
'uid' => 1,
'name' => 'admin',
'pass_raw' => 'admin',
));
// The previous login should've triggered a password rehash, so login one
// more time to make sure the new hash is readable.
$this->drupalLogout();
$this->drupalLogin((object) array(
'uid' => 1,
'name' => 'admin',
'pass_raw' => 'admin',
));
// Test that the site name is correctly displayed.
$this->assertText('Drupal', 'The site name is correctly displayed.');
// Verify that the main admin sections are available.
$this->drupalGet('admin');
$this->assertText(t('Content'));
$this->assertText(t('Appearance'));
$this->assertText(t('People'));
$this->assertText(t('Configuration'));
$this->assertText(t('Reports'));
$this->assertText(t('Structure'));
$this->assertText(t('Modules'));
// Confirm that no {menu_links} entry exists for user/autocomplete.
$result = db_query('SELECT COUNT(*) FROM {menu_links} WHERE link_path = :user_autocomplete', array(':user_autocomplete' => 'user/autocomplete'))->fetchField();
$this->assertFalse($result, 'No {menu_links} entry exists for user/autocomplete');
}
}
/**
* Performs point release update tests on a bare database.
*
* Loads an installation of Drupal 7.0 and runs the update process on it.
*
* The install contains the minimal profile modules (without any generated
* content) so that an update from of a site under this profile may be tested.
*/
class BasicMinimalUpdatePath extends UpdatePathTestCase {
public static function getInfo() {
return array(
'name' => 'Basic minimal profile update path',
'description' => 'Basic update path tests for a minimal profile install.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump files.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.bare.minimal.database.php.gz',
);
parent::setUp();
}
/**
* Tests a successful point release update.
*/
public function testBasicMinimalUpdate() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// Hit the frontpage.
$this->drupalGet('');
$this->assertResponse(200);
// Verify that we are still logged in.
$this->drupalGet('user');
$this->clickLink(t('Edit'));
$this->assertEqual($this->getUrl(), url('user/1/edit', array('absolute' => TRUE)), 'We are still logged in as admin at the end of the upgrade.');
// Logout and verify that we can login back in with our initial password.
$this->drupalLogout();
$this->drupalLogin((object) array(
'uid' => 1,
'name' => 'admin',
'pass_raw' => 'admin',
));
// The previous login should've triggered a password rehash, so login one
// more time to make sure the new hash is readable.
$this->drupalLogout();
$this->drupalLogin((object) array(
'uid' => 1,
'name' => 'admin',
'pass_raw' => 'admin',
));
// Test that the site name is correctly displayed.
$this->assertText('Drupal', 'The site name is correctly displayed.');
// Verify that the main admin sections are available.
$this->drupalGet('admin');
$this->assertText(t('Content'));
$this->assertText(t('Appearance'));
$this->assertText(t('People'));
$this->assertText(t('Configuration'));
$this->assertText(t('Reports'));
$this->assertText(t('Structure'));
$this->assertText(t('Modules'));
// Confirm that no {menu_links} entry exists for user/autocomplete.
$result = db_query('SELECT COUNT(*) FROM {menu_links} WHERE link_path = :user_autocomplete', array(':user_autocomplete' => 'user/autocomplete'))->fetchField();
$this->assertFalse($result, 'No {menu_links} entry exists for user/autocomplete');
// Confirm that a date format that just differs in the case can be added.
$admin_date_format = 'j M y';
$edit = array('date_format' => $admin_date_format);
$this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
// Add a new date format which just differs in the case.
$admin_date_format_uppercase = 'j M Y';
$edit = array('date_format' => $admin_date_format_uppercase);
$this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
$this->assertText(t('Custom date format added.'));
// Verify that the unique key on {date_formats}.format still exists.
$this->assertTrue(db_index_exists('date_formats', 'formats'), 'Unique key on {date_formats} exists');
}
}
/**
* Performs point release update tests on a 'filled' database.
*
* Loads an installation of Drupal 7.0 and runs the update process on it.
*
* The install contains the standard profile (plus all optional) modules
* with generated content so that an update from any of the modules under this
* profile installation can be wholly tested.
*/
class FilledStandardUpdatePath extends UpdatePathTestCase {
public static function getInfo() {
return array(
'name' => 'Basic standard + all profile update path, populated database',
'description' => 'Basic update path tests for a standard profile install with all enabled modules and a populated database.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump files.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.filled.standard_all.database.php.gz',
);
parent::setUp();
}
/**
* Tests a successful point release update.
*/
public function testFilledStandardUpdate() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// Hit the frontpage.
$this->drupalGet('');
$this->assertResponse(200);
// Verify that we are still logged in.
$this->drupalGet('user');
$this->clickLink(t('Edit'));
$this->assertEqual($this->getUrl(), url('user/1/edit', array('absolute' => TRUE)), 'We are still logged in as admin at the end of the upgrade.');
// Logout and verify that we can login back in with our initial password.
$this->drupalLogout();
$this->drupalLogin((object) array(
'uid' => 1,
'name' => 'admin',
'pass_raw' => 'admin',
));
// The previous login should've triggered a password rehash, so login one
// more time to make sure the new hash is readable.
$this->drupalLogout();
$this->drupalLogin((object) array(
'uid' => 1,
'name' => 'admin',
'pass_raw' => 'admin',
));
// Test that the site name is correctly displayed.
$this->assertText('Drupal', 'The site name is correctly displayed.');
// Verify that the main admin sections are available.
$this->drupalGet('admin');
$this->assertText(t('Content'));
$this->assertText(t('Appearance'));
$this->assertText(t('People'));
$this->assertText(t('Configuration'));
$this->assertText(t('Reports'));
$this->assertText(t('Structure'));
$this->assertText(t('Modules'));
// Confirm that no {menu_links} entry exists for user/autocomplete.
$result = db_query('SELECT COUNT(*) FROM {menu_links} WHERE link_path = :user_autocomplete', array(':user_autocomplete' => 'user/autocomplete'))->fetchField();
$this->assertFalse($result, 'No {menu_links} entry exists for user/autocomplete');
}
}
/**
* Performs point release update tests on a populated database.
*
* Loads an installation of Drupal 7.0 and runs the update process on it.
*
* The install contains the minimal profile modules (along with generated
* content) so that an update from of a site under this profile may be tested.
*/
class FilledMinimalUpdatePath extends UpdatePathTestCase {
public static function getInfo() {
return array(
'name' => 'Basic minimal profile update path, populated database',
'description' => 'Basic update path tests for a minimal profile install with a populated database.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump files.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.filled.minimal.database.php.gz',
);
parent::setUp();
}
/**
* Tests a successful point release update.
*/
public function testFilledStandardUpdate() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// Hit the frontpage.
$this->drupalGet('');
$this->assertResponse(200);
// Verify that we are still logged in.
$this->drupalGet('user');
$this->clickLink(t('Edit'));
$this->assertEqual($this->getUrl(), url('user/1/edit', array('absolute' => TRUE)), 'We are still logged in as admin at the end of the upgrade.');
// Logout and verify that we can login back in with our initial password.
$this->drupalLogout();
$this->drupalLogin((object) array(
'uid' => 1,
'name' => 'admin',
'pass_raw' => 'admin',
));
// The previous login should've triggered a password rehash, so login one
// more time to make sure the new hash is readable.
$this->drupalLogout();
$this->drupalLogin((object) array(
'uid' => 1,
'name' => 'admin',
'pass_raw' => 'admin',
));
// Test that the site name is correctly displayed.
$this->assertText('Drupal', 'The site name is correctly displayed.');
// Verify that the main admin sections are available.
$this->drupalGet('admin');
$this->assertText(t('Content'));
$this->assertText(t('Appearance'));
$this->assertText(t('People'));
$this->assertText(t('Configuration'));
$this->assertText(t('Reports'));
$this->assertText(t('Structure'));
$this->assertText(t('Modules'));
// Confirm that no {menu_links} entry exists for user/autocomplete.
$result = db_query('SELECT COUNT(*) FROM {menu_links} WHERE link_path = :user_autocomplete', array(':user_autocomplete' => 'user/autocomplete'))->fetchField();
$this->assertFalse($result, 'No {menu_links} entry exists for user/autocomplete');
}
}

View file

@ -0,0 +1,51 @@
<?php
/**
* Upgrade test for translatable content types of node.module.
*/
class TranslatableUpgradePathTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'Translatable content upgrade path',
'description' => 'Upgrade path tests for the translatable content types of Node module.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump files.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.locale.database.php',
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.translatable.database.php',
);
parent::setUp();
$this->uninstallModulesExcept(array('locale'));
}
/**
* Test a successful upgrade (no negotiation).
*/
public function testTranslatableUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// The D6 database contains the english node "First translatable page" with
// nid 53.
$nid = 53;
$title = 'First translatable page';
$teaser = 'Teaser of the first translatable page.';
$body = 'Body of the first translatable page.';
// Check whether the node displays properly.
$this->drupalGet("node/$nid");
$this->assertText($body, 'Translatable node body displays properly');
// Retrieve node object, ensure that both the body and the teaser has
// survived upgrade properly.
$node = $this->drupalGetNodeByTitle($title);
$this->assertTrue($node != NULL, format_string('Node @title was loaded', array('@title' => $title)));
$this->assertEqual($node->body[LANGUAGE_NONE][0]['value'], $body, 'Body of the node survived upgrade properly');
$this->assertEqual($node->body[LANGUAGE_NONE][0]['summary'], $teaser, 'Teaser of the node survived upgrade properly');
}
}

View file

@ -0,0 +1,39 @@
<?php
/**
* @file
* Provides upgrade path tests for the Trigger module.
*/
/**
* Tests the Trigger 6 -> 7 upgrade path.
*/
class UpgradePathTriggerTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'Trigger upgrade path',
'description' => 'Trigger upgrade path tests for Drupal 6.x.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.trigger.database.php',
);
parent::setUp();
}
/**
* Basic tests for the trigger upgrade.
*/
public function testTaxonomyUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
$this->drupalGet('admin/structure/trigger/node');
$this->assertRaw('<td>'. t('Make post sticky') .'</td>');
$this->assertRaw('<td>'. t('Publish post') .'</td>');
$this->drupalGet('admin/structure/trigger/comment');
$this->assertRaw('<td>'. t('Publish comment') .'</td>');
}
}

View file

@ -0,0 +1,106 @@
<?php
/**
* Upgrade test for comment.module.
*/
class UploadUpgradePathTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'Upload upgrade path',
'description' => 'Upload upgrade path tests.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump files.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.upload.database.php',
);
parent::setUp();
// Set a small batch size to test multiple iterations of the batch.
$this->variable_set('upload_update_batch_size', 2);
$this->uninstallModulesExcept(array('upload'));
}
/**
* Test a successful upgrade.
*/
public function testUploadUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node');
$query->entityCondition('bundle', 'page');
$query->age(FIELD_LOAD_REVISION);
$query->fieldCondition('upload');
$entities = $query->execute();
$revisions = $entities['node'];
// Node revision 50 should not have uploaded files, as the entry in {files}
// is corrupted.
$this->assertFalse((isset($revisions[50])), 'Nodes with missing files do not contain filefield data.');
// Node revisions 51-53 should have uploaded files.
$this->assertTrue((isset($revisions[51]) && isset($revisions[52]) && isset($revisions[53])), 'Nodes with uploaded files now contain filefield data.');
// The test database lists uploaded filenames in the body of each node with
// uploaded files attached. Make sure all files are there in the same order.
foreach ($revisions as $vid => $revision) {
$node = node_load($revision->nid, $vid);
// Assemble a list of the filenames as recorded in the node body before
// the upgrade.
$recorded_filenames = preg_split('/\s+/', $node->body[LANGUAGE_NONE][0]['value']);
// The first line of the node body should be "Attachments:"
if (strstr($recorded_filenames[0], "Attachments:")) {
unset($recorded_filenames[0]);
}
$recorded_filenames = array_values($recorded_filenames);
$files = $node->upload[LANGUAGE_NONE];
// Assemble a list of the filenames as they exist after the upgrade.
$filenames = array();
foreach ($files as $file) {
$filenames[] = $file['filename'];
}
$this->assertIdentical($filenames, $recorded_filenames, 'The uploaded files are present in the same order after the upgrade.');
}
// Test for the file with repeating basename to only have the streaming
// path replaced.
$node = node_load(40, 53);
$repeated_basename_file = $node->upload[LANGUAGE_NONE][4];
$this->assertEqual($repeated_basename_file['uri'], 'private://drupal-6/file/directory/path/crazy-basename.png', "The file with the repeated basename path only had the stream portion replaced");
// Ensure that filepaths are deduplicated.
$node0 = node_load(41, 54);
$node1 = node_load(41, 55);
// Ensure that both revisions point to the same file ID.
$items0 = field_get_items('node', $node0, 'upload');
$this->assertEqual(count($items0), 1);
$items1 = field_get_items('node', $node1, 'upload');
$this->assertEqual(count($items1), 2);
$this->assertEqual($items0[0]['fid'], $items1[0]['fid']);
$this->assertEqual($items0[0]['fid'], $items1[1]['fid']);
// The revision with more than one reference to the same file should retain
// the original settings for each reference.
$this->assertEqual($items1[0]['description'], 'first description');
$this->assertEqual($items1[0]['display'], 0);
$this->assertEqual($items1[1]['description'], 'second description');
$this->assertEqual($items1[1]['display'], 1);
// Ensure that the latest version of the files are used.
$this->assertEqual($items1[0]['filesize'], 316);
$this->assertEqual($items1[1]['filesize'], 316);
// No duplicate files should remain on the Drupal 7 site.
$this->assertEqual(0, db_query("SELECT COUNT(*) FROM {file_managed} GROUP BY uri HAVING COUNT(fid) > 1")->fetchField());
// Make sure the file settings were properly migrated.
$d6_file_directory_temp = '/drupal-6/file/directory/temp';
$d6_file_directory_path = '/drupal-6/file/directory/path';
$d6_file_downloads = 2; // FILE_DOWNLOADS_PRIVATE
$this->assertNull(variable_get('file_directory_temp', NULL), "The 'file_directory_temp' variable was properly removed.");
$this->assertEqual(variable_get('file_temporary_path', 'drupal-7-bogus'), $d6_file_directory_temp, "The 'file_temporary_path' setting was properly migrated.");
$this->assertEqual(variable_get('file_default_scheme', 'drupal-7-bogus'), 'private', "The 'file_default_scheme' setting was properly migrated.");
$this->assertEqual(variable_get('file_private_path', 'drupal-7-bogus'), $d6_file_directory_path, "The 'file_private_path' setting was properly migrated.");
}
}

View file

@ -0,0 +1,92 @@
<?php
/**
* Upgrade test for user.module (password token involved).
*/
class UserUpgradePathPasswordTokenTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'User upgrade path (password token involved)',
'description' => 'User upgrade path tests (password token involved).',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump files.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.bare.database.php',
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.user-password-token.database.php',
);
parent::setUp();
}
/**
* Test a successful upgrade.
*/
public function testUserUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
$this->assertEqual(variable_get('user_mail_register_no_approval_required_body'), ', [user:name], [site:name], [site:url], [site:url-brief], [user:mail], [date:medium], [site:login-url], [user:edit-url], [user:one-time-login-url].', 'Existing email templates have been modified (password token involved).');
// Check that a non-md5 hash was untouched.
$pass = db_query('SELECT pass FROM {users} WHERE uid = 3')->fetchField();
$this->assertEqual('$S$DAK00p3Dkojkf4O/UizYxenguXnjv', $pass, 'Pre-existing non-MD5 password hash was not altered');
}
}
/**
* Upgrade test for user.module (password token not involved).
*/
class UserUpgradePathNoPasswordTokenTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'User upgrade path (password token not involved)',
'description' => 'User upgrade path tests (password token not involved).',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump files.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.bare.database.php',
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.user-no-password-token.database.php',
);
parent::setUp();
}
/**
* Test a successful upgrade.
*/
public function testUserUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
$this->assertEqual(variable_get('user_mail_register_no_approval_required_body'), '[user:name], [site:name], [site:url], [site:url-brief], [user:mail], [date:medium], [site:login-url], [user:edit-url], [user:one-time-login-url].', 'Existing email templates have been modified (password token not involved).');
}
}
/**
* Upgrade test for user.module (duplicated permission).
*/
class UserUpgradePathDuplicatedPermissionTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'User upgrade path (duplicated permission)',
'description' => 'User upgrade path tests (duplicated permission).',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump files.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.bare.database.php',
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.duplicate-permission.database.php',
);
parent::setUp();
}
/**
* Test a successful upgrade.
*/
public function testUserUpgrade() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
}
}