Passed
Push — master ( 445708...0db764 )
by Steffen
08:17
created

AbstractConverterTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testConversion() 0 8 1
1
<?php
2
/*
3
 * This file is part of the unicorn project
4
 *
5
 * (c) Philipp Braeutigam <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace Xynnn\Unicorn\Tests\Converter;
11
12
use PHPUnit_Framework_TestCase;
13
use Xynnn\Unicorn\ConverterInterface;
14
use Xynnn\Unicorn\Model\ConvertibleValue;
15
use Xynnn\Unicorn\Model\Unit;
16
17
abstract class AbstractConverterTest extends PHPUnit_Framework_TestCase
18
{
19
    /**
20
     * @dataProvider dataProvider
21
     * @param ConverterInterface $converter
22
     * @param ConvertibleValue $from
23
     * @param Unit $to
24
     * @param string $expectedValue
25
     * @param string $expectedUnitName
26
     * @param string $expectedUnitAbbreviation
27
     */
28
    public function testConversion(ConverterInterface $converter, ConvertibleValue $from, Unit $to, string $expectedValue, string $expectedUnitName, string $expectedUnitAbbreviation)
29
    {
30
        $result = $converter->convert($from, $to);
31
32
        $this->assertEquals($expectedValue, $result->getValue());
33
        $this->assertEquals($expectedUnitName, $result->getUnit()->getName());
34
        $this->assertEquals($expectedUnitAbbreviation, $result->getUnit()->getAbbreviation());
35
    }
36
37
}
38