-
Notifications
You must be signed in to change notification settings - Fork 3
/
awssdk.test
50 lines (43 loc) · 1.95 KB
/
awssdk.test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* @file
* Provide tests.
*
* @author Jimmy Berry ("boombatower", http://drupal.org/user/214218)
*/
class AWSSDKUnitTest extends DrupalUnitTestCase {
public static function getInfo() {
return array(
'name' => 'AWS SDK',
'description' => 'Ensure that AWS SDK libraries integration and configuration work properly.',
'group' => 'AWS SDK',
);
}
/**
* Ensure that AWS SDK libraries integration and configuration work properly.
*/
function testLibrary() {
// Set AWS SDK setting for checking later.
global $conf;
$conf['aws_key'] = '1337';
$conf['aws_secret'] = 'secret';
// Ensure the requirements check out properly and configuration settings
// were success loaded since awssdk_requirements() checks for them.
require_once 'includes/install.inc';
$requirements = awssdk_requirements('runtime');
if (!$this->assertEqual($requirements['awssdk']['severity'], REQUIREMENT_OK, 'AWS SDK library loaded and compatible.')) {
return;
}
// Ensure the version detection pattern works.
$info = libraries_load('awssdk');
$this->assertTrue($info['version'], 'Version detected (' . $info['version'] . ').');
// Ensure that the integration file was loaded.
$this->assertTrue(defined('CFRUNTIME_NAME') && CFRUNTIME_NAME == 'aws-sdk-php', 'Library integration file sdk.class.php loaded.');
// Ensure that the configuration was merged with the defaults and loaded.
$config = awssdk_config_load();
$this->assertEqual($config['key'], $conf['aws_key'], 'Configured setting for key overwrote default setting.');
$this->assertEqual($config['secret'], $conf['aws_secret'], 'Configured setting for secret overwrote default setting.');
$this->assertEqual($config['default_cache_config'], '', 'Configured default for default_cache_config provided.');
$this->assertEqual($config['certificate_authority'], FALSE, 'Configured default for certificate_authority provided.');
}
}