SetTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 22
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstructor() 0 11 1
A testName() 0 6 1
1
<?php
2
3
use PHPUnit\Framework\TestCase;
4
use HexMakina\Crudites\Grammar\Clause\Set;
5
use HexMakina\Crudites\Grammar\Predicate;
6
7
class SetTest extends TestCase
8
{
9
    public function testConstructor()
10
    {
11
        $alterations = ['field1' => 'value1'];
12
        $setClause = new Set($alterations);
13
        $this->assertEquals('SET `field1` = :set_field1', (string)$setClause);
14
        $this->assertEquals(['set_field1' => 'value1'], $setClause->bindings());
15
16
        $alterations = ['field1' => 'value1', 'field2' => 'value2'];
17
        $setClause = new Set($alterations);
18
        $this->assertEquals('SET `field1` = :set_field1,`field2` = :set_field2', (string)$setClause);
19
        $this->assertEquals(['set_field1' => 'value1','set_field2' => 'value2'], $setClause->bindings());
20
        
21
    }
22
23
    public function testName()
24
    {
25
        $alterations = ['field1' => 'value1'];
26
        $setClause = new Set($alterations);
27
28
        $this->assertEquals(Set::SET, $setClause->name());
29
    }
30
}