-
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: Tests/Block/AbstractBlockServiceTest.php
- Loading branch information
Showing
13 changed files
with
224 additions
and
75 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
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 |
---|---|---|
|
@@ -23,3 +23,5 @@ enabled: | |
finder: | ||
exclude: | ||
- 'Tests/Fixtures' | ||
# ecommerce special case: | ||
- 'Resources/skeleton' |
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
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
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
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
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,81 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sonata Project package. | ||
* | ||
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sonata\BlockBundle\Test; | ||
|
||
use Sonata\BlockBundle\Block\BlockContextInterface; | ||
use Sonata\BlockBundle\Block\BlockContextManager; | ||
use Sonata\BlockBundle\Block\BlockContextManagerInterface; | ||
use Sonata\BlockBundle\Block\BlockServiceInterface; | ||
use Sonata\BlockBundle\Block\BlockServiceManagerInterface; | ||
use Sonata\BlockBundle\Tests\Block\Service\FakeTemplating; | ||
|
||
/** | ||
* Abstract test class for block service tests. | ||
* | ||
* @author Sullivan Senechal <soullivaneuh@gmail.com> | ||
*/ | ||
abstract class AbstractBlockServiceTestCase extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject|BlockServiceManagerInterface | ||
*/ | ||
protected $blockServiceManager; | ||
|
||
/** | ||
* @var BlockContextManagerInterface | ||
*/ | ||
protected $blockContextManager; | ||
|
||
/** | ||
* @var FakeTemplating | ||
*/ | ||
protected $templating; | ||
|
||
protected function setUp() | ||
{ | ||
$this->templating = new FakeTemplating(); | ||
|
||
$blockLoader = $this->getMock('Sonata\BlockBundle\Block\BlockLoaderInterface'); | ||
$this->blockServiceManager = $this->getMock('Sonata\BlockBundle\Block\BlockServiceManagerInterface'); | ||
$this->blockContextManager = new BlockContextManager($blockLoader, $this->blockServiceManager); | ||
} | ||
|
||
protected function getBlockContext(BlockServiceInterface $blockService) | ||
{ | ||
$this->blockServiceManager->expects($this->once())->method('get')->will($this->returnValue($blockService)); | ||
|
||
$block = $this->getMock('Sonata\BlockBundle\Model\BlockInterface'); | ||
$block->expects($this->once())->method('getSettings')->will($this->returnValue(array())); | ||
|
||
$blockContext = $this->blockContextManager->get($block); | ||
$this->assertInstanceOf('Sonata\BlockBundle\Block\BlockContextInterface', $blockContext); | ||
|
||
return $blockContext; | ||
} | ||
|
||
protected function assertSettings(array $expected, BlockContextInterface $blockContext) | ||
{ | ||
$completeExpectedOptions = array_merge(array( | ||
'use_cache' => true, | ||
'extra_cache_keys' => array(), | ||
'attr' => array(), | ||
'template' => false, | ||
'ttl' => 0, | ||
), $expected); | ||
|
||
ksort($completeExpectedOptions); | ||
$blockSettings = $blockContext->getSettings(); | ||
ksort($blockSettings); | ||
|
||
$this->assertSame($completeExpectedOptions, $blockSettings); | ||
} | ||
} |
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
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
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
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
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,12 @@ | ||
UPGRADE 3.x | ||
=========== | ||
|
||
## Deprecated AbstractBlockServiceTest class | ||
|
||
The `Tests\Block\AbstractBlockServiceTest` class is deprecated. Use `Test\AbstractBlockServiceTestCase` instead. | ||
|
||
### Tests | ||
|
||
All files under the ``Tests`` directory are now correctly handled as internal test classes. | ||
You can't extend them anymore, because they are only loaded when running internal tests. | ||
More information can be found in the [composer docs](https://getcomposer.org/doc/04-schema.md#autoload-dev). |
Oops, something went wrong.