Completed
Push — master ( 74c3c7...591b88 )
by Eric
08:09
created

PagerfantaDataSourceTest::createAdapterMock()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Lug package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Lug\Component\Grid\Tests\DataSource;
13
14
use Lug\Component\Grid\DataSource\DataSourceInterface;
15
use Lug\Component\Grid\DataSource\PagerfantaDataSource;
16
use Pagerfanta\Adapter\AdapterInterface;
17
use Pagerfanta\Pagerfanta;
18
19
/**
20
 * @author GeLo <[email protected]>
21
 */
22
class PagerfantaDataSourceTest extends \PHPUnit_Framework_TestCase
23
{
24
    /**
25
     * @var PagerfantaDataSource
26
     */
27
    private $dataSource;
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    protected function setUp()
33
    {
34
        $this->dataSource = new PagerfantaDataSource($this->createAdapterMock());
0 ignored issues
show
Bug introduced by
It seems like $this->createAdapterMock() targeting Lug\Component\Grid\Tests...st::createAdapterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Pagerfanta\Pagerfanta::__construct() does only seem to accept object<Pagerfanta\Adapter\AdapterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
35
    }
36
37
    public function testInheritance()
38
    {
39
        $this->assertInstanceOf(DataSourceInterface::class, $this->dataSource);
40
        $this->assertInstanceOf(Pagerfanta::class, $this->dataSource);
41
    }
42
43
    /**
44
     * @return \PHPUnit_Framework_MockObject_MockObject|AdapterInterface
45
     */
46
    private function createAdapterMock()
47
    {
48
        return $this->getMock(AdapterInterface::class);
49
    }
50
}
51