PropertyEncoderTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 29
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testEncode() 0 6 1
A testEncodeWithKey() 0 6 1
1
<?php
2
3
namespace Psi\Bridge\ContentType\Tests\Unit\Doctrine\PhpcrOdm;
4
5
use Psi\Bridge\ContentType\Doctrine\PhpcrOdm\PropertyEncoder;
6
7
class PropertyEncoderTest extends \PHPUnit_Framework_TestCase
8
{
9
    private $encoder;
10
11
    public function setUp()
12
    {
13
        $this->encoder = new PropertyEncoder('prefix', 'https://example.com');
14
    }
15
16
    /**
17
     * It should encode a field name.
18
     */
19
    public function testEncode()
20
    {
21
        $propertyName = $this->encoder->encode('hello');
22
23
        $this->assertEquals('prefix:hello', $propertyName);
24
    }
25
26
    /**
27
     * Encode field name with key.
28
     */
29
    public function testEncodeWithKey()
30
    {
31
        $propertyName = $this->encoder->encode('hello', 'goodbye');
32
33
        $this->assertEquals('prefix:hello-goodbye', $propertyName);
34
    }
35
}
36