UpdateItemOperationTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 11
c 1
b 0
f 0
dl 0
loc 16
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testToArray() 0 14 1
1
<?php
2
3
namespace GuillermoandraeTest\DynamoDb\Operation;
4
5
use Guillermoandrae\DynamoDb\Constant\AttributeTypes;
6
use Guillermoandrae\DynamoDb\Constant\KeyTypes;
7
use Guillermoandrae\DynamoDb\Factory\DynamoDbClientFactory;
8
use Guillermoandrae\DynamoDb\Factory\MarshalerFactory;
9
use Guillermoandrae\DynamoDb\Operation\UpdateItemOperation;
10
use GuillermoandraeTest\DynamoDb\TestCase;
11
12
final class UpdateItemOperationTest extends TestCase
13
{
14
    public function testToArray()
15
    {
16
        $client = DynamoDbClientFactory::factory();
17
        $marshaler = MarshalerFactory::factory();
18
        $primaryKey = [
19
            'name' => [AttributeTypes::STRING, KeyTypes::HASH],
20
            'date' => [AttributeTypes::NUMBER, KeyTypes::RANGE],
21
        ];
22
        $updateData = [
23
            'something' => 'wicked',
24
            'this' => 'way comes'
25
        ];
26
        $operation = new UpdateItemOperation($client, $marshaler, 'test', $primaryKey, $updateData);
27
        $this->assertSame('SET something = :something and this = :this', $operation->toArray()['UpdateExpression']);
28
    }
29
}
30