Completed
Push — master ( 9eae13...e56856 )
by Antonio
04:26
created

testGetConfigurationValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 21
rs 9.3142
cc 1
eloc 14
nc 1
nop 0
1
<?php
2
namespace Da\Mailer\Test\Queue\Backend\Sqs;
3
4
use Aws\Sqs\SqsClient;
5
use Da\Mailer\Queue\Backend\Sqs\SqsQueueStoreConnection;
6
use PHPUnit_Framework_TestCase;
7
use ReflectionClass;
8
9
class SqsQueueStoreConnectionTest extends PHPUnit_Framework_TestCase
10
{
11
    public function testGetConfigurationValue()
12
    {
13
        $class = new ReflectionClass(SqsQueueStoreConnection::class);
14
15
        $method = $class->getMethod('getConfigurationValue');
16
        $method->setAccessible(true);
17
18
        $key = 'AKIAxxxxxxxxxxxxxxxZ';
19
        $secret = 'AxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxZ';
20
        $region = 'eu-north-99';
21
22
        $connection = new SqsQueueStoreConnection([
23
            'key' => $key,
24
            'secret' => $secret,
25
            'region' => $region,
26
        ]);
27
28
        $this->assertEquals($key, $method->invoke($connection, 'key'));
29
        $this->assertEquals($secret, $method->invoke($connection, 'secret'));
30
        $this->assertEquals($region, $method->invoke($connection, 'region'));
31
    }
32
33
    public function testConnect()
34
    {
35
        $connection = new SqsQueueStoreConnection([
36
            'key' => 'AKIAxxxxxxxxxxxxxxxZ',
37
            'secret' => 'AxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxZ',
38
            'region' => 'eu-north-99',
39
        ]);
40
41
        $this->assertTrue($connection->getInstance() instanceof SqsClient);
42
        $this->assertSame($connection, $connection->connect());
43
        $this->assertTrue($connection->getInstance() instanceof SqsClient);
44
        $this->assertSame($connection, $connection->connect());
45
        $this->assertTrue($connection->getInstance() instanceof SqsClient);
46
    }
47
}
48