public function AcquiaAgentTestCase::testAcquiaAgentCloudMigrate in Acquia Connector 7.2
File
- acquia_agent/
tests/ acquia_agent.test, line 269
Class
- AcquiaAgentTestCase
- Tests the functionality of the Acquia Agent module.
Code
public function testAcquiaAgentCloudMigrate() {
// Connect site on pair that will trigger an error for migration.
$edit_fields = array(
'acquia_identifier' => ACQTEST_ERROR_ID,
'acquia_key' => ACQTEST_ERROR_KEY,
);
$submit_button = 'Connect';
$this
->drupalPost($this->credentials_path, $edit_fields, $submit_button);
$this
->drupalGet($this->migrate_path);
$this
->assertText($this
->acquiaAgentStrings('migrate-hosting-404'), 'Cannot migrate when hosting not enabled on subscription.');
// Connect with correct pair.
$edit_fields = array(
'acquia_identifier' => ACQTEST_ID,
'acquia_key' => ACQTEST_KEY,
);
$this
->drupalPost($this->credentials_path, $edit_fields, $submit_button);
$this
->drupalGet($this->migrate_path);
$this
->assertNoText($this
->acquiaAgentStrings('migrate-hosting-404'), 'Did not get "cannot migrate" text.');
$this
->assertText($this
->acquiaAgentStrings('migrate-select-environments'), 'Environment selection label appears.');
$this
->assertText($this
->acquiaAgentStrings('migrate-files-label'), 'The files label controls do appear.');
variable_set('acquia_agent_cloud_migration', 'test');
$this
->drupalGet($this->migrate_path);
$this
->assertText($this
->acquiaAgentStrings('migrate-files-label'), 'The files label controls do appear after setting the migration variable.');
$edit_fields = array(
'environment' => 'dev',
'migrate_files' => FALSE,
);
$submit_button = 'Migrate';
$this
->drupalPost($this->migrate_path, $edit_fields, $submit_button);
$this
->drupalGet($this->migrate_path);
$this
->assertNoFieldChecked('edit-migrate-files', "The migrate files checkbox is not checked.");
// Test migration setup and destination.
variable_set('drupal_http_request_function', 'acquia_connector_test_upload');
variable_set('acquia_connector_test_upload_server_to_fail', TRUE);
$edit_fields = array(
'environment' => 'dev',
'migrate_files' => TRUE,
'reduce_db_size' => TRUE,
);
$this
->drupalPost($this->migrate_path, $edit_fields, 'Migrate');
$this
->assertText('Unable to connect to migration destination site (unexpected response code: 500)');
variable_del('acquia_connector_test_upload_server_to_fail');
$this
->drupalPost($this->migrate_path, $edit_fields, 'Migrate');
$this
->assertNoText('Unable to connect to migration destination site (unexpected response code: 500)');
variable_del('drupal_http_request_function');
}