Completed
Pull Request — 3.x (#6220)
by Vincent
03:02
created

testDefaultSettings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 9.6
c 0
b 0
f 0
cc 1
nc 1
nop 0
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\AdminStatsBlockService;
18
use Sonata\BlockBundle\Test\BlockServiceTestCase;
19
use Twig\Environment;
20
21
/**
22
 * NEXT_MAJOR: Remove this class.
23
 *
24
 * @group legacy
25
 *
26
 * @author Sullivan Senechal <[email protected]>
27
 */
28
class DeprecatedAdminStatsBlockServiceTest extends BlockServiceTestCase
29
{
30
    /**
31
     * @var Pool
32
     */
33
    private $pool;
34
35
    protected function setUp(): void
36
    {
37
        parent::setUp();
38
39
        $this->pool = $this->createMock(Pool::class);
40
    }
41
42
    /**
43
     * @expectedDeprecation Passing null as argument 2 to Sonata\AdminBundle\Block\AdminStatsBlockService::__construct() is deprecated since sonata-project/admin-bundle 3.x and will throw a \TypeError in version 4.0. You must pass an instance of Sonata\AdminBundle\Admin\Pool instead.
44
     */
45
    public function testDefaultSettings(): void
46
    {
47
        $blockService = new AdminStatsBlockService(
48
            $this->createMock(Environment::class),
49
            null,
50
            $this->pool
51
        );
52
        $blockContext = $this->getBlockContext($blockService);
53
54
        $this->assertSettings([
55
            'icon' => 'fa-line-chart',
56
            'text' => 'Statistics',
57
            'translation_domain' => null,
58
            'color' => 'bg-aqua',
59
            'code' => false,
60
            'filters' => [],
61
            'limit' => 1000,
62
            'template' => '@SonataAdmin/Block/block_stats.html.twig',
63
        ], $blockContext);
64
    }
65
}
66