summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests/upgrade/upgrade.upload.test
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-11-13 01:48:14 +0000
committerDries Buytaert <dries@buytaert.net>2010-11-13 01:48:14 +0000
commita160006defd02442cd3fa0f098094385ebb8fcf1 (patch)
tree116520dbd934e99d38affb3790b302ed76e99123 /modules/simpletest/tests/upgrade/upgrade.upload.test
parentf2e5ed5ce584e79048fcb98e40a05bfb58c3ebdc (diff)
downloadbrdo-a160006defd02442cd3fa0f098094385ebb8fcf1.tar.gz
brdo-a160006defd02442cd3fa0f098094385ebb8fcf1.tar.bz2
- Patch #966238 by cosmicdreams, bfroehle, catch, mfb, carlos8f, marcingy: system_update_7061() stops migrating data if upload.fid is not found in files table, resulting in data loss.
Diffstat (limited to 'modules/simpletest/tests/upgrade/upgrade.upload.test')
-rw-r--r--modules/simpletest/tests/upgrade/upgrade.upload.test13
1 files changed, 8 insertions, 5 deletions
diff --git a/modules/simpletest/tests/upgrade/upgrade.upload.test b/modules/simpletest/tests/upgrade/upgrade.upload.test
index efbff1114..761d6558d 100644
--- a/modules/simpletest/tests/upgrade/upgrade.upload.test
+++ b/modules/simpletest/tests/upgrade/upgrade.upload.test
@@ -20,6 +20,8 @@ class UploadUpgradePathTestCase extends UpgradePathTestCase {
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'));
}
@@ -36,8 +38,11 @@ class UploadUpgradePathTestCase extends UpgradePathTestCase {
$query->fieldCondition('upload');
$entities = $query->execute();
$revisions = $entities['node'];
- // Node revisions 50-52 should have uploaded files.
- $this->assertTrue((isset($revisions[50]) && isset($revisions[51]) && isset($revisions[52])), 'Nodes with uploaded files now contain filefield data.');
+ // 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) {
@@ -58,9 +63,7 @@ class UploadUpgradePathTestCase extends UpgradePathTestCase {
foreach ($files as $file) {
$filenames[] = $file['filename'];
}
-
- $diff = array_diff($filenames, $recorded_filenames);
- $this->assertTrue(empty($diff), 'The uploaded files are present in the same order after the upgrade.');
+ $this->assertIdentical($filenames, $recorded_filenames, 'The uploaded files are present in the same order after the upgrade.');
}
}
}