Completed
Push — master ( 935dce...b0f788 )
by Christian
02:37
created

PiwikTrackerBlockServiceTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 9.4285
1
<?php
2
3
/*
4
 * This file is part of the ni-ju-san CMS.
5
 *
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\PiwikBundle\Tests\Block\Service;
13
14
use Core23\PiwikBundle\Block\Service\PiwikTrackerBlockService;
15
use Sonata\BlockBundle\Block\BlockContext;
16
use Sonata\BlockBundle\Model\Block;
17
use Sonata\BlockBundle\Tests\Block\AbstractBlockServiceTest;
18
19
class PiwikTrackerBlockServiceTest extends AbstractBlockServiceTest
20
{
21
    public function testExecute()
22
    {
23
        $block = new Block();
24
25
        $blockContext = new BlockContext($block, array(
26
            'host'        => null,
27
            'site'        => false,
28
            'domaintitle' => false,
29
            'donottrack'  => false,
30
            'nocookies'   => false,
31
            'template'    => 'Core23PiwikBundle:Block:block_piwik_tracker.html.twig',
32
        ));
33
34
        $blockService = new PiwikTrackerBlockService('block.service', $this->templating);
35
        $blockService->execute($blockContext);
36
37
        $this->assertSame('Core23PiwikBundle:Block:block_piwik_tracker.html.twig', $this->templating->view);
38
39
        $this->assertSame($blockContext, $this->templating->parameters['context']);
40
        $this->assertInternalType('array', $this->templating->parameters['settings']);
41
        $this->assertInstanceOf('Sonata\BlockBundle\Model\BlockInterface', $this->templating->parameters['block']);
42
    }
43
44
    public function testDefaultSettings()
45
    {
46
        $blockService = new PiwikTrackerBlockService('block.service', $this->templating);
47
        $blockContext = $this->getBlockContext($blockService);
48
49
        $this->assertSettings(array(
50
            'host'        => null,
51
            'site'        => false,
52
            'domaintitle' => false,
53
            'donottrack'  => false,
54
            'nocookies'   => false,
55
            'template'    => 'Core23PiwikBundle:Block:block_piwik_tracker.html.twig',
56
        ), $blockContext);
57
    }
58
}
59