PropertyEncoderTest::testEncodeWithKey()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
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