Completed
Push — 3.x ( b75183...b1c847 )
by Oskar
04:45
created

tests/Block/AdminListBlockServiceTest.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
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\AdminBundle\Tests\Block;
15
16
use Sonata\AdminBundle\Admin\Pool;
17
use Sonata\AdminBundle\Block\AdminListBlockService;
18
use Sonata\AdminBundle\Templating\TemplateRegistryInterface;
19
use Sonata\AdminBundle\Tests\Fixtures\Block\FakeBlockService;
20
use Sonata\BlockBundle\Test\AbstractBlockServiceTestCase;
21
22
/**
23
 * @author Sullivan Senechal <[email protected]>
24
 */
25
class AdminListBlockServiceTest extends AbstractBlockServiceTestCase
26
{
27
    /**
28
     * @var Pool
29
     */
30
    private $pool;
31
32
    /**
33
     * @var TemplateRegistryInterface
34
     */
35
    private $templateRegistry;
36
37
    protected function setUp(): void
38
    {
39
        parent::setUp();
40
41
        $this->pool = $this->getMockBuilder(Pool::class)->disableOriginalConstructor()->getMock();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockBuilder(\S...onstructor()->getMock() of type object<PHPUnit\Framework\MockObject\MockObject> is incompatible with the declared type object<Sonata\AdminBundle\Admin\Pool> of property $pool.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
42
43
        $this->templateRegistry = $this->prophesize(TemplateRegistryInterface::class);
44
    }
45
46
    public function testDefaultSettings(): void
47
    {
48
        $blockService = new AdminListBlockService('foo', $this->templating, $this->pool, $this->templateRegistry->reveal());
49
        $blockContext = $this->getBlockContext($blockService);
50
51
        $this->assertSettings([
52
            'groups' => false,
53
        ], $blockContext);
54
    }
55
56
    public function testOverriddenDefaultSettings(): void
57
    {
58
        $blockService = new FakeBlockService('foo', $this->templating, $this->pool, $this->templateRegistry->reveal());
59
        $blockContext = $this->getBlockContext($blockService);
60
61
        $this->assertSettings([
62
            'foo' => 'bar',
63
            'groups' => true,
64
        ], $blockContext);
65
    }
66
}
67