Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Commit

Permalink
change template path to new pattern (#292)
Browse files Browse the repository at this point in the history
* adjust template paths to use the new pattern for symfony 4
* fix testing configuration
  • Loading branch information
ElectricMaxxx authored and dbu committed Nov 13, 2018
1 parent 1bafb5c commit e3863bf
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 18 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,14 @@
Changelog
=========

2.1.1
-----

* **2018-11-13**: [BUGFIX] Older template path `CmfBlockBundl:Block:some-template.html.twig` is replaced to `@CmfBlock/Block/some-template.html.twig` to be recognized by newer Symfony versions

2.1.0
-----

* **2017-11-16**: Removed php 5.6 and 7.0 support, removed Symfony 3.0.* and 3.1.* support

2.0.0
Expand Down
9 changes: 7 additions & 2 deletions phpunit.xml.dist
Expand Up @@ -5,8 +5,13 @@
bootstrap="vendor/symfony-cmf/testing/bootstrap/bootstrap.php"
>
<testsuites>
<testsuite name="Symfony CmfBlockBundle Test Suite">
<directory>./tests/</directory>
<testsuite name="unit tests">
<directory>./tests/Unit</directory>
</testsuite>

<testsuite name="functional tests with phpcr">
<directory>./tests/WebTest</directory>
<directory>./tests/Functional</directory>
</testsuite>
</testsuites>

Expand Down
2 changes: 1 addition & 1 deletion src/Block/ContainerBlockService.php
Expand Up @@ -30,7 +30,7 @@ class ContainerBlockService extends AbstractBlockService implements BlockService
/**
* @var string
*/
protected $template = 'CmfBlockBundle:Block:block_container.html.twig';
protected $template = '@CmfBlock/Block/block_container.html.twig';

/**
* @param string $name
Expand Down
2 changes: 1 addition & 1 deletion src/Block/MenuBlockService.php
Expand Up @@ -25,7 +25,7 @@
*/
class MenuBlockService extends AbstractBlockService implements BlockServiceInterface
{
protected $template = 'CmfBlockBundle:Block:block_menu.html.twig';
protected $template = '@CmfBlock/Block/block_menu.html.twig';

public function __construct($name, $templating, $template = null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Block/SimpleBlockService.php
Expand Up @@ -20,7 +20,7 @@

class SimpleBlockService extends AbstractBlockService implements BlockServiceInterface
{
protected $template = 'CmfBlockBundle:Block:block_simple.html.twig';
protected $template = '@CmfBlock/Block/block_simple.html.twig';

public function __construct($name, $templating, $template = null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Block/StringBlockService.php
Expand Up @@ -20,7 +20,7 @@

class StringBlockService extends AbstractBlockService implements BlockServiceInterface
{
protected $template = 'CmfBlockBundle:Block:block_string.html.twig';
protected $template = '@CmfBlock/Block/block_string.html.twig';

public function __construct($name, $templating, $template = null)
{
Expand Down
8 changes: 4 additions & 4 deletions src/DependencyInjection/CmfBlockExtension.php
Expand Up @@ -31,7 +31,7 @@ public function prepend(ContainerBuilder $container)
if (isset($bundles['SonataBlockBundle'])) {
$config = [
'templates' => [
'block_base' => 'CmfBlockBundle:Block:block_base.html.twig',
'block_base' => '@CmfBlock/Block/block_base.html.twig',
],
'blocks_by_class' => [
0 => [
Expand All @@ -40,7 +40,7 @@ public function prepend(ContainerBuilder $container)
'title' => 'Insert the rss title',
'url' => false,
'maxItems' => 10,
'template' => 'CmfBlockBundle:Block:block_rss.html.twig',
'template' => '@CmfBlock/Block/block_rss.html.twig',
'itemClass' => 'Symfony\\Cmf\\Bundle\\BlockBundle\\Model\\FeedItem',
],
],
Expand Down Expand Up @@ -93,9 +93,9 @@ private function loadPhpcr(array $config, XmlFileLoader $loader, ContainerBuilde
$bundles = $container->getParameter('kernel.bundles');
if (isset($bundles['CmfCreateBundle'])) {
$blockLoader = $container->getDefinition('cmf.block.simple');
$blockLoader->addMethodCall('setTemplate', ['CmfBlockBundle:Block:block_simple_createphp.html.twig']);
$blockLoader->addMethodCall('setTemplate', ['@CmfBlock/Block/block_simple_createphp.html.twig']);
$blockLoader = $container->getDefinition('cmf.block.string');
$blockLoader->addMethodCall('setTemplate', ['CmfBlockBundle:Block:block_string_createphp.html.twig']);
$blockLoader->addMethodCall('setTemplate', ['@CmfBlock/Block/block_string_createphp.html.twig']);
}

if (isset($bundles['CmfMenuBundle'])) {
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/services.xml
Expand Up @@ -47,7 +47,7 @@
<argument>cmf.block.slideshow</argument>
<argument type="service" id="sonata.templating" />
<argument type="service" id="sonata.block.renderer" />
<argument>CmfBlockBundle:Block:block_slideshow.html.twig</argument>
<argument>@CmfBlock/Block/block_slideshow.html.twig</argument>
</service>

<service id="cmf.block.rss_controller" class="Symfony\Cmf\Bundle\BlockBundle\Controller\RssController" >
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/App/config/admin-test.xml
Expand Up @@ -5,7 +5,7 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="cmf_block_test.test_controller" class="Symfony\Cmf\Bundle\BlockBundle\Tests\Fixtures\App\Controller\TestController" />
<service id="cmf_block_test.test_controller" class="Symfony\Cmf\Bundle\BlockBundle\Tests\Fixtures\App\Controller\TestController" public="true"/>
</services>

</container>
4 changes: 2 additions & 2 deletions tests/Functional/Block/ContainerBlockServiceTest.php
Expand Up @@ -39,7 +39,7 @@ public function testExecutionOfDisabledBlock()

public function testExecutionOfEnabledBlock()
{
$template = 'CmfBlockBundle:Block:block_container.html.twig';
$template = '@CmfBlock/Block/block_container.html.twig';

$simpleBlock1 = new SimpleBlock();
$simpleBlock1->setId(1);
Expand Down Expand Up @@ -86,7 +86,7 @@ public function testExecutionOfEnabledBlock()

public function testExecutionOfBlockWithNoChildren()
{
$template = 'CmfBlockBundle:Block:block_container.html.twig';
$template = '@CmfBlock/Block/block_container.html.twig';

$childrenCollectionMock = $this->createMock(ChildrenCollection::class);

Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Block/MenuBlockServiceTest.php
Expand Up @@ -40,7 +40,7 @@ public function testExecutionOfDisabledBlock()

public function testExecutionOfEnabledBlock()
{
$template = 'CmfBlockBundle:Block:block_menu.html.twig';
$template = '@CmfBlock/Block/block_menu.html.twig';
$menuNode = new MenuNode();

$menuBlock = new MenuBlock();
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Block/SimpleBlockServiceTest.php
Expand Up @@ -20,7 +20,7 @@ class SimpleBlockServiceTest extends \PHPUnit_Framework_TestCase
{
public function testExecutionOfEnabledBlock()
{
$template = 'CmfBlockBundle:Block:block_simple.html.twig';
$template = '@CmfBlock/Block/block_simple.html.twig';
$simpleBlock = new SimpleBlock();
$simpleBlock->setEnabled(true);
$blockContext = new BlockContext($simpleBlock, ['template' => $template]);
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Block/StringBlockServiceTest.php
Expand Up @@ -20,7 +20,7 @@ class StringBlockServiceTest extends \PHPUnit_Framework_TestCase
{
public function testExecutionOfEnabledBlock()
{
$template = 'CmfBlockBundle:Block:block_string.html.twig';
$template = '@CmfBlock/Block/block_string.html.twig';
$stringBlock = new StringBlock();
$stringBlock->setEnabled(true);
$blockContext = new BlockContext($stringBlock, ['template' => $template]);
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/DependencyInjection/XmlSchemaTest.php
Expand Up @@ -18,7 +18,7 @@ class XmlSchemaTest extends XmlSchemaTestCase
public function testSchema()
{
$xmlFiles = array_map(function ($file) {
return __DIR__.'/../..//Fixtures/App/config/'.$file;
return __DIR__.'/../..//Fixtures/fixtures/config/'.$file;
}, [
'config1.xml',
'config2.xml',
Expand Down
1 change: 1 addition & 0 deletions tests/WebTest/Render/ReferenceBlockRenderTest.php
Expand Up @@ -34,6 +34,7 @@ public function testRenderReferenceTwig()
$crawler = $this->client->request('GET', '/render-reference-test');

$res = $this->client->getResponse();

$this->assertEquals(200, $res->getStatusCode());

$this->assertCount(1, $crawler->filter('html:contains("Dummy action")'));
Expand Down

0 comments on commit e3863bf

Please sign in to comment.