forked from php-enqueue/enqueue-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSqsExtension.php
More file actions
30 lines (25 loc) · 806 Bytes
/
SqsExtension.php
File metadata and controls
30 lines (25 loc) · 806 Bytes
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
<?php
namespace Enqueue\Test;
use Enqueue\Sqs\SqsConnectionFactory;
use Enqueue\Sqs\SqsContext;
trait SqsExtension
{
/**
* @return SqsContext
*/
private function buildSqsContext()
{
if (false == getenv('AWS_SQS_ENDPOINT') && false == getenv('AWS_SQS_KEY')) {
throw new \PHPUnit_Framework_SkippedTestError('Functional tests are not allowed in this environment');
}
$config = [
'key' => getenv('AWS_SQS_KEY'),
'secret' => getenv('AWS_SQS_SECRET'),
'region' => getenv('AWS_SQS_REGION'),
'version' => getenv('AWS_SQS_VERSION'),
'endpoint' => getenv('AWS_SQS_ENDPOINT'),
'lazy' => false,
];
return (new SqsConnectionFactory($config))->createContext();
}
}