Completed
Push — master ( 45e18b...6bba54 )
by Guillermo A.
02:14
created

UpdateItemOperationTest::testToArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 14
rs 9.9332
cc 1
nc 1
nop 0
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