StringToObjectConverterTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testConvert() 0 18 1
1
<?php
2
3
namespace Ddeboer\DataImport\ValueConverter;
4
5
use Ddeboer\DataImport\ValueConverter\StringToObjectConverter;
6
7
/**
8
 * @author Markus Bachmann <[email protected]>
9
 */
10
class StringToObjectConverterTest extends \PHPUnit_Framework_TestCase
11
{
12
    public function testConvert()
13
    {
14
        $repository = $this->getMock(
15
            'Doctrine\\Common\\Persistence\\ObjectRepository',
16
            array('find', 'findAll', 'findBy', 'findOneBy', 'getClassName', 'findOneByName')
17
        );
18
19
        $converter = new StringToObjectConverter($repository, 'name');
20
21
        $class = new \stdClass();
22
23
        $repository->expects($this->once())
24
            ->method('findOneByName')
25
            ->with('bar')
26
            ->will($this->returnValue($class));
27
28
        $this->assertEquals($class, call_user_func($converter, 'bar'));
29
    }
30
}
31