This repository has been archived by the owner on Feb 26, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Missing test files after refactoring folder structure
- Loading branch information
Showing
2 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
/* | ||
* (c) Christian Gripp <mail@core23.de> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Core23\ShariffBundle\Tests\Block\Service; | ||
|
||
use Core23\ShariffBundle\Block\Service\ShariffShareBlockService; | ||
use Sonata\BlockBundle\Block\BlockContext; | ||
use Sonata\BlockBundle\Model\Block; | ||
use Sonata\BlockBundle\Model\BlockInterface; | ||
use Sonata\BlockBundle\Test\AbstractBlockServiceTestCase; | ||
|
||
class ShariffShareBlockServiceTest extends AbstractBlockServiceTestCase | ||
{ | ||
public function testDefaultSettings() | ||
{ | ||
$blockService = new ShariffShareBlockService('block.service', $this->templating); | ||
$blockContext = $this->getBlockContext($blockService); | ||
|
||
$this->assertSettings(array( | ||
'url' => null, | ||
'class' => '', | ||
'services' => array('twitter', 'facebook', 'googleplus'), | ||
'theme' => 'standard', | ||
'orientation' => 'horizontal', | ||
'flattrUser' => null, | ||
'flattrCategory' => null, | ||
'template' => 'Core23ShariffBundle:Block:block_shariff.html.twig', | ||
), $blockContext); | ||
} | ||
|
||
public function testExecute() | ||
{ | ||
$block = new Block(); | ||
|
||
$blockContext = new BlockContext($block, array( | ||
'url' => null, | ||
'class' => '', | ||
'services' => array('twitter', 'facebook', 'googleplus'), | ||
'theme' => 'standard', | ||
'orientation' => 'horizontal', | ||
'flattrUser' => null, | ||
'flattrCategory' => null, | ||
'template' => 'Core23ShariffBundle:Block:block_shariff.html.twig', | ||
)); | ||
|
||
$blockService = new ShariffShareBlockService('block.service', $this->templating); | ||
$blockService->execute($blockContext); | ||
|
||
$this->assertSame('Core23ShariffBundle:Block:block_shariff.html.twig', $this->templating->view); | ||
|
||
$this->assertSame($blockContext, $this->templating->parameters['context']); | ||
$this->assertInternalType('array', $this->templating->parameters['settings']); | ||
$this->assertInstanceOf(BlockInterface::class, $this->templating->parameters['block']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
/* | ||
* (c) Christian Gripp <mail@core23.de> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Core23\ShariffBundle\Tests\DependencyInjection; | ||
|
||
use Core23\ShariffBundle\DependencyInjection\Core23ShariffExtension; | ||
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; | ||
|
||
class Core23ShariffExtensionTest extends AbstractExtensionTestCase | ||
{ | ||
public function testLoadDefault() | ||
{ | ||
$this->load(); | ||
|
||
$this->assertContainerBuilderHasParameter('core23_shariff.options', array( | ||
'domains' => array(), | ||
'services' => array('GooglePlus', 'LinkedIn', 'Reddit', 'StumbleUpon', 'Flattr', 'Pinterest', 'Xing', 'AddThis'), | ||
)); | ||
} | ||
|
||
public function testLoadFacebook() | ||
{ | ||
$this->load(array( | ||
'services' => array( | ||
'facebook' => array( | ||
'app_id' => 'foo_id', | ||
'secret' => 'app_secret', | ||
), | ||
), | ||
)); | ||
|
||
$this->assertContainerBuilderHasParameter('core23_shariff.options', array( | ||
'domains' => array(), | ||
'services' => array('GooglePlus', 'Facebook', 'LinkedIn', 'Reddit', 'StumbleUpon', 'Flattr', 'Pinterest', 'Xing', 'AddThis'), | ||
'Facebook' => array( | ||
'app_id' => 'foo_id', | ||
'secret' => 'app_secret', | ||
), | ||
)); | ||
} | ||
|
||
protected function getContainerExtensions() | ||
{ | ||
return array( | ||
new Core23ShariffExtension(), | ||
); | ||
} | ||
} |