Completed
Push — master ( bf6746...03a380 )
by Antonio
02:19
created

PdoQueueStoreConnectionTest::testConnect()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
rs 9.4286
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
namespace Da\Mailer\Test\Queue\Sqs;
3
4
use Da\Mailer\Queue\Backend\Sqs\SqsQueueStoreConnection;
5
use PHPUnit_Framework_TestCase;
6
use ReflectionClass;
7
use Aws\Sqs\SqsClient;
8
9
class PdoQueueStoreConnectionTest 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->assertSame($connection, $connection->connect());
42
        $this->assertTrue($connection->getInstance() instanceof SqsClient);
43
    }
44
}
45