1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* (c) Christian Gripp <[email protected]> |
5
|
|
|
* |
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
7
|
|
|
* file that was distributed with this source code. |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace Core23\ShariffBundle\Tests\Block\Service; |
11
|
|
|
|
12
|
|
|
use Core23\ShariffBundle\Block\Service\ShariffShareBlockService; |
13
|
|
|
use Sonata\BlockBundle\Block\BlockContext; |
14
|
|
|
use Sonata\BlockBundle\Model\Block; |
15
|
|
|
use Sonata\BlockBundle\Model\BlockInterface; |
16
|
|
|
use Sonata\BlockBundle\Test\AbstractBlockServiceTestCase; |
17
|
|
|
|
18
|
|
|
class ShariffShareBlockServiceTest extends AbstractBlockServiceTestCase |
19
|
|
|
{ |
20
|
|
|
public function testDefaultSettings() |
21
|
|
|
{ |
22
|
|
|
$blockService = new ShariffShareBlockService('block.service', $this->templating); |
23
|
|
|
$blockContext = $this->getBlockContext($blockService); |
24
|
|
|
|
25
|
|
|
$this->assertSettings(array( |
26
|
|
|
'url' => null, |
27
|
|
|
'class' => '', |
28
|
|
|
'services' => array('twitter', 'facebook', 'googleplus'), |
29
|
|
|
'theme' => 'standard', |
30
|
|
|
'orientation' => 'horizontal', |
31
|
|
|
'flattrUser' => null, |
32
|
|
|
'flattrCategory' => null, |
33
|
|
|
'template' => 'Core23ShariffBundle:Block:block_shariff.html.twig', |
34
|
|
|
), $blockContext); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function testExecute() |
38
|
|
|
{ |
39
|
|
|
$block = new Block(); |
40
|
|
|
|
41
|
|
|
$blockContext = new BlockContext($block, array( |
42
|
|
|
'url' => null, |
43
|
|
|
'class' => '', |
44
|
|
|
'services' => array('twitter', 'facebook', 'googleplus'), |
45
|
|
|
'theme' => 'standard', |
46
|
|
|
'orientation' => 'horizontal', |
47
|
|
|
'flattrUser' => null, |
48
|
|
|
'flattrCategory' => null, |
49
|
|
|
'template' => 'Core23ShariffBundle:Block:block_shariff.html.twig', |
50
|
|
|
)); |
51
|
|
|
|
52
|
|
|
$blockService = new ShariffShareBlockService('block.service', $this->templating); |
53
|
|
|
$blockService->execute($blockContext); |
54
|
|
|
|
55
|
|
|
$this->assertSame('Core23ShariffBundle:Block:block_shariff.html.twig', $this->templating->view); |
56
|
|
|
|
57
|
|
|
$this->assertSame($blockContext, $this->templating->parameters['context']); |
58
|
|
|
$this->assertInternalType('array', $this->templating->parameters['settings']); |
59
|
|
|
$this->assertInstanceOf(BlockInterface::class, $this->templating->parameters['block']); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|