Completed
Push — master ( 06c1ce...67d37c )
by Jeroen
06:20
created

Configuration/SearchConfigurationChainTest.php (1 issue)

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 Kunstmaan\SearchBundle\Tests\DependencyInjection\Configuration;
4
5
use Kunstmaan\SearchBundle\Configuration\SearchConfigurationChain;
6
use PHPUnit\Framework\TestCase;
7
8
class SearchConfigurationChainTest extends TestCase
9
{
10
    public function testAddAndGetConfiguration()
11
    {
12
        $configuration = $this->createMock('Kunstmaan\SearchBundle\Configuration\SearchConfigurationInterface');
13
14
        $chain = new SearchConfigurationChain();
15
        $chain->addConfiguration($configuration, 'configuration');
0 ignored issues
show
$configuration is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Kunstmaan\SearchB...ConfigurationInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
16
17
        $this->assertEquals($configuration, $chain->getConfiguration('configuration'));
18
        $this->assertNotEmpty($chain->getConfigurations());
19
        $this->assertNull($chain->getConfiguration('youwontfindthis'));
20
    }
21
}
22