|
@@ -81,4 +81,35 @@ class MigrateTest extends TestCase
|
|
|
$this->assertTrue($this->_model_1->exists(Helper::getPasteId()), 'paste migrated back');
|
|
$this->assertTrue($this->_model_1->exists(Helper::getPasteId()), 'paste migrated back');
|
|
|
$this->assertTrue($this->_model_1->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment migrated back');
|
|
$this->assertTrue($this->_model_1->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment migrated back');
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public function testDamagedSourcePasteIsPreserved()
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->_model_1->delete(Helper::getPasteId());
|
|
|
|
|
+ $paste = Helper::getPaste();
|
|
|
|
|
+ $this->_model_1->create(Helper::getPasteId(), $paste);
|
|
|
|
|
+ file_put_contents(
|
|
|
|
|
+ $this->_path_instance_1 . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR .
|
|
|
|
|
+ substr(Helper::getPasteId(), 0, 2) . DIRECTORY_SEPARATOR .
|
|
|
|
|
+ substr(Helper::getPasteId(), 2, 2) . DIRECTORY_SEPARATOR .
|
|
|
|
|
+ Helper::getPasteId() . '.php',
|
|
|
|
|
+ Filesystem::PROTECTION_LINE . PHP_EOL . '{'
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ $output = null;
|
|
|
|
|
+ $exit_code = 0;
|
|
|
|
|
+ exec(
|
|
|
|
|
+ 'php ' . PATH . 'bin' . DIRECTORY_SEPARATOR . 'migrate --delete-after ' .
|
|
|
|
|
+ $this->_path_instance_1 . DIRECTORY_SEPARATOR . 'cfg ' .
|
|
|
|
|
+ $this->_path_instance_2 . DIRECTORY_SEPARATOR . 'cfg 2>&1',
|
|
|
|
|
+ $output,
|
|
|
|
|
+ $exit_code
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ $this->assertSame(1, $exit_code, implode(PHP_EOL, $output));
|
|
|
|
|
+ $this->assertStringContainsString(
|
|
|
|
|
+ 'ERROR: Unable to read document ID ' . Helper::getPasteId(),
|
|
|
|
|
+ implode(PHP_EOL, $output)
|
|
|
|
|
+ );
|
|
|
|
|
+ $this->assertTrue($this->_model_1->exists(Helper::getPasteId()));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|