Completed
Push — master ( b88af0...e8d3a3 )
by David de
02:37
created

testExceptionIsThrownWhenValueIsNotFound()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Port\Tests\ValueConverter;
4
5
use Port\ValueConverter\MappingValueConverter;
6
7
class MappingValueConverterTest extends \PHPUnit_Framework_TestCase
8
{
9
    public function testConvert()
10
    {
11
        $converter = new MappingValueConverter([
12
            'source' => 'destination',
13
            'foo' => null,
14
        ]);
15
16
        $this->assertSame('destination', call_user_func($converter, 'source'));
17
        $this->assertNull(call_user_func($converter, 'foo'));
18
    }
19
20
    /**
21
     * @expectedException Port\Exception\UnexpectedValueException
22
     * @expectedExceptionMessage Cannot find mapping for value "unexpected value"
23
     */
24
    public function testExceptionIsThrownWhenValueIsNotFound()
25
    {
26
        $converter = new MappingValueConverter([]);
27
28
        call_user_func($converter, 'unexpected value');
29
    }
30
}
31