| 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\ShariffBundle\Tests\Block\Service; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use Core23\ShariffBundle\Block\Service\ShariffShareBlockService; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use Sonata\BlockBundle\Block\BlockContext; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use Sonata\BlockBundle\Model\Block; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use Sonata\BlockBundle\Tests\Block\AbstractBlockServiceTest; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | class ShariffShareBlockServiceTest extends AbstractBlockServiceTest | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     public function testDefaultSettings() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |         $blockService = new ShariffShareBlockService('block.service', $this->templating); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |         $blockContext = $this->getBlockContext($blockService); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |         $this->assertSettings(array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |             'url'            => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |             'class'          => '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |             'services'       => array('twitter', 'facebook', 'googleplus'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |             'theme'          => 'standard', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |             'orientation'    => 'horizontal', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |             'flattrUser'     => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |             'flattrCategory' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |             'template'       => 'Core23ShariffBundle:Block:block_shariff.html.twig', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         ), $blockContext); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 38 |  |  |     public function testExecute() | 
            
                                                        
            
                                    
            
            
                | 39 |  |  |     { | 
            
                                                        
            
                                    
            
            
                | 40 |  |  |         $block = new Block(); | 
            
                                                        
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 42 |  |  |         $blockContext = new BlockContext($block, array( | 
            
                                                        
            
                                    
            
            
                | 43 |  |  |             'url'            => null, | 
            
                                                        
            
                                    
            
            
                | 44 |  |  |             'class'          => '', | 
            
                                                        
            
                                    
            
            
                | 45 |  |  |             'services'       => array('twitter', 'facebook', 'googleplus'), | 
            
                                                        
            
                                    
            
            
                | 46 |  |  |             'theme'          => 'standard', | 
            
                                                        
            
                                    
            
            
                | 47 |  |  |             'orientation'    => 'horizontal', | 
            
                                                        
            
                                    
            
            
                | 48 |  |  |             'flattrUser'     => null, | 
            
                                                        
            
                                    
            
            
                | 49 |  |  |             'flattrCategory' => null, | 
            
                                                        
            
                                    
            
            
                | 50 |  |  |             'template'       => 'Core23ShariffBundle:Block:block_shariff.html.twig', | 
            
                                                        
            
                                    
            
            
                | 51 |  |  |         )); | 
            
                                                        
            
                                    
            
            
                | 52 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 53 |  |  |         $blockService = new ShariffShareBlockService('block.service', $this->templating); | 
            
                                                        
            
                                    
            
            
                | 54 |  |  |         $blockService->execute($blockContext); | 
            
                                                        
            
                                    
            
            
                | 55 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 56 |  |  |         $this->assertSame('Core23ShariffBundle:Block:block_shariff.html.twig', $this->templating->view); | 
            
                                                        
            
                                    
            
            
                | 57 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 58 |  |  |         $this->assertSame($blockContext, $this->templating->parameters['context']); | 
            
                                                        
            
                                    
            
            
                | 59 |  |  |         $this->assertInternalType('array', $this->templating->parameters['settings']); | 
            
                                                        
            
                                    
            
            
                | 60 |  |  |         $this->assertInstanceOf('Sonata\BlockBundle\Model\BlockInterface', $this->templating->parameters['block']); | 
            
                                                        
            
                                    
            
            
                | 61 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 62 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 63 |  |  |  |