Completed
Push — master ( 08f930...54ffd8 )
by David de
02:36
created

ValueConverter/StringToObjectConverterTest.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Port\Tests\ValueConverter;
4
5
use Port\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->getMockBuilder(
15
            'Doctrine\\Common\\Persistence\\ObjectRepository',
16
            ['find', 'findAll', 'findBy', 'findOneBy', 'getClassName', 'findOneByName']
0 ignored issues
show
The call to StringToObjectConverterTest::getMockBuilder() has too many arguments starting with array('find', 'findAll',...Name', 'findOneByName').

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
17
        )
18
            ->setMethods(['findOneByName'])
19
            ->getMock();
20
21
        $converter = new StringToObjectConverter($repository, 'name');
22
23
        $class = new \stdClass();
24
25
        $repository->expects($this->once())
26
            ->method('findOneByName')
27
            ->with('bar')
28
            ->will($this->returnValue($class));
29
30
        $this->assertEquals($class, call_user_func($converter, 'bar'));
31
    }
32
}
33